fix: pass provider extra_kwargs from config to ChatOpenAI#1
Open
fix: pass provider extra_kwargs from config to ChatOpenAI#1
Conversation
_build_provider_config() was initializing extra_kwargs as an empty dict,
silently discarding any extra_kwargs defined in the provider YAML config.
This meant parameters like extra_body, model_kwargs, or any other
ChatOpenAI constructor arguments could not be configured per-provider.
The fix seeds the dict from cfg["extra_kwargs"] before applying
provider-specific overrides (e.g. local_mode), so user-defined kwargs
flow through to the LangChain model constructor.
Discovered while trying to disable Qwen3's thinking mode via:
providers:
openai:
extra_kwargs:
extra_body:
chat_template_kwargs:
enable_thinking: false
The config was parsed correctly but never reached ChatOpenAI because
_build_provider_config replaced it with {}.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
BaseReActAgent._build_provider_config()hardcodedextra_kwargs = {}, silently discarding anyextra_kwargsdefined in the provider YAML configcfg.get("extra_kwargs", {})so user-defined kwargs flow through to the LangChain model constructorextra_kwargsin provider config (e.g.extra_body,model_kwargs,stream_options) were being ignoredRoot Cause
In
src/archi/pipelines/agents/base_react.py:882,_build_provider_config()builds the provider config dict that gets passed toget_model()→get_provider()→ChatOpenAI(**kwargs). Theextra_kwargsfield is spread into theChatOpenAIconstructor via**self.config.extra_kwargsin each provider'sget_chat_model()method.However,
_build_provider_config()was initializingextra = {}instead of reading from the YAML config, so the pipeline between config file → provider → LangChain was broken at this point:Example
This config should disable Qwen3's thinking mode when served via vLLM:
Before this fix,
extra_bodynever reachedChatOpenAIand thinking output leaked into the response content. After this fix, vLLM correctly receiveschat_template_kwargsin the request body.Test plan
extra_kwargsand verify the kwargs reach the LLM clientextra_kwargsstill work (empty dict fallback)localprovidermodeoverride still works alongside user-definedextra_kwargs🤖 Generated with Claude Code