baidubce / bce-qianfan-sdk

Provide best practices for LMOps, as well as elegant and convenient access to the features of the Qianfan MaaS Platform. (提供大模型工具链最佳实践,以及优雅且便捷地访问千帆大模型平台)
https://cloud.baidu.com/doc/WENXINWORKSHOP/index.html
Apache License 2.0
334 stars 51 forks source link

如何结合swarm。 利用qianfan openai 总是报错。 #876

Open NaiveteYaYa opened 5 days ago

NaiveteYaYa commented 5 days ago

Issue you'd like to raise.

No response

Suggestion:

No response

NaiveteYaYa commented 5 days ago

File "/xxx/lib/python3.11/site-packages/qianfan/extensions/openai/adapter.py", line 168, in openai_base_request_to_qianfan for tool in tools: TypeError: 'NoneType' object is not iterable

这个问题是 extentions/openai/adapter.py

if "tools" in openai_request: qianfan_request["functions"] = [] tools = openai_request["tools"] for tool in tools: if tool["type"] == "function": qianfan_request["functions"].append(tool["function"])

没有判断 tools 是否为None 造成的

Dobiichi-Origami commented 4 days ago

感谢您的反馈,我们会对这个问题进行分析