You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the example notebook provided in get_started.ipynb of gemini-2, there is a code snippet demonstrating controlled JSON generation. The prompt requests “List 3 popular cookie recipes and their ingredients.” However, the response_schema in the example is defined as Recipe, which is designed to return only a single object.
When I attempt to modify the response_schema to list[Recipe] or List[Recipe] (to align with the prompt’s intent to output three recipes), it results in the following error:
AttributeError: 'dict' object has no attribute 'upper'
This suggests that the SDK does not properly handle list-based schemas or that the example is misleading.
Actual vs expected behavior:
Actual behavior:
• The example, as written, outputs only one recipe, even though the prompt requests three.
• Modifying the response_schema to handle a list of recipes results in an error.
Expected behavior:
• The example should correctly define the response_schema to allow the generation of multiple recipes.
• The SDK should support list-based schemas (list[Recipe] or List[Recipe]) without throwing errors.
Any other information you'd like to share?
No response
The text was updated successfully, but these errors were encountered:
Thanks for reporting the issue. I am also suffering from it and reported it a while ago to the team working on the SDK. This is one of their top issues so it should hopefully be fixed soon.
In the meantime, unless you are using one of the new Gemini 2.0 features like the live API, I'd recommend using the former SDK which still works with the news models.
Description of the bug:
In the example notebook provided in get_started.ipynb of gemini-2, there is a code snippet demonstrating controlled JSON generation. The prompt requests “List 3 popular cookie recipes and their ingredients.” However, the response_schema in the example is defined as Recipe, which is designed to return only a single object.
When I attempt to modify the response_schema to list[Recipe] or List[Recipe] (to align with the prompt’s intent to output three recipes), it results in the following error:
AttributeError: 'dict' object has no attribute 'upper'
This suggests that the SDK does not properly handle list-based schemas or that the example is misleading.
Actual vs expected behavior:
Actual behavior:
• The example, as written, outputs only one recipe, even though the prompt requests three.
• Modifying the response_schema to handle a list of recipes results in an error.
Expected behavior:
• The example should correctly define the response_schema to allow the generation of multiple recipes.
• The SDK should support list-based schemas (list[Recipe] or List[Recipe]) without throwing errors.
Any other information you'd like to share?
No response
The text was updated successfully, but these errors were encountered: