Repository navigation
fix(openai): only unwrap bare {"result"} tool responses - #7847
Open
ninglinLiu wants to merge 14 commits into
Open
ninglinLiu wants to merge 14 commits into
ninglinLiu wants to merge 14 commits into
Conversation
OpenAIResponsesLlm._serialize_json_value unwrapped any mapping that
contained a non-None "result" key, dropping sibling fields. Match
AnthropicLlm: unwrap only when the keys are exactly {"result"}.
Fixes google#7836
This PR was prepared with AI assistance and reviewed/tested by the author.
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.
Description
Fixes #7836
OpenAIResponsesLlm._serialize_json_valueunwrapped any mapping that contained a non-None"result"key and sent only that value asfunction_call_output. ADK wraps a non-dict tool return as exactly{"result": value}, but a tool's own dict can also include aresultkey next to other fields (e.g.{"result": "found 2 contracts", "contracts": [...], "next_page_token": "abc"}), which was silently reduced to just the string.Match
AnthropicLlm(fixed in #7073): unwrap only whenkeys() == {"result"}.Test plan
This PR was prepared with AI assistance and reviewed/tested by the author.