Skip to content

Commit cec7ccf

Browse files
authored
test: remove redacted thinking test due Claude 3.7 Sonnet retirement (#2863)
1 parent 01af2c6 commit cec7ccf

File tree

1 file changed

+0
-53
lines changed

1 file changed

+0
-53
lines changed

integrations/anthropic/tests/test_chat_generator.py

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,59 +1242,6 @@ def test_live_run_with_reasoning(self, streaming_callback):
12421242
if streaming_callback:
12431243
streaming_callback.assert_called()
12441244

1245-
@pytest.mark.parametrize("streaming_callback", [None, Mock()])
1246-
@pytest.mark.skipif(
1247-
not os.environ.get("ANTHROPIC_API_KEY", None),
1248-
reason="Export an env var called ANTHROPIC_API_KEY containing the Anthropic API key to run this test.",
1249-
)
1250-
@pytest.mark.integration
1251-
def test_live_run_with_redacted_thinking(self, streaming_callback):
1252-
"""
1253-
This test uses a magic string to trigger the redacted thinking
1254-
feature and works with claude-3-7-sonnet-20250219.
1255-
"""
1256-
chat_generator = AnthropicChatGenerator(
1257-
model="claude-3-7-sonnet-20250219",
1258-
generation_kwargs={"thinking": {"type": "enabled", "budget_tokens": 10000}, "max_tokens": 11000},
1259-
streaming_callback=streaming_callback,
1260-
)
1261-
1262-
message = ChatMessage.from_user(
1263-
"ANTHROPIC_MAGIC_STRING_TRIGGER_REDACTED_THINKING_46C9A13E193C177646C7398A98432ECCCE4C1253D5E2D82641AC0E52CC2876CB"
1264-
)
1265-
response = chat_generator.run([message])["replies"][0]
1266-
1267-
assert isinstance(response, ChatMessage)
1268-
assert response.text and len(response.text) > 0
1269-
assert response.reasoning is not None
1270-
# we cannot be sure how many redacted blocks will be returned with streaming
1271-
assert "[REDACTED]" in response.reasoning.reasoning_text
1272-
assert "reasoning_contents" in response.reasoning.extra
1273-
assert (
1274-
len(response.reasoning.extra.get("reasoning_contents")[0].get("reasoning_content").get("redacted_thinking"))
1275-
> 0
1276-
)
1277-
1278-
new_message = ChatMessage.from_user("Now tell me whats the capital of France.")
1279-
new_response = chat_generator.run([message, response, new_message])["replies"][0]
1280-
1281-
assert isinstance(new_response, ChatMessage)
1282-
assert new_response.text and len(new_response.text) > 0
1283-
assert new_response.reasoning is not None
1284-
assert "[REDACTED]" in new_response.reasoning.reasoning_text
1285-
assert "reasoning_contents" in new_response.reasoning.extra
1286-
assert (
1287-
len(
1288-
new_response.reasoning.extra.get("reasoning_contents")[0]
1289-
.get("reasoning_content")
1290-
.get("redacted_thinking")
1291-
)
1292-
> 0
1293-
)
1294-
1295-
if streaming_callback:
1296-
streaming_callback.assert_called()
1297-
12981245
@pytest.mark.integration
12991246
@pytest.mark.skipif(
13001247
not os.environ.get("ANTHROPIC_API_KEY", None),

0 commit comments

Comments
 (0)