feat(core): allow overriding ls_model_name from kwargs (#32541)

This commit is contained in:
Matthew Lapointe
2025-09-11 16:18:06 -04:00
committed by GitHub
parent 2903e08311
commit b1f08467cd
11 changed files with 129 additions and 7 deletions

View File

@@ -1471,7 +1471,7 @@ class BaseChatOpenAI(BaseChatModel):
params = self._get_invocation_params(stop=stop, **kwargs)
ls_params = LangSmithParams(
ls_provider="openai",
ls_model_name=self.model_name,
ls_model_name=params.get("model", self.model_name),
ls_model_type="chat",
ls_temperature=params.get("temperature", self.temperature),
)

View File

@@ -25,6 +25,9 @@ def test_openai_model_param() -> None:
"ls_max_tokens": 256,
}
ls_params = llm._get_ls_params(model="bar")
assert ls_params["ls_model_name"] == "bar"
def test_openai_model_kwargs() -> None:
llm = OpenAI(model_kwargs={"foo": "bar"})