fix(llm): keep tool calls in Responses API assistant messages that have content - #5941
Open
RaphaelFakhri wants to merge 2 commits into
Open
RaphaelFakhri wants to merge 2 commits into
RaphaelFakhri wants to merge 2 commits into
Conversation
|
|
Contributor
There was a problem hiding this comment.
No issues found across 2 files
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
Re-trigger cubic
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ResponsesAPIMessageSerializer(used byChatAzureOpenAIfor Responses API models) converts an assistant message's tool calls to text becauseEasyInputMessageParamhas no tool call field. It only did this whencontentwasNone. If the assistant message had both content and tool calls, the tool calls were silently dropped from the model input.Changes
input_textpart is appended.Tests
Added two cases to
tests/ci/models/test_azure_responses_api.py: string content with tool calls, and text-part content with tool calls.pytest tests/ci/models/test_azure_responses_api.py: 2 failed, 15 passed, 2 skipped before the change; 17 passed, 2 skipped after.ruff checkandruff format --checkare clean.Summary by cubic
Fixes
ResponsesAPIMessageSerializersilently dropping tool calls when an assistant message has both content and tool calls. Tool calls are now appended to the assistant content instead of only being serialized when content isNone.input_textpart for content parts.Written for commit e5fc798. Summary will update on new commits.