fix: align responses ids and text handling#1310
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. 💤 Files selected but had no reviewable changes (1)
You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe PR enhances OpenAI response provider's tool call tracking by introducing state mappings to correlate item IDs, output indices, and call IDs, ensuring consistent tool_call_id references in streamed events while replacing dynamic response parsing with fixed content type assignment. Changes
Sequence DiagramsequenceDiagram
participant OpenAI as OpenAI API
participant Provider as OpenAI Provider
participant State as State Mappings
participant EventBus as Event Bus
OpenAI->>Provider: Stream: output_item.added (item.id, item.call_id)
Provider->>State: Store nativeToolCallIdByItemId[item.id] = item.call_id
Provider->>EventBus: Emit tool_call_start (tool_call_id = resolved callId)
OpenAI->>Provider: Stream: function_call_arguments.delta
Provider->>State: Lookup callId via itemId or output_index
Provider->>EventBus: Emit tool_call_chunk (tool_call_id = resolved callId, partial args)
OpenAI->>Provider: Stream: function_call_arguments.done
Provider->>State: Retrieve complete arguments from mapping
Provider->>EventBus: Emit tool_call_chunk (tool_call_id = resolved callId, complete args)
OpenAI->>Provider: Stream: output_item.done
Provider->>State: Store mapping for output_index to call_id
Provider->>EventBus: Emit tool_call_end (tool_call_id = resolved callId)
OpenAI->>Provider: Stream: completed
Provider->>EventBus: Emit stop (reason = 'tool_use')
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly Related PRs
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Aligned our OpenAI Responses integration with official docs by using
input_text/output_textcorrectly and fixing streamed function-callitem_id/call_idmapping with regression tests.Summary by CodeRabbit
Bug Fixes
Tests