Repository navigation
Conversation
cabljac
reviewed
Nov 25, 2026
cabljac
left a comment
Contributor
There was a problem hiding this comment.
A few comments/questions
cabljac
self-requested a review
November 30, 2026 11:16
…Mistral - The output wrapper moves '#' and '#/...' references into $defs and keeps $schema at the root, as JS and Go do. - A reply is unwrapped only when value is its one key, as in Dart. - The final streamed message is built from the raw text and unwrapped as a full reply is. - Mistral requests are no longer wrapped. - Restore the tool-schema helper names.
adesinah
force-pushed
the
fix/openai-non-object-root
branch
from
November 30, 2026 13:15
303a365 to
efc4bf0
Compare
This branch has not been deployed
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.
Python port of genkit-ai/genkit#7316 (JS), genkit-ai/genkit#7320 (Go) and genkit-ai/genkit-dart#766 (Dart). Refs genkit-ai/genkit#7238.
What
With
OpenAI(), an output schema whose root is not an object (a list, enum or scalar) now works. The schema is sent as thevalueproperty of an object, and the reply is unwrapped before Genkit parses it, sooutputand the streamed chunks hold the caller's value.Object roots, DeepSeek, Mistral and other users of
OpenAIModel(Vertex Model Garden) send the same request as before. A reply is unwrapped only whenvalueis its one key. Anything else, such as a host that ignored the wrapper, comes back as sent.Why
OpenAI's
json_schemaresponse format accepts only an object root. Onmain, any other root fails with:Local references (
#,#/items/...) move into$defswhen the schema is wrapped, as in JS and Go. Otherwise they would point at the wrapper, or fail the SDK's strict pass.Testing
uv run pytest packages/genkit-openai. ruff and ty are clean, and pyrefly reports only the error already onmain.strEnum, scalars (falsy values included) andtype: ['object', 'null']roots return the value. Object roots are unchanged.Not in this PR
list[Model]andlist[str]asoutput_schemabefore the request is built. That is separate from this plugin.