Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error occurring while using Gemini with multiple tools #1890

Open
mstrYoda opened this issue Jan 25, 2025 · 1 comment
Open

error occurring while using Gemini with multiple tools #1890

mstrYoda opened this issue Jan 25, 2025 · 1 comment

Comments

@mstrYoda
Copy link

mstrYoda commented Jan 25, 2025

When I run Gemini model with multiple tools (FileTools and ShellTools), it gives the following error. I found that the issue was related with Gemini on older modals but it seems like they fixed it on model version 2. But still I got the error.

GoogleCloudPlatform/generative-ai#636 (comment)

Here is my example code:

gemini_model = Gemini(id="gemini-2.0-flash", api_key=api_key)

team = Agent(
    model=gemini_model,
    role="Software Engineer",
    tools=[FileTools(), ShellTools()],
    add_history_to_messages=True,
    num_history_responses=10,
    show_tool_calls=True,
    monitoring=True,
    debug_mode=True,
    stream=False,
)
Image
Traceback (most recent call last):
  File "/Users/emre.savci/Desktop/my-projects/agents/code_agent/main.py", line 66, in <module>
    team.cli_app()
  File "/Users/emre.savci/miniforge3/envs/agents/lib/python3.10/site-packages/phi/agent/agent.py", line 3217, in cli_app
    self.print_response(message=message, stream=stream, markdown=markdown, **kwargs)
  File "/Users/emre.savci/miniforge3/envs/agents/lib/python3.10/site-packages/phi/agent/agent.py", line 2904, in print_response
    run_response = self.run(message=message, messages=messages, stream=False, **kwargs)
  File "/Users/emre.savci/miniforge3/envs/agents/lib/python3.10/site-packages/phi/agent/agent.py", line 2070, in run
    return next(resp)
  File "/Users/emre.savci/miniforge3/envs/agents/lib/python3.10/site-packages/phi/agent/agent.py", line 1842, in _run
    model_response = self.model.response(messages=messages_for_model)
  File "/Users/emre.savci/miniforge3/envs/agents/lib/python3.10/site-packages/phi/model/google/gemini.py", line 636, in response
    response: GenerateContentResponse = self.invoke(messages=messages)
  File "/Users/emre.savci/miniforge3/envs/agents/lib/python3.10/site-packages/phi/model/google/gemini.py", line 424, in invoke
    return self.get_client().generate_content(contents=self.format_messages(messages))
  File "/Users/emre.savci/miniforge3/envs/agents/lib/python3.10/site-packages/google/generativeai/generative_models.py", line 331, in generate_content
    response = self._client.generate_content(
  File "/Users/emre.savci/miniforge3/envs/agents/lib/python3.10/site-packages/google/ai/generativelanguage_v1beta/services/generative_service/client.py", line 830, in generate_content
    response = rpc(
  File "/Users/emre.savci/miniforge3/envs/agents/lib/python3.10/site-packages/google/api_core/gapic_v1/method.py", line 131, in __call__
    return wrapped_func(*args, **kwargs)
  File "/Users/emre.savci/miniforge3/envs/agents/lib/python3.10/site-packages/google/api_core/retry/retry_unary.py", line 293, in retry_wrapped_func
    return retry_target(
  File "/Users/emre.savci/miniforge3/envs/agents/lib/python3.10/site-packages/google/api_core/retry/retry_unary.py", line 153, in retry_target
    _retry_error_helper(
  File "/Users/emre.savci/miniforge3/envs/agents/lib/python3.10/site-packages/google/api_core/retry/retry_base.py", line 212, in _retry_error_helper
    raise final_exc from source_exc
  File "/Users/emre.savci/miniforge3/envs/agents/lib/python3.10/site-packages/google/api_core/retry/retry_unary.py", line 144, in retry_target
    result = target()
  File "/Users/emre.savci/miniforge3/envs/agents/lib/python3.10/site-packages/google/api_core/timeout.py", line 120, in func_with_timeout
    return func(*args, **kwargs)
  File "/Users/emre.savci/miniforge3/envs/agents/lib/python3.10/site-packages/google/api_core/grpc_helpers.py", line 78, in error_remapped_callable
    raise exceptions.from_grpc_error(exc) from exc
google.api_core.exceptions.InvalidArgument: 400 * GenerateContentRequest.tools[0].function_declarations[3].parameters.properties[args].items: missing field.

WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1737836329.282128 175371299 init.cc:232] grpc_wait_for_shutdown_with_timeout() timed out.
@willemcdejongh
Copy link

Hi @mstrYoda Would pease mind sharing all of the code you are running + prompts so we can try to reproduce your error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants