You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that the structured output of OpenAI chat completions did not match the schema reliably after switching from the native openai client to the AI extensions library.
namely, the jsonSchemaIsStrict parameter of CreateJsonSchemaFormat receives the default value null, see
<paramname="jsonSchemaIsStrict">
<para>
Whether to enable strict schema adherence when generating the response. If set to <c>true</c>, the
model will follow the exact schema defined in <paramrefname="jsonSchema"/>.
</para>
<para>
Only a subset of the JSON schema specification is supported when this is set to <c>true</c>. Learn more
in the
<seehref="https://platform.openai.com/docs/guides/structured-outputs">structured outputs guide</see>.
</para>
</param>
Description
I noticed that the structured output of OpenAI chat completions did not match the schema reliably after switching from the native openai client to the AI extensions library.
One such example is:
sometimes gets returned as
Investigating the library, a possible reason for this could be in the mapping to OpenAI options:
namely, the
jsonSchemaIsStrict
parameter ofCreateJsonSchemaFormat
receives the default valuenull
, seeReproduction Steps
private record ExampleSchema(string summary, string question, string answer, string title)
AIJsonUtilities.CreateJsonSchema
ChatResponseFormat.ForJsonSchema
Expected behavior
The provided schema should always be returned
Actual behavior
The returned data sometimes doesn't adhere to the schema
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: