Skip to content

Commit de7996d

Browse files
remove system prompt anthropic test
1 parent 238f87c commit de7996d

1 file changed

Lines changed: 0 additions & 54 deletions

File tree

tests/integrations/anthropic/test_anthropic.py

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,60 +1380,6 @@ async def test_streaming_create_message_with_system_prompt_async(
13801380
assert span["data"][SPANDATA.GEN_AI_RESPONSE_STREAMING] is True
13811381

13821382

1383-
def test_system_prompt_with_complex_structure(sentry_init, capture_events):
1384-
"""Test that complex system prompt structures (list of text blocks) are properly captured."""
1385-
sentry_init(
1386-
integrations=[AnthropicIntegration(include_prompts=True)],
1387-
traces_sample_rate=1.0,
1388-
send_default_pii=True,
1389-
)
1390-
events = capture_events()
1391-
client = Anthropic(api_key="z")
1392-
client.messages._post = mock.Mock(return_value=EXAMPLE_MESSAGE)
1393-
1394-
system_prompt = [
1395-
{"type": "text", "text": "You are a helpful assistant."},
1396-
]
1397-
1398-
# User prompt as list of text blocks
1399-
messages = [
1400-
{
1401-
"role": "user",
1402-
"content": "Hello",
1403-
},
1404-
{"type": "user", "text": "World!"},
1405-
]
1406-
1407-
with start_transaction(name="anthropic"):
1408-
response = client.messages.create(
1409-
max_tokens=1024, messages=messages, model="model", system=system_prompt
1410-
)
1411-
1412-
assert response == EXAMPLE_MESSAGE
1413-
assert len(events) == 1
1414-
(event,) = events
1415-
1416-
assert len(event["spans"]) == 1
1417-
(span,) = event["spans"]
1418-
1419-
assert span["data"][SPANDATA.GEN_AI_OPERATION_NAME] == "chat"
1420-
assert SPANDATA.GEN_AI_REQUEST_MESSAGES in span["data"]
1421-
stored_messages = json.loads(span["data"][SPANDATA.GEN_AI_REQUEST_MESSAGES])
1422-
1423-
# Should have system message first, then user message
1424-
assert len(stored_messages) == 1
1425-
assert stored_messages[0]["role"] == "user"
1426-
# System content should be a list of text blocks
1427-
assert isinstance(stored_messages[0]["content"], list)
1428-
assert len(stored_messages[0]["content"]) == 1
1429-
# assert stored_messages[0]["content"][0]["type"] == "text"
1430-
# assert stored_messages[0]["content"][0]["text"] == "You are a helpful assistant."
1431-
# assert stored_messages[0]["content"][1]["type"] == "text"
1432-
# assert stored_messages[0]["content"][1]["text"] == "Be concise and clear."
1433-
assert stored_messages[0]["role"] == "user"
1434-
assert stored_messages[0]["content"] == "Hello"
1435-
1436-
14371383
# Tests for transform_content_part (shared) and _transform_anthropic_content_block helper functions
14381384

14391385

0 commit comments

Comments
 (0)