Skip to content

Commit 025ee8c

Browse files
cosminachoclaude
andcommitted
Trim UiPathChat overrides to just _identifying_params
Drop `_get_invocation_params`, `_get_ls_params`, and `_combine_llm_outputs` — the defaults from `BaseChatModel` are fine for the normalized client. Also drop the UiPath-specific keys from `_identifying_params`, keeping it a straight mirror of `BaseChatOpenAI`'s (`model_name` + `_default_params`). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b3a8632 commit 025ee8c

2 files changed

Lines changed: 3 additions & 61 deletions

File tree

packages/uipath_langchain_client/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ All notable changes to `uipath_langchain_client` will be documented in this file
55
## [1.9.6] - 2026-04-22
66

77
### Added
8-
- `UiPathChat` (normalized) now implements `_identifying_params`, `_get_invocation_params`, `_get_ls_params`, and `_combine_llm_outputs` to match the BaseChatModel / ChatOpenAI conventions for tracing, caching, and LangSmith integration. `_identifying_params` surfaces `model_name`, `_default_params`, `byo_connection_id`, and the `UiPathAPIConfig` routing fields; `_get_ls_params` sets `ls_provider="uipath"`.
8+
- `UiPathChat` (normalized) now implements `_identifying_params` (returning `model_name` + `_default_params`) to match the `BaseChatOpenAI` convention, giving traced/cached runs a proper identity key instead of the empty default from `BaseChatModel`.
99

1010
### Changed
1111
- Bumped dependency floors to the latest installed versions: `langchain-openai>=1.1.16`.

packages/uipath_langchain_client/src/uipath_langchain_client/clients/normalized/chat_models.py

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
AsyncCallbackManagerForLLMRun,
3333
CallbackManagerForLLMRun,
3434
)
35-
from langchain_core.language_models import LangSmithParams
3635
from langchain_core.language_models.base import (
3736
LanguageModelInput,
3837
)
@@ -209,65 +208,8 @@ def _llm_type(self) -> str:
209208

210209
@property
211210
def _identifying_params(self) -> dict[str, Any]:
212-
"""Parameters that uniquely identify this model for tracing and caching."""
213-
params: dict[str, Any] = {"model_name": self.model_name, **self._default_params}
214-
if self.byo_connection_id is not None:
215-
params["byo_connection_id"] = self.byo_connection_id
216-
if self.api_config.api_type is not None:
217-
params["uipath_api_type"] = str(self.api_config.api_type)
218-
if self.api_config.routing_mode is not None:
219-
params["uipath_routing_mode"] = str(self.api_config.routing_mode)
220-
if self.api_config.vendor_type is not None:
221-
params["uipath_vendor_type"] = str(self.api_config.vendor_type)
222-
if self.api_config.api_flavor is not None:
223-
params["uipath_api_flavor"] = str(self.api_config.api_flavor)
224-
return params
225-
226-
def _get_invocation_params(
227-
self, stop: list[str] | None = None, **kwargs: Any
228-
) -> dict[str, Any]:
229-
"""Return the parameters used to invoke the model."""
230-
return {
231-
"model": self.model_name,
232-
**self._default_params,
233-
**({"stop": stop} if stop is not None else {}),
234-
**kwargs,
235-
}
236-
237-
def _get_ls_params(self, stop: list[str] | None = None, **kwargs: Any) -> LangSmithParams:
238-
"""Standard params sent to LangSmith for tracing."""
239-
params = self._get_invocation_params(stop=stop, **kwargs)
240-
ls_params = LangSmithParams(
241-
ls_provider="uipath",
242-
ls_model_name=params.get("model", self.model_name),
243-
ls_model_type="chat",
244-
)
245-
if (ls_temperature := params.get("temperature", self.temperature)) is not None:
246-
ls_params["ls_temperature"] = ls_temperature
247-
if (ls_max_tokens := params.get("max_tokens", self.max_tokens)) is not None:
248-
ls_params["ls_max_tokens"] = ls_max_tokens
249-
if ls_stop := stop or params.get("stop", None):
250-
ls_params["ls_stop"] = ls_stop if isinstance(ls_stop, list) else [ls_stop]
251-
return ls_params
252-
253-
def _combine_llm_outputs(self, llm_outputs: list[dict[str, Any] | None]) -> dict[str, Any]:
254-
"""Merge per-generation llm_output dicts across a batch."""
255-
combined: dict[str, Any] = {"model_name": self.model_name}
256-
overall_usage: dict[str, int] = {}
257-
for output in llm_outputs:
258-
if output is None:
259-
continue
260-
if "id" in output and "id" not in combined:
261-
combined["id"] = output["id"]
262-
if "created" in output and "created" not in combined:
263-
combined["created"] = output["created"]
264-
usage = output.get("token_usage") or {}
265-
for k, v in usage.items():
266-
if isinstance(v, int):
267-
overall_usage[k] = overall_usage.get(k, 0) + v
268-
if overall_usage:
269-
combined["token_usage"] = overall_usage
270-
return combined
211+
"""Get the identifying parameters."""
212+
return {"model_name": self.model_name, **self._default_params}
271213

272214
@property
273215
def _default_params(self) -> dict[str, Any]:

0 commit comments

Comments
 (0)