-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix structured output with nested definitions with Gemini via OpenRouter #3618
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
Conversation
…tion errors link to fallbackmodel in agnets.md
DouweM
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dsfaccini We should also have a recorded test that verifies that a nested schema now works properly with OpenRouter + Gemini again
| """ | ||
| is_image_model = 'image' in model_name | ||
| is_3_or_newer = 'gemini-3' in model_name | ||
| return GoogleModelProfile( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't copy paste all of this! We should call the original google_model_profile, and then do the replace thing to swap out just the transformer
| ) from _import_error | ||
|
|
||
|
|
||
| class OpenRouterGoogleJsonSchemaTransformer(JsonSchemaTransformer): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is public now, I don't think it should be :)
tests/providers/test_openrouter.py
Outdated
| assert result['properties']['email']['description'] == 'User email (format: email)' | ||
| assert 'format' not in result['properties']['email'] | ||
|
|
||
| # format -> description without existing description (lines 76-77) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These line numbers will get outdated; please don't include them
tests/models/test_openrouter.py
Outdated
| ToolDefinition( | ||
| name='insert_level_with_spaces', | ||
| description=InsertLevelWithSpaces.__doc__ or '', | ||
| parameters_json_schema=InsertLevelWithSpaces.model_json_schema(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use an Agent with a @agent.tool so we are sure that it goes through the exact same processing that users would see
Fixes #3617 temporarily while support is added.