Skip to content

Commit a0529ae

Browse files
build(deps): bump locked anthropic to 1.2.0 + real-signature guard test
The `temperature` crash only reproduces on anthropic versions that removed the parameter (1.2.0), which a fresh `pip install` already resolves (the constraint is `anthropic>=0.86.0` with no upper bound); CI missed it only because the lock pinned 0.116.0, which still has `temperature`. - Bump the lockfile to anthropic 1.2.0 so CI runs against the version users actually get. Full unit suite + typecheck pass on 1.2.0. - Add an integration guard that binds the SDK's actual create() kwargs against the real installed client signature, so forwarding any unsupported parameter fails in CI (on 1.2.0 this fails if the temperature fix is reverted). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 15256c8 commit a0529ae

2 files changed

Lines changed: 110 additions & 23 deletions

File tree

‎pdm.lock‎

Lines changed: 81 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎tests/unit/models/anthropic/test_messages_api.py‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
"""Unit tests for Anthropic messages API output_config / thinking handling."""
22

3+
import inspect
4+
from typing import Any
35
from unittest.mock import MagicMock
46

7+
import anthropic
58
from anthropic import omit
69

710
from askui.models.anthropic.messages_api import (
@@ -130,3 +133,29 @@ def create(**kwargs: object) -> MagicMock:
130133
model_id="claude-sonnet-5",
131134
)
132135
assert isinstance(result, MessageParam)
136+
137+
def test_kwargs_accepted_by_real_client_signature(self) -> None:
138+
"""Integration guard: every kwarg the SDK sends must be accepted by the
139+
REAL installed `anthropic` client's `beta.messages.create` signature.
140+
141+
This binds against the real signature (no network), so it fails if the
142+
SDK forwards a parameter the installed client version does not support -
143+
catching this class of breakage on whatever anthropic CI resolves."""
144+
real_client = anthropic.Anthropic(api_key="dummy")
145+
real_signature = inspect.signature(real_client.beta.messages.create)
146+
147+
def spy(**kwargs: Any) -> MagicMock:
148+
# Raises TypeError if the SDK sends an unsupported keyword.
149+
real_signature.bind(**kwargs)
150+
response = MagicMock()
151+
response.model_dump.return_value = {"role": "assistant", "content": "hi"}
152+
return response
153+
154+
real_client.beta.messages.create = spy # type: ignore[method-assign]
155+
api = AnthropicMessagesApi(client=real_client)
156+
157+
result = api.create_message(
158+
messages=[MessageParam(role="user", content="hi")],
159+
model_id="claude-sonnet-5",
160+
)
161+
assert isinstance(result, MessageParam)

0 commit comments

Comments
 (0)