Use "{}" instead of empty string for arguments (#422)
This commit is contained in:
parent
01f5e86ea5
commit
bf302c574c
1 changed files with 3 additions and 2 deletions
|
|
@ -923,12 +923,13 @@ class _Converter:
|
||||||
elif func_call := cls.maybe_function_tool_call(item):
|
elif func_call := cls.maybe_function_tool_call(item):
|
||||||
asst = ensure_assistant_message()
|
asst = ensure_assistant_message()
|
||||||
tool_calls = list(asst.get("tool_calls", []))
|
tool_calls = list(asst.get("tool_calls", []))
|
||||||
|
arguments = func_call["arguments"] if func_call["arguments"] else "{}"
|
||||||
new_tool_call = ChatCompletionMessageToolCallParam(
|
new_tool_call = ChatCompletionMessageToolCallParam(
|
||||||
id=func_call["call_id"],
|
id=func_call["call_id"],
|
||||||
type="function",
|
type="function",
|
||||||
function={
|
function={
|
||||||
"name": func_call["name"],
|
"name": func_call["name"],
|
||||||
"arguments": func_call["arguments"],
|
"arguments": arguments,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
tool_calls.append(new_tool_call)
|
tool_calls.append(new_tool_call)
|
||||||
|
|
@ -971,7 +972,7 @@ class ToolConverter:
|
||||||
}
|
}
|
||||||
|
|
||||||
raise UserError(
|
raise UserError(
|
||||||
f"Hosted tools are not supported with the ChatCompletions API. FGot tool type: "
|
f"Hosted tools are not supported with the ChatCompletions API. Got tool type: "
|
||||||
f"{type(tool)}, tool: {tool}"
|
f"{type(tool)}, tool: {tool}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue