mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 04:35:56 +08:00
make tool parameters parsing compatible with the response of glm4 model in xinference provider when function tool call integerated (#11049)
This commit is contained in:
parent
40a5f1c80a
commit
87c831e5dd
@ -61,7 +61,12 @@ class ToolEngine:
|
|||||||
if parameters and len(parameters) == 1:
|
if parameters and len(parameters) == 1:
|
||||||
tool_parameters = {parameters[0].name: tool_parameters}
|
tool_parameters = {parameters[0].name: tool_parameters}
|
||||||
else:
|
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
|
# invoke the tool
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user