feat(inference): support extra generation model settings - #1394
Open
Teingi wants to merge 1 commit into
Open
Conversation
PsiACE
reviewed
Aug 30, 2026
|
|
||
| provider_model = await resources.enter_async_context(infer_model(settings.generation_model)) | ||
| model = provider_model if instrumentation is None else InstrumentedModel(provider_model, instrumentation) | ||
| model_settings = cast(ModelSettings, dict(settings.generation_model_settings)) or None |
Member
There was a problem hiding this comment.
Could we either document the precedence between PowerContext-owned settings and extra_body, or enforce an explicit conflict policy? merge_model_settings only handles top-level keys.
Member
There was a problem hiding this comment.
For example, max_tokens=1 can conflict with extra_body.max_output_tokens=100, leaving the effective value dependent on the provider/SDK merge order.
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.
Which issue or RFC does this PR close?
Closes #1393.
Related to #1379, which covers the broader workload-specific endpoint, header, embedding, and reranking configuration.
Rationale for this change
Some OpenAI-compatible generation endpoints require provider-specific request fields that cannot be expressed in a Pydantic AI model identifier. For example, a compatible Qwen deployment may require
chat_template_kwargs.enable_thinking=false.What changes are included in this PR?
generation_model_settingstoInferenceConfigand Server environment loading.max_tokensto1and rerankingtemperatureto0.extra_body.chat_template_kwargs.enable_thinkingin the environment example and English/Chinese inference documentation.Are there any user-facing changes?
Server operators can now set provider-specific generation parameters with one JSON environment variable:
The default remains an empty object, so existing deployments keep their current behavior. Only settings supported by the selected Pydantic AI model/provider have an effect. This setting does not replace provider credential configuration.
How was this change tested?
make checkmake test(953 passed, 9 skipped)make docs-testAI usage statement
OpenAI Codex with GPT-5 was used for implementation, tests, documentation, and review.