Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/agents/models/openai_chatcompletions.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,12 +923,13 @@ def ensure_assistant_message() -> ChatCompletionAssistantMessageParam:
elif func_call := cls.maybe_function_tool_call(item):
asst = ensure_assistant_message()
tool_calls = list(asst.get("tool_calls", []))
arguments = func_call["arguments"] if func_call["arguments"] else "{}"
new_tool_call = ChatCompletionMessageToolCallParam(
id=func_call["call_id"],
type="function",
function={
"name": func_call["name"],
"arguments": func_call["arguments"],
"arguments": arguments,
},
)
tool_calls.append(new_tool_call)
Expand Down Expand Up @@ -971,7 +972,7 @@ def to_openai(cls, tool: Tool) -> ChatCompletionToolParam:
}

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}"
)

Expand Down