-
Notifications
You must be signed in to change notification settings - Fork 4.4k
.Net: OpenAI Structured Outputs ADR and implementation for Option 1 and Option 2 #8648
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: OpenAI Structured Outputs ADR and implementation for Option 1 and Option 2 #8648
Conversation
dotnet/src/InternalUtilities/src/Schema/JsonSchemaMapper.STJv8.cs
Outdated
Show resolved
Hide resolved
|
So does this end up implementing both options? To us Option#1 is essential and #2 is a nice to have. The reason for that is that we are making Json Schemas for json output dynamically at runtime. |
@jonnermut That's correct. Here is an example how to use Option 1 with manually constructed JSON Schema: semantic-kernel/dotnet/samples/Concepts/ChatCompletion/OpenAI_StructuredOutputs.cs Line 33 in 9d28474
And this is an example of Option 2 with automatically constructed JSON Schema: semantic-kernel/dotnet/samples/Concepts/ChatCompletion/OpenAI_StructuredOutputs.cs Line 106 in 9d28474
|
Motivation and Context
Related: #7946
Closes: #8519
Structured Outputs is a feature in OpenAI API that ensures the model will always generate responses based on provided JSON Schema. This gives more control over model responses, allows to avoid model hallucinations and write simpler prompts without a need to be specific about response format.
This PR contains an ADR which describes several options how to enable this functionality in .NET version of Semantic Kernel and implementation for Option 1 and Option 2.
Contribution Checklist