Closed arcstep closed 5 months ago
收到反馈,与你取得联系
此问题已修复,您可以通过如下参数控制一些传输层的问题
在core/_http_client.py中,可以配置网络链接的超时时间,重试次数,限制等参数
# 通过 `Timeout` 控制接口`connect` 和 `read` 超时时间,默认为`timeout=300.0, connect=8.0`
ZHIPUAI_DEFAULT_TIMEOUT = httpx.Timeout(timeout=300.0, connect=8.0)
# 通过 `retry` 参数控制重试次数,默认为3次
ZHIPUAI_DEFAULT_MAX_RETRIES = 3
# 通过 `Limits` 控制最大连接数和保持连接数,默认为`max_connections=50, max_keepalive_connections=10`
ZHIPUAI_DEFAULT_LIMITS = httpx.Limits(max_connections=50, max_keepalive_connections=10)
同样在ZhipuAI入参中可以配置
client = ZhipuAI(
timeout= httpx.Timeout(timeout=300.0, connect=8.0),
max_retries=3,
)
以下问题在我的笔记本上可以重现
首先,我定义了一个工具
正常返回的情况:
此时会正确生成回调消息:
服务端报错的情况:
两者差别仅仅在于,提示语后面多个“请回答”或“请查询本地服务”等字眼,因此不像是格式问题,更像是服务端的某种要求。**
报错如下: