-
Notifications
You must be signed in to change notification settings - Fork 197
Open
Description
This appears to be an API bug (not specific to the TS SDK).
Minimal reproduction case:
curl -X POST https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "anthropic-beta: web-search-2025-03-05" \
-H "content-type: application/json" \
-d '{"model":"claude-haiku-4-5","max_tokens":1024,"stream":true,"tools":[{"type":"web_search_20250305","name":"web_search"}],"messages":[{"role":"user","content":"Population of Spain?"}]}'Observed:
content_block_start index=0 server_tool_use
content_block_start index=1 web_search_tool_result
content_block_start index=1 text ← duplicate
Expected: Sequential unique indices (0, 1, 2, ...)
Per the docs:
Each content block will have an index that corresponds to its index in the final Message content array.
The streaming documentation shows web_search responses with sequential indices (0, 1, 2, 3...). The observed duplicate indices violate this contract.
Metadata
Metadata
Assignees
Labels
No labels