fix: add missing tool_calls and function name to messages in mistral_api_pt

This commit is contained in:
alisalim17 2024-04-18 20:49:01 +04:00
parent fa8a9568aa
commit a3f90ab735

View file

@ -145,6 +145,12 @@ def mistral_api_pt(messages):
elif isinstance(m["content"], str):
texts = m["content"]
new_m = {"role": m["role"], "content": texts}
if new_m["role"] == "tool" and m.get("name"):
new_m["name"] = m["name"]
if m.get("tool_calls"):
new_m["tool_calls"] = m["tool_calls"]
new_messages.append(new_m)
return new_messages