.Net: OpenAI Structured Outputs ADR and implementation for Option 1 and Option 2 - #8648
Merged
Dmytro Struk (dmytrostruk) merged 33 commits intoSep 17, 2024
Conversation
Dmytro Struk (dmytrostruk)
had a problem deploying
to
integration
September 11, 2024 22:23 — with
GitHub Actions
Failure
Dmytro Struk (dmytrostruk)
temporarily deployed
to
integration
September 11, 2024 22:31 — with
GitHub Actions
Inactive
Dmytro Struk (dmytrostruk)
temporarily deployed
to
integration
September 11, 2024 22:43 — with
GitHub Actions
Inactive
Dmytro Struk (dmytrostruk)
temporarily deployed
to
integration
September 12, 2024 16:16 — with
GitHub Actions
Inactive
Dmytro Struk (dmytrostruk)
temporarily deployed
to
integration
September 12, 2024 18:06 — with
GitHub Actions
Inactive
Dmytro Struk (dmytrostruk)
temporarily deployed
to
integration
September 13, 2024 20:47 — with
GitHub Actions
Inactive
Dmytro Struk (dmytrostruk)
had a problem deploying
to
integration
September 13, 2024 21:14 — with
GitHub Actions
Error
Dmytro Struk (dmytrostruk)
temporarily deployed
to
integration
September 13, 2024 21:17 — with
GitHub Actions
Inactive
Dmytro Struk (dmytrostruk)
temporarily deployed
to
integration
September 13, 2024 21:51 — with
GitHub Actions
Inactive
Dmytro Struk (dmytrostruk)
temporarily deployed
to
integration
September 13, 2024 23:28 — with
GitHub Actions
Inactive
Dmytro Struk (dmytrostruk)
temporarily deployed
to
integration
September 16, 2024 17:23 — with
GitHub Actions
Inactive
Dmytro Struk (dmytrostruk)
temporarily deployed
to
integration
September 16, 2024 18:12 — with
GitHub Actions
Inactive
Dmytro Struk (dmytrostruk)
temporarily deployed
to
integration
September 16, 2024 19:43 — with
GitHub Actions
Inactive
|
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. |
Mark Wallace (markwallace-microsoft)
approved these changes
Sep 17, 2024
Dmytro Struk (dmytrostruk)
had a problem deploying
to
integration
September 17, 2024 14:40 — with
GitHub Actions
Error
Dmytro Struk (dmytrostruk)
temporarily deployed
to
integration
September 17, 2024 14:43 — with
GitHub Actions
Inactive
Dmytro Struk (dmytrostruk)
enabled auto-merge
September 17, 2024 14:48
Mark Wallace (markwallace-microsoft)
approved these changes
Sep 17, 2024
Dmytro Struk (dmytrostruk)
deleted the
dotnet-openai-structured-outputs
branch
September 17, 2024 15:21
Member
Author
jonnermut That's correct. Here is an example how to use Option 1 with manually constructed JSON Schema: And this is an example of Option 2 with automatically constructed JSON Schema: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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