-
Notifications
You must be signed in to change notification settings - Fork 21
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
support/docs for json mode #18
Comments
The docs here work, but the confusing part is that json mode only works when using Vertex. https://ai.google.dev/gemini-api/docs/api-overview#json i.e. client.generate_content(
contents: messages,
system_instructions: options[:system_message],
generation_config: { response_mime_type: "application/json" }
) |
@weilandia Thanks for testing and sharing! Yeah, I couldn't find examples/documentation to make it work outside of Vertex. @jtoy Thanks for opening the issue! I added examples and documentation in the README: |
Heads up: Using JSON schema in the generation config only works with Pro. "While Gemini 1.5 Flash models only accept a text description of the JSON schema you want returned, the Gemini 1.5 Pro models let you pass a schema object (or a Python type equivalent), and the model output will strictly follow that schema. This is also known as controlled generation or constrained decoding." |
@weilandia Here's my test results:
|
It works with generative language on gemini-1.5-pro on the v1beta endpoint right now with JSON schema. |
I get a HTTP 400 response when doing this through the gem. The same request via curl seems to work fine though, and returns only JSON. Either way, seems like Vertex is not needed for JSON responses anymore, but seems there is an issue in this gem stopping it from working? |
It works for me when I set |
does the gem support json mode as outlined here:
https://ai.google.dev/gemini-api/docs/api-overview#curl_4
The text was updated successfully, but these errors were encountered: