Repository navigation
fix(py): write generate and render span config in wire spelling - #116
Merged
Merged
Conversation
The Dev UI model runner pre-fills its form from the generate span's
config by exact camelCase key. ai.generate(config={'max_output_tokens': 64})
recorded max_output_tokens there, so "Open in model runner" showed Max
output tokens as "default". Prompt render output had the same problem,
even for frontmatter maxOutputTokens, because the merge folds every
spelling to the Python field name.
to_generate_options now renames fields the model's config class declares
to the key that class writes in Genkit JSON (camelCase on GenkitConfig),
after the prompt/ref/call merge. Keys the class doesn't declare stay as
written, and a model with no config class keeps the caller's keys. The
model span already used this spelling, so the three spans now agree, and
options built in process match what /util/generate receives from the Dev UI.
MichaelDoyle
approved these changes
Nov 12, 2026
This was referenced Nov 15, 2026
Merged
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.
Writes declared model configuration keys in their camelCase wire spelling on the
generateinput span and therenderoutput span.The Dev UI's "Open in model runner" action inspects the
generatespan'sconfigdictionary by exact wire key (e.g.maxOutputTokens,stopSequences). When callers configure generation using Pythonic snake_case (config={'max_output_tokens': 64}), the runner previously failed to match the form fields and displayed "default".Main Changes
generateinput span and promptrenderoutput span recorded whatever casing the caller passed in, while the downstream model span wrote the camelCase wire dictionary. Now, declared fields on the model's config schema are mapped to their wire key (serialization_alias/alias) so telemetry spans and Dev UI forms match across SDKs.extra='allow') or models without a registered config class, unknown keys pass through untouched without renaming.maxOutputTokens: 256) with a call-time keyword (config={'max_output_tokens': 64}) merges onto the wire key, ensuring the span and model request see a single resolved key ({'maxOutputTokens': 64}).All unit tests and preflight CI checks pass.

