Skip to content

Commit 581bcbc

Browse files
cosminachoclaude
andcommitted
Fix: drop temperature from UiPathChat payload when thinking is set
Anthropic's extended thinking API requires temperature=1 (its default) and rejects any other explicit value alongside a thinking config. _default_params now silently removes temperature when thinking is present so callers don't have to manually avoid the combination. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4845623 commit 581bcbc

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

packages/uipath_langchain_client/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to `uipath_langchain_client` will be documented in this file.
44

5+
## [1.9.9] - 2026-04-23
6+
7+
### Fixed
8+
- `UiPathChat._default_params` now drops `temperature` when `thinking` is also set. Anthropic's extended thinking API requires `temperature=1` (its default) and rejects any other explicit value, so forwarding a caller-supplied temperature alongside a `thinking` config would cause a gateway validation error.
9+
510
## [1.9.8] - 2026-04-22
611

712
### Changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
__title__ = "UiPath LangChain Client"
22
__description__ = "A Python client for interacting with UiPath's LLM services via LangChain."
3-
__version__ = "1.9.8"
3+
__version__ = "1.9.9"

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,15 @@ def _default_params(self) -> dict[str, Any]:
243243
}
244244

245245
set_fields = self.model_fields_set
246-
return {
247-
**{k: v for k, v in candidates.items() if k in set_fields},
248-
**self.model_kwargs,
249-
}
246+
params = {k: v for k, v in candidates.items() if k in set_fields}
247+
248+
# Anthropic extended thinking requires temperature=1 (the API default).
249+
# Sending any explicit temperature alongside thinking causes a validation error,
250+
# so we drop it here and let the gateway apply the correct default.
251+
if "thinking" in params:
252+
params.pop("temperature", None)
253+
254+
return {**params, **self.model_kwargs}
250255

251256
def _get_usage_metadata(self, json_data: dict[str, Any]) -> UsageMetadata:
252257
return UsageMetadata(

0 commit comments

Comments
 (0)