-
Notifications
You must be signed in to change notification settings - Fork 839
openrouter throws BadRequestError #171
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
Comments
@selcukgun to take a look if this can be supported. |
Hey @hangfei @selcukgun , I am also facing the same issue. I would love to contribute. Please let me know where I can start |
Thanks. @namish800 could you start with researching what's the issue first and suggest a fix? |
I have the same issue, I can add that when using only one tool openrouter can handle it but struggles with multiple. |
I'm adding my findings to this issue as I've encountered the exact same problem when using the calendar_events_insert tool from the Google Calendar toolset (google.calendar_tools.calendar_tool_set) with Google ADK. My Setup: After enabling debug logging in LiteLLM (litellm._turn_on_debug()), I captured the request sent to OpenRouter and the subsequent error response originating from the Google AI backend (Gemini). The request payload clearly shows the tools definition for calendar_events_insert. However, the error returned by Google indicates an INVALID_ARGUMENT (code 400) due to issues within the function declaration's parameter schema: "message": "* GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[reminders].properties[overrides].items.properties: only allowed for OBJECT type\n* ... (many similar lines related to '.properties') ...\n* GenerateContentRequest.tools[0].function_declarations[0].parameters.properties[conference_data].properties[entryPoints].items.properties[entryPointFeatures].items: field predicate failed: $type == Type.ARRAY\n" This appears to be an issue within ADK's schema generation/serialization logic specifically for function/tool definitions intended |
Fixes conversion of Gemini Type enums within the recursive _schema_to_dict function to ensure valid JSON Schema types ('string', 'object', etc.) are generated, resolving errors with complex tools like Google Calendar. Fixes google#171
** Please make sure you read the contribution guide and file the issues in the rigth place. **
Contribution guide.
Describe the bug
A clear and concise description of what the bug is.
When I use the adk agent with a LiteLlm model via openrouter I get an error
Error: litellm.exceptions.BadRequestError: litellm.BadRequestError: OpenrouterException - Provider returned error
The same model via openai does not throw any errors
model=LiteLlm(model="openai/gpt-4o-mini")
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The behavior of model=LiteLlm(model=“openai/gpt-4o-mini”) and model=LiteLlm(model=“openrouter/openai/gpt-4o-mini”) should be identical
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: