Skip to content

fix: #3104 stabilize chat completions tool call output indexes - #3161

Merged
seratch merged 1 commit into
mainfrom
fix/chatcmpl-fallback-tool-call-indexes
May 6, 2026
Merged

seratch merged 1 commit into
mainfrom
fix/chatcmpl-fallback-tool-call-indexes

Conversation

@seratch

@seratch seratch commented May 6, 2026

Copy link
Copy Markdown
Member

This pull request fixes #3104 Chat Completions streaming output indexes for fallback tool calls by assigning each function call a stable output index when it is first observed, then reusing that index for both streamed and fallback event paths.

The previous fallback path computed indexes from the number of already-streaming calls at completion time, which could duplicate fallback indexes and could also invert indexes when a fallback call appeared before another call that later streamed in real time. This keeps response.output_item.added, response.function_call_arguments.delta, and response.output_item.done aligned with the final response.output order for all-fallback and mixed fallback/streamed tool calls.

@seratch seratch added this to the 0.16.x milestone May 6, 2026
@github-actions github-actions Bot added bug Something isn't working feature:chat-completions labels May 6, 2026
@seratch
seratch merged commit 8c8a2eb into main May 6, 2026
10 checks passed
@seratch
seratch deleted the fix/chatcmpl-fallback-tool-call-indexes branch May 6, 2026 23:49
RudrenduPaul pushed a commit to RudrenduPaul/openai-agents-python that referenced this pull request Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working feature:chat-completions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chat Completions streaming fallback tool calls can reuse output_index

1 participant