Repository navigation
Conversation
…keywords OpenAI strict structured outputs support pattern and format as the only string constraints. The OpenAI adapter forwarded the caller schema verbatim, so a portable schema carrying minLength/maxLength (enforced by other providers) left the strict-mode subset. The adapter now sends a copy of the schema without those keywords; the caller schema is unchanged and remains the contract callers validate against.
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.
Problem
wippy.llm.openai:structured_outputsends the caller's JSON schema verbatim astext.format.schemawithstrict: true. A portable schema that bounds strings withminLength/maxLength(honored by other backends, e.g. vLLM guided decoding) falls outside OpenAI's strict-mode subset, so the same schema works on one provider and not on OpenAI.OpenAI documents
patternandformatas the only supportedstringconstraints, and states that calling withstrict: trueand an unsupported schema returns an error:https://developers.openai.com/api/docs/guides/structured-outputs#supported-properties
https://developers.openai.com/api/docs/guides/structured-outputs#some-type-specific-keywords-are-not-yet-supported
Fix
The OpenAI adapter sends a copy of the schema with
minLength/maxLengthremoved from every subschema position (properties,items,additionalProperties,anyOf/oneOf/allOf,prefixItems,not,$defs/definitions). Property names and literal values (enum,const,default) are copied untouched, and the caller's schema table is not mutated, so fallback routes and caller-side validation keep the original bounds.Scope is the OpenAI adapter only;
openai_compatand other drivers keep sending the schema as given. No new options.Tests
src/llm/test/openai/structured_output_test.lua> Wire Schema:pattern,format, numeric bounds,minItems/maxItems,$ref) and a property literally namedmaxLengthare kept;make testinsrc/llm/test: 2910 passed, 9 skipped.make lint: no issues.