-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Default value is not supported in function declaration schema for Google AI #3275
Copy link
Copy link
Closed
Labels
core[Component] This issue is related to the core interface and implementation[Component] This issue is related to the core interface and implementationgood first issue[Community] This issue is good for newcomers to participate[Community] This issue is good for newcomers to participateneeds review[Status] The PR/issue is awaiting review from the maintainer[Status] The PR/issue is awaiting review from the maintainerrequest clarification[Status] The maintainer need clarification or more information from the author[Status] The maintainer need clarification or more information from the author
Metadata
Metadata
Assignees
Labels
core[Component] This issue is related to the core interface and implementation[Component] This issue is related to the core interface and implementationgood first issue[Community] This issue is good for newcomers to participate[Community] This issue is good for newcomers to participateneeds review[Status] The PR/issue is awaiting review from the maintainer[Status] The PR/issue is awaiting review from the maintainerrequest clarification[Status] The maintainer need clarification or more information from the author[Status] The maintainer need clarification or more information from the author
Describe the bug
Default parameter values in function tool declarations cause errors when using Google AI (Gemini API) but work correctly with Vertex AI. The ADK documentation states that default values are supported for optional parameters, but the implementation appears to have variant-specific behavior that isn't documented.
To Reproduce
Install ADK:
pip install google-adkCreate a function tool with default parameters:
Run the agent and attempt to use the tool
Warning appears: "Default value is not supported in function declaration schema for Google AI" and tool calls don't work.
Expected behavior
According to the ADK documentation at https://google.github.io/adk-docs/tools/function-tools/, optional parameters with default values should be supported:
The tool should work with default parameters regardless of whether using Vertex AI or Gemini API.
Actual behavior
The code in
.venv/lib/python3.11/site-packages/google/adk/tools/_function_parameter_parse_util.pyhttps://github.com/google/adk-python/blob/main/src/google/adk/tools/_function_parameter_parse_util.py#L76 appears to have variant-specific logic that rejects default values for Gemini API but accepts them for Vertex AI.Setting environment variable
GOOGLE_GENAI_USE_VERTEXAI=truemight make it work, but this isn't a viable solution for users who need to use Gemini API.Desktop Information:
Model Information:
Additional context
This issue affects the usability of function tools for users relying on Gemini API. The documentation should either:
The current behavior creates confusion as the documented feature doesn't work as expected for Gemini API users.