-
-
Notifications
You must be signed in to change notification settings - Fork 69
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/gemini structured output support #173
base: main
Are you sure you want to change the base?
Feature/gemini structured output support #173
Conversation
Changes looks good. https://prism.echolabs.dev/providers/gemini.html |
Thank you, yes let me update |
Preview deployments for prism ⚡️
Commit: Deployment ID: Static site name: |
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.
Overall Looks great.
Thank you for this. It will be great if you can do this changes.
@@ -0,0 +1,101 @@ | |||
<?php |
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.
Again i guess this is correct but can you please keep the methods of this structured output as consistent across other provider so its easier to update or refactor any thing related to provider. for eg src/Providers/Anthropic/Handlers/Structured.php
Again this optional.
@sixlive what do you think.
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.
I decided not to refactor the methods to be similar to the Anthropic Handler because the handle method feels bloated and might become difficult to follow through where exactly there's a failure if it does happen.
But also regarding consistency across other providers, the methods are similar to src/Providers/DeepSeek/Handlers/Structured.php
and a bit similar to the OpenAI version but i guess the OpenAI case is different since it supports both JsonMode and StructuredMode for Structured Outputs
Hey everyone! 👋
This is my first PR to Prism, so I’m pretty excited (and a little nervous 😅). I’ve added structured output support for the Gemini provider using a prompt-based approach, similar to how it’s done for Anthropic and Deepseek Providers.
What’s in this PR?
Why this approach?
I noticed another PR #116 exploring structured output for Gemini with a schema-based approach. My take is a little different—more in line with how it is being handled for Anthropic. The only difference with anthropic, gemini api config allows for
response_mime_type
which when set toapplication/json
ensures the response is a JSONWould love your thoughts!
Since this is my first contribution, I’d really appreciate any feedback! Let me know if this makes sense or if there’s anything I can tweak.
Thanks for taking a look! Looking forward to your thoughts. 🚀😊