Skip to content

Conversation

@jamesrochabrun
Copy link
Owner

Summary

  • Make name optional in FunctionCallArgumentsDoneEvent to fix decoding error when OpenAI API omits this field

Fixes #188

Problem

When streaming responses with function calls, the decoder fails with:

Key 'name' not found: No value associated with key CodingKeys(stringValue: "name", intValue: nil)

The OpenAI API doesn't always include the name field in response.function_call_arguments.done streaming events.

Solution

Changed name from String to String? in FunctionCallArgumentsDoneEvent, aligning with the pattern already used in ToolCall.FunctionCall.

Test plan

  • Run ResponseAPIDemo with a custom function tool
  • Verify streaming function calls complete without decoding errors

🤖 Generated with Claude Code

Make 'name' optional in FunctionCallArgumentsDoneEvent to handle cases
where OpenAI API omits this field in response.function_call_arguments.done
streaming events.

Fixes #188

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jamesrochabrun jamesrochabrun merged commit 7e43ce0 into main Dec 27, 2025
3 checks passed
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.

Responses stream function call: Key 'name' not found

2 participants