feat(tools): Support tuple tool parameters#6076
Conversation
Parse homogeneous tuple annotations as array schemas for automatic function declarations instead of falling back to Pydantic JSON schema output that GenAI Schema rejects. Fixes google#3575
|
Hi @RaghunandanKumar , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Can you please fix the failing mypy-diff tests before we can proceed with the review. |
|
Hi @rohityan, I pushed a follow-up fix in The issue was the new tuple handling comparing the typed Local verification:
The new PR head currently shows |
Merge #6076 ## Summary - Support homogeneous tuple annotations such as `tuple[float, float]` and `tuple[str, ...]` in automatic function declarations. - Parse supported tuples as array schemas instead of falling back to Pydantic JSON schema fields that `google.genai.types.Schema` rejects. - Add regression coverage for tuple tool parameters and optional tuple parameters. Fixes #3575 ## Verification - `uv run pytest tests/unittests/tools/test_from_function_with_options.py -q` - `uv run pytest tests/unittests/tools -q` - `uv run pre-commit run --files src/google/adk/tools/_function_parameter_parse_util.py tests/unittests/tools/test_from_function_with_options.py` Co-authored-by: Haran Rajkumar <haranrk@google.com> COPYBARA_INTEGRATE_REVIEW=#6076 from RaghunandanKumar:fix/issue-3575 a53780a PiperOrigin-RevId: 934745222
|
Thank you @RaghunandanKumar for your contribution! 🎉 Your changes have been successfully imported and merged via Copybara in commit a57c3e4. Closing this PR as the changes are now in the main branch. |
Summary
tuple[float, float]andtuple[str, ...]in automatic function declarations.google.genai.types.Schemarejects.Fixes #3575
Verification
uv run pytest tests/unittests/tools/test_from_function_with_options.py -quv run pytest tests/unittests/tools -quv run pre-commit run --files src/google/adk/tools/_function_parameter_parse_util.py tests/unittests/tools/test_from_function_with_options.py