Skip to content

Conversation

drifkin
Copy link
Contributor

@drifkin drifkin commented Aug 6, 2025

Previously our OpenAI chat completions compat layer assumed that tool calls and content would never be provided together, but this is not a correct assumption. Content is only optional when tool calls are present, but tool calls and content can be provided together

Fixes: #11704

Previously our OpenAI chat completions compat layer assumed that tool
calls and content would never be provided together, but this is not a
correct assumption. Content is only optional when tool calls are
present, but tool calls and content can be provided together

Fixes: #11704
apiToolCalls[i].Function.Name = tc.Function.Name
err := json.Unmarshal([]byte(tc.Function.Arguments), &apiToolCalls[i].Function.Arguments)
if err != nil {
return nil, errors.New("invalid tool call arguments")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worth returning the stringified args here?

@drifkin drifkin merged commit 8f14e1f into main Aug 6, 2025
8 checks passed
@drifkin drifkin deleted the drifkin/oai-tool-calling branch August 6, 2025 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GPT-OSS 120B has malformed tool calls and I'm not sure if it is on the Ollama side or the gpt-oss side
3 participants