fix(models): preserve string content in anthropic tool results#5373
Open
lawrence3699 wants to merge 2 commits intogoogle:mainfrom
Open
fix(models): preserve string content in anthropic tool results#5373lawrence3699 wants to merge 2 commits intogoogle:mainfrom
lawrence3699 wants to merge 2 commits intogoogle:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Collaborator
|
Response from ADK Triaging Agent Hello @lawrence3699, thank you for your contribution! It looks like the Contributor License Agreement (CLA) has not been signed. Please sign the CLA to proceed with the review process. You can find more information in the "cla/google" check at the bottom of the pull request. Thanks! |
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.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
Problem:
part_to_message_block()currently assumes everyfunction_response.response["content"]value is a list-like content payload.LoadSkillResourceToolreturns a plain string incontent, so Claude tool results get flattened character-by-character with newlines inserted.On current
main, this deterministic repro returns the wrong content:Solution:
Keep the existing list handling for Anthropic content blocks, but branch on the runtime type of
response["content"]:""): pass it through as a scalar stringThat preserves
LoadSkillResourceToolstring payloads without changing the existingcontentlist contract.Testing Plan
Unit Tests:
Passed
pytestresults:pytest tests/unittests/models/test_anthropic_llm.py -q43 passed, 1 warning in 1.38spytest tests/unittests/tools/test_skill_toolset.py -k 'load_resource_run_async' -q10 passed, 71 deselected, 2 warnings in 1.27sManual End-to-End (E2E) Tests:
Minimal local repro after the patch:
Console output:
Checklist
Additional context
I also checked upstream overlap before opening this PR:
#5364already has open PR#5366, so I did not touch that nearby schema bug.#5358or another in-flightpart_to_message_block()string-content fix.