Skip to content

Commit f00f75f

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 24a9e11 commit f00f75f

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

  • packages/uipath_langchain_client/src/uipath_langchain_client/clients/normalized

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)