Repository navigation
fix(tools): handle tuple parameters in external tool adapters - #8480
Open
zhanghm783-hash wants to merge 1 commit into
Open
zhanghm783-hash wants to merge 1 commit into
zhanghm783-hash wants to merge 1 commit into
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. |
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.
Link to Issue or Description of Change
Problem
LangChain and CrewAI tools with fixed-length tuple arguments fail while ADK builds their function declarations. Pydantic emits
prefixItemswithoutitems, and the adapter mapping indexesitemsdirectly. A real LangChain wrapper raisesValueError: Failed to build function declaration for Langchain tool: 'items'before the tool can run.Reproduced on main at
e90308ed988bedcf4ba41742eac81886161ea9a5, Windows, Python 3.12.10, google-genai 2.34.0 and langchain-core 1.8.5.Solution
Reuse the existing tuple-schema normalizer before mapping adapter parameters. This follows the handling already used by the FunctionTool fallback. Regression coverage checks fixed, heterogeneous, nullable and nested tuples through both adapter declaration builders, including item types and length bounds.
Testing Plan
Unit tests
The eight new cases fail on the unmodified source with
KeyError: 'items'. After the fix, the following related files report 258 passed.Manual adapter verification
With the checkout on PYTHONPATH and its dependencies installed, run this local tool.
Before the change, declaration building raises the error above. After the change, the declaration has an ARRAY of NUMBER values with length bounds of two, and the tool returns
4.0.This is an offline declaration and tool-execution check. Live model requests, the complete CrewAI wrapper integration, the full repository test matrix and remote CI have not been verified.
isort, pyink, Ruff, codespell, compliance, documentation and whitespace checks passed. The Windows pre-commit launcher could not find /bin/bash for the new-file check. Its Python entry point passed separately with the added-file list generated from the actual diff, which adds no files.