Skip to content

More clear error message for missing param type with default with Gemini #1169

Open
@hangfei

Description

@hangfei

** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.

Describe the bug
def list_issues(state="open", per_page=10):
"""
Generator to list all issues for the repository by handling pagination.
Yields each issue JSON object.
"""

Traceback (most recent call last):
  File "/Users/hangfeilin/adk_bot/lib/python3.11/site-packages/google/adk/cli/fast_api.py", line 777, in event_generator
    async for event in runner.run_async(
  File "/Users/hangfeilin/adk_bot/lib/python3.11/site-packages/google/adk/runners.py", line 197, in run_async
    async for event in invocation_context.agent.run_async(invocation_context):
  File "/Users/hangfeilin/adk_bot/lib/python3.11/site-packages/google/adk/agents/base_agent.py", line 147, in run_async
    async for event in self._run_async_impl(ctx):
  File "/Users/hangfeilin/adk_bot/lib/python3.11/site-packages/google/adk/agents/llm_agent.py", line 278, in _run_async_impl
    async for event in self._llm_flow.run_async(ctx):
  File "/Users/hangfeilin/adk_bot/lib/python3.11/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 282, in run_async
    async for event in self._run_one_step_async(invocation_context):
  File "/Users/hangfeilin/adk_bot/lib/python3.11/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 302, in _run_one_step_async
    async for event in self._preprocess_async(invocation_context, llm_request):
  File "/Users/hangfeilin/adk_bot/lib/python3.11/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 344, in _preprocess_async
    await tool.process_llm_request(
  File "/Users/hangfeilin/adk_bot/lib/python3.11/site-packages/google/adk/tools/base_tool.py", line 96, in process_llm_request
    if (function_declaration := self._get_declaration()) is None:
                                ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hangfeilin/adk_bot/lib/python3.11/site-packages/google/adk/tools/function_tool.py", line 65, in _get_declaration
    build_function_declaration(
  File "/Users/hangfeilin/adk_bot/lib/python3.11/site-packages/google/adk/tools/_automatic_function_calling_util.py", line 235, in build_function_declaration
    from_function_with_options(func, variant)
  File "/Users/hangfeilin/adk_bot/lib/python3.11/site-packages/google/adk/tools/_automatic_function_calling_util.py", line 309, in from_function_with_options
    schema = _function_parameter_parse_util._parse_schema_from_parameter(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hangfeilin/adk_bot/lib/python3.11/site-packages/google/adk/tools/_function_parameter_parse_util.py", line 305, in _parse_schema_from_parameter
    raise ValueError(
ValueError: Failed to parse the parameter state='open' of function list_issues for automatic function calling. Automatic function calling works best with simpler function signature schema, consider manually parsing your function declaration for function list_issues.

got this error for the above function for gemini models.

The problem is likely there is no param types. However, the error message seems hard to debug this.

Desktop (please complete the following information):

  • OS: macOS
  • Python version(python -V): 3.11
  • ADK version(pip show google-adk): 1.2.1

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

toolsIssues related to tools

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions