Skip to content

[AI extensions] Add jsonSchemaIsStrict option to OpenAI options mapping #6064

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

Merged
merged 2 commits into from
Mar 16, 2025

Conversation

danielwinkler
Copy link
Contributor

@danielwinkler danielwinkler commented Mar 10, 2025

See #6062

Microsoft Reviewers: Open in CodeFlow

@danielwinkler danielwinkler requested a review from a team as a code owner March 10, 2025 15:25
@github-actions github-actions bot added the area-ai Microsoft.Extensions.AI libraries label Mar 10, 2025
@danielwinkler
Copy link
Contributor Author

@dotnet-policy-service agree

@stephentoub
Copy link
Member

What are the downsides to just always setting strict? I think it's "just" that if a schema is provided the OpenAI doesn't understand, it'll fail? Should we just always set strict and then optionally use something in additional properties as an override?

@SteveSandersonMS
Copy link
Member

What are the downsides to just always setting strict? I think it's "just" that if a schema is provided the OpenAI doesn't understand, it'll fail? Should we just always set strict and then optionally use something in additional properties as an override?

There's nothing in OpenAI's announcement that clarifies the drawbacks. Maybe they just didn't know whether it would always work.

As per this longer explanation, I'd support always setting strict if there's a schema. And like you say, if OpenAI really needs to support some non-strict mode, that's very OpenAI-specific and could be handled by something in additional properties to override this.

@stephentoub stephentoub force-pushed the feature/strict-output-openai branch from f8ab339 to 5148a45 Compare March 16, 2025 14:59
@stephentoub
Copy link
Member

I pushed an update to your branch to fix up the remaining strict handling.

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@stephentoub stephentoub enabled auto-merge (squash) March 16, 2025 15:00
@stephentoub stephentoub merged commit e4e3187 into dotnet:main Mar 16, 2025
6 checks passed
eiriktsarpalis added a commit to eiriktsarpalis/extensions that referenced this pull request Apr 11, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Apr 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-ai Microsoft.Extensions.AI libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants