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

gemini-1.5-flash can't call tools without empty arguments #796

Open
jamesbraza opened this issue Jan 8, 2025 · 0 comments
Open

gemini-1.5-flash can't call tools without empty arguments #796

jamesbraza opened this issue Jan 8, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@jamesbraza
Copy link
Collaborator

Running the below code on Jan 8th 2025 with Python 3.12 and litellm==1.53.3:

import litellm

OPENAI_MODEL = "gpt-4o-2024-11-20"
GEMINI_MODEL = "gemini/gemini-1.5-flash"


response = litellm.completion(
    model=GEMINI_MODEL,
    messages=[
        {"role": "user", "content": "Select a tool to print 'hi'."},
    ],
    tool_choice="required",
    tools=[
        {
            "type": "function",
            "function": {
                "name": "print_hi",
                "description": "Print 'hi'.",
                "parameters": {"type": "object", "properties": {}, "required": []},
            },
        }
    ],
)
assert len(response.choices) == 1, "Expected one response choice."
print(response.choices[0].message.tool_calls)

It works fine with OpenAI gpt-4o-2024-11-20, but does not work with Google gemini/gemini-1.5-flash:

litellm.exceptions.BadRequestError: litellm.BadRequestError: VertexAIException BadRequestError - {
  "error": {
    "code": 400,
    "message": "* GenerateContentRequest.tools[0].function_declarations[0].parameters.properties: should be non-empty for OBJECT type\n",
    "status": "INVALID_ARGUMENT"
  }
}

So Gemini does not yet support empty tool parameters.

Unfortunately, PaperQA's gen_answer and reset tools have empty parameters. Thus, gemini/gemini-1.5-flash can't be used for tool selections (our agent LLM).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant