Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the normalize_config method in the Genkit OpenAI model implementation to support None as a valid configuration input, returning a default OpenAIConfig instance when it is provided. It also updates the corresponding unit tests to verify this behavior and adds a test case for invalid configuration types. There are no review comments, so I have no feedback to provide.
Contributor
|
Closing as superseded: Python SDK development has moved to https://github.com/genkit-ai/genkit-python, and omitted config hydration is now handled centrally by the unified Python config pipeline (#6712). |
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.
Why
ModelRequest.configdefaults toNoneandnormalize_confighad noNonebranch, so it fell through to the finalraise.OpenAIModel.generateandOpenAIModelHandler.generateboth call it unconditionally, so any generate request that omitted config raisedValueErrorbefore reaching the API.Changes
normalize_configreturns a defaultOpenAIConfig()when config isNone, and the annotation widens toobject | None. This matches the JS plugin and the Anthropic plugin, and the request body is unchanged:OpenAIConfig()has no non-None defaults and_openai_create_kwargsdrops None values, so nothing extra reaches the API.The
test_normalize_configcase asserting thatNoneraises now expectsOpenAIConfig(); an int case keeps theValueErrorbranch covered.Verification
A no-config request through both generate paths now completes with a
{messages, model}body, the same body built when config is present but empty. Previously both raised.