mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-04 06:00:18 +08:00
anthropic-sdk-python >= 1.0 (released 2026-08-20) removed `temperature`
from the explicit signature of `AsyncMessages.create()` and
`AsyncMessages.stream()`. Any LLM call through the Anthropic binding —
including the real Anthropic API and any Anthropic-compatible gateway
(e.g. MiniMax, AWS Bedrock Claude) — now raises:
AsyncMessages.create() got an unexpected keyword argument 'temperature'
The Anthropic API itself still accepts `temperature` as a top-level
request field; the SDK simply forces callers to tunnel it through
`extra_body` instead of accepting it as a first-class kwarg. This patch
moves both `temperature` assignments in `AnthropicProvider._build_kwargs`
from the top-level kwargs to `extra_body`, so the wire payload is
unchanged and SDK 1.x stops rejecting the call.
Tests in test_anthropic_provider_fixes.py are updated to assert against
`extra_body['temperature']` instead of top-level `temperature`, plus a
new `test_temperature_is_routed_via_extra_body` covers the new
behaviour end-to-end.