fix: use Optional[str] instead of str | None for Google ADK function parameters #515
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.
Fix Google ADK Python Sample
Summary
Fixed automatic function calling errors in the Google ADK agent by replacing
str | None
type hints withOptional[str]
in function signatures. This makes the function signatures compatible with automatic function calling parsers.The error
This error happens when trying to use the google adk agent from the python samples https://github.com/google/A2A/tree/main/samples/python/agents/google_adk .
When requesting a reimbursement in a conversation the agent tries to handle the form but it fails throwing the following error:
Changes
create_request_form
functionreturn_form
functionOptional
from typing moduleTesting
Verified that the agent now properly handles function calls without parsing errors.
Some screenshots
Description
Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
CONTRIBUTING
Guide.nox -s format
from the repository root to format)Fixes #457 , #422 🦕