Support Mistral format tools
Former-commit-id: e42d0e54b7a64a3f017a09e99846d174db7b438f
This commit is contained in:
@@ -157,7 +157,7 @@ class WebChatModel(ChatModel):
|
||||
result = response
|
||||
|
||||
if isinstance(result, list):
|
||||
tool_calls = [{"name": tool[0], "arguments": json.loads(tool[1])} for tool in result]
|
||||
tool_calls = [{"name": tool.name, "arguments": json.loads(tool.arguments)} for tool in result]
|
||||
tool_calls = json.dumps(tool_calls, indent=4, ensure_ascii=False)
|
||||
output_messages = messages + [{"role": Role.FUNCTION.value, "content": tool_calls}]
|
||||
bot_text = "```json\n" + tool_calls + "\n```"
|
||||
|
||||
Reference in New Issue
Block a user