LangChain completion wrappers drop runtime kwargs
Author: sylvesterkaczmarekCreated Aug 21, 2026Updated Aug 21, 2026
Describe the bug
Both LangChainLLMCompletionFn.__call__() and LangChainChatModelCompletionFn.__call__() accept runtime **kwargs, but discard them when invoking the wrapped LangChain model:
response = self.llm(prompt)
...
response = self.llm(messages).contentThe shared CompletionFn contract documents these kwargs as arguments passed through to the underlying API. Options such as stop, callbacks, or model-supported invocation controls therefore silently disappear when a LangChain wrapper is used.
Expected behavior
Invocation-time kwargs accepted by the completion wrapper should be forwarded unchanged to the wrapped LangChain LLM/chat model. Calls with no kwargs should behave exactly as before.
Proposed fix
Pass **kwargs to both wrapped model calls and add local recording-model tests for the text and chat wrappers.
Source: openai/evals