-
Notifications
You must be signed in to change notification settings - Fork 5
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
FEATURE REQUEST: Support for structured response #8
Comments
Hi Brett - a useful request. I've pushed an update to a branch for you to test it hasn't broken any of your existing uses of the GeminiApp library. Here is the updated library code and a test you can try |
Thanks very much. I've tested the new library code and it doesn't seem to have affected any old usage. I am getting an error though when trying to run the test code your provided.
I'm not sure if it has something to do with the generationConfig object being in camel case compared to the generation_config object mentioned in the error message being in snake case. The documentation seems a little unclear about this and when I tried other generationConfig options like "maxOutputTokens" it worked fine. It just doesn't like "responseMimeType" and "responseSchema". I also tried different Gemini models but I got the same error message. |
ah - if you are using a api key from Google AI Studio then the issue is likely to be you need to declare
|
That almost worked but it did put me on the right track. Where you put the This worked for me:
|
Losing the plot - glad you figured it out :) |
I was just wondering if you had any plans to integrate the option to request a structured response in the form of JSON from Gemini by providing schema?
I have used schemas in the past using the node js library and they can be really effective when you need to force a specific response as sometimes Gemini can waffle on even when you ask it to be specific. Link to Gemini Structured Response
I could possibly look into adding it myself but I didn't want to waste my time if it's already been tried and abandoned for some reason I have not yet realised.
The text was updated successfully, but these errors were encountered: