From 095f013739da6f1882945a04c446ab4ba288d416 Mon Sep 17 00:00:00 2001 From: Woody Date: Tue, 28 Apr 2026 16:42:49 +0800 Subject: [PATCH] feat(llm): pass extra_body via model_kwargs in LangChain Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- backend/app/services/llm_client.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/app/services/llm_client.py b/backend/app/services/llm_client.py index a90fbeb..0959198 100644 --- a/backend/app/services/llm_client.py +++ b/backend/app/services/llm_client.py @@ -110,10 +110,16 @@ class LLMClient: os.environ.setdefault("OPENAI_API_KEY", self.settings.llm_api_key) os.environ.setdefault("OPENAI_BASE_URL", self.settings.llm_base_url) + # Pass thinking/reasoning disable params via model_kwargs. + # LangChain's ChatOpenAI forwards model_kwargs as top-level + # request parameters, which is equivalent to OpenAI SDK's extra_body. + model_kwargs = self._build_extra_body() or None + self._langchain_model = init_chat_model( model=self.model, model_provider="openai", temperature=0.0, + model_kwargs=model_kwargs, ) return self._langchain_model