浏览代码

make tool parameters parsing compatible with the response of glm4 model in xinference provider when function tool call integerated (#11049)

tags/0.12.0
cyflhn 11 个月前
父节点
当前提交
87c831e5dd
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6
    1
      api/core/tools/tool_engine.py

+ 6
- 1
api/core/tools/tool_engine.py 查看文件

@@ -61,7 +61,12 @@ class ToolEngine:
if parameters and len(parameters) == 1:
tool_parameters = {parameters[0].name: tool_parameters}
else:
raise ValueError(f"tool_parameters should be a dict, but got a string: {tool_parameters}")
try:
tool_parameters = json.loads(tool_parameters)
except Exception as e:
pass
if not isinstance(tool_parameters, dict):
raise ValueError(f"tool_parameters should be a dict, but got a string: {tool_parameters}")

# invoke the tool
try:

正在加载...
取消
保存