-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
.Net: New Feature: Add missing optional parameter responseMimeType to GeminiPromptExecutionSettings to allow for valid JSON output #9863
Labels
.NET
Issue or Pull requests regarding .NET code
Comments
markwallace-microsoft
added
.NET
Issue or Pull requests regarding .NET code
python
Pull requests for the Python Semantic Kernel
triage
labels
Dec 2, 2024
github-actions
bot
changed the title
.Net: New Feature: Add missing optional parameter responseMimeType to GeminiPromptExecutionSettings to allow for valid JSON output
Python: .Net: New Feature: Add missing optional parameter responseMimeType to GeminiPromptExecutionSettings to allow for valid JSON output
Dec 2, 2024
github-actions
bot
changed the title
Python: .Net: New Feature: Add missing optional parameter responseMimeType to GeminiPromptExecutionSettings to allow for valid JSON output
.Net: New Feature: Add missing optional parameter responseMimeType to GeminiPromptExecutionSettings to allow for valid JSON output
Dec 2, 2024
Hi @markwallace-microsoft, @moonbox3, I will work on this and raise PR soon. :) |
Thank you 🙏 I noticed a similar PR referring to the missing I'm not sure how I missed that one before making this one 🤔 🙃 |
github-merge-queue bot
pushed a commit
that referenced
this issue
Dec 3, 2024
… for Enhanced Output Control. (#9870) ### Motivation and Context **Why is this change required?** The absence of the `responseMimeType` property in .NET prevented users from leveraging structured output formats available in the Gemini API, causing unintended behavior in scenarios requiring JSON or controlled output. **What problem does it solve?** Adds flexibility for developers by enabling control over MIME type responses, particularly for JSON data parsing and classification tasks. **What scenario does it contribute to?** - Requests with structured response needs, such as JSON objects or controlled classification outputs. - Seamless migration and parity with the Python SDK's `responseMimeType` support. Fixes #9863 ### Description This PR adds support for the optional `responseMimeType` parameter to the `GeminiPromptExecutionSettings` class, allowing for better control over the output response format in Gemini API calls. This change addresses the missing ability to specify MIME types for valid JSON, plain text, or enumerated outputs. ### Contribution Checklist - [Y] The code builds clean without any errors or warnings - [Y] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [Y] All unit tests pass, and I have added new tests where possible - [Y] I didn't break anyone 😄 Co-authored-by: Adit Sheth <adsheth@microsoft.com>
markwallace-microsoft
moved this from Sprint: In Review
to Sprint: Done
in Semantic Kernel
Dec 10, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
name: Add missing optional parameter
responseMimeType
toGeminiPromptExecutionSettings
about: The optional API parameter
responseMimeType
is missing from theGeminiPromptExecutionSettings
which is preventing the ability to have valid JSON responses returned from requests to Gemini (similar to OpenAI'sresponse_format: "json_object"
). This allows you to set the appropriate response type to avoid unintended behaviours.Suggested Property:
Available values are:
Google documentation:
https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig
https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference
Ideally the
responseSchema
property should also be incorporated to allow for "controlled generation", as Google call it (the same as Structured Output with OpenAI), but that's a much larger implementation. AddingresponseMimeType
would be a great start and seems like a low handing fruit, I may be wrong though... 🤔 It looks like this has been added on the Python version already.The text was updated successfully, but these errors were encountered: