[ { "name": "anthropic stream: thinking then end_turn is dropped", "ctx": {"protocol": "anthropic", "stream": true}, "events": [ {"event": "message_start", "data": {"type": "message_start", "message": {"id": "msg_1", "type": "message", "role": "assistant", "content": [], "stop_reason": null, "stop_sequence": null, "usage": {"input_tokens": 9, "output_tokens": 1}}}}, {"event": "content_block_start", "data": {"type": "content_block_start", "index": 0, "content_block": {"type": "thinking", "thinking": ""}}}, {"event": "content_block_delta", "data": {"type": "content_block_delta", "index": 0, "delta": {"type": "thinking_delta", "thinking": "Let me think about that."}}}, {"event": "content_block_stop", "data": {"type": "content_block_stop", "index": 0}}, {"event": "message_delta", "data": {"type": "message_delta", "delta": {"stop_reason": "end_turn", "stop_sequence": null}, "usage": {"output_tokens": 7}}}, {"event": "message_stop", "data": {"type": "message_stop"}} ], "expect_events": [ {"type": "message_start", "message": {"id": "msg_1", "type": "message", "role": "assistant", "content": [], "stop_reason": null, "stop_sequence": null, "usage": {"input_tokens": 9, "output_tokens": 1}}}, {"type": "content_block_start", "index": 0, "content_block": {"type": "thinking", "thinking": ""}}, {"type": "content_block_delta", "index": 0, "delta": {"type": "thinking_delta", "thinking": "Let me think about that."}}, {"type": "content_block_stop", "index": 0} ] }, { "name": "anthropic stream: empty text block then end_turn is dropped", "ctx": {"protocol": "anthropic", "stream": true}, "events": [ {"event": "content_block_start", "data": {"type": "content_block_start", "index": 0, "content_block": {"type": "text", "text": ""}}}, {"event": "message_delta", "data": {"type": "message_delta", "delta": {"stop_reason": "end_turn", "stop_sequence": null}}}, {"event": "message_stop", "data": {"type": "message_stop"}} ], "expect_events": [ {"type": "content_block_start", "index": 0, "content_block": {"type": "text", "text": ""}} ] }, { "name": "anthropic stream: text passes", "ctx": {"protocol": "anthropic", "stream": true}, "events": [ {"event": "content_block_start", "data": {"type": "content_block_start", "index": 0, "content_block": {"type": "text", "text": ""}}}, {"event": "content_block_delta", "data": {"type": "content_block_delta", "index": 0, "delta": {"type": "text_delta", "text": "Hello"}}}, {"event": "content_block_stop", "data": {"type": "content_block_stop", "index": 0}}, {"event": "message_delta", "data": {"type": "message_delta", "delta": {"stop_reason": "end_turn", "stop_sequence": null}}}, {"event": "message_stop", "data": {"type": "message_stop"}} ] }, { "name": "anthropic stream: tool call passes", "ctx": {"protocol": "anthropic", "stream": true}, "events": [ {"event": "content_block_start", "data": {"type": "content_block_start", "index": 0, "content_block": {"type": "tool_use", "id": "toolu_1", "name": "Bash", "input": {}}}}, {"event": "content_block_delta", "data": {"type": "content_block_delta", "index": 0, "delta": {"type": "input_json_delta", "partial_json": "{\"command\":\"echo hi\"}"}}}, {"event": "content_block_stop", "data": {"type": "content_block_stop", "index": 0}}, {"event": "message_delta", "data": {"type": "message_delta", "delta": {"stop_reason": "tool_use", "stop_sequence": null}}}, {"event": "message_stop", "data": {"type": "message_stop"}} ] }, { "name": "anthropic stream: max_tokens is kept", "ctx": {"protocol": "anthropic", "stream": true}, "events": [ {"event": "content_block_start", "data": {"type": "content_block_start", "index": 0, "content_block": {"type": "thinking", "thinking": ""}}}, {"event": "content_block_delta", "data": {"type": "content_block_delta", "index": 0, "delta": {"type": "thinking_delta", "thinking": "over and over"}}}, {"event": "message_delta", "data": {"type": "message_delta", "delta": {"stop_reason": "max_tokens", "stop_sequence": null}}}, {"event": "message_stop", "data": {"type": "message_stop"}} ] }, { "name": "anthropic stream: refusal is kept", "ctx": {"protocol": "anthropic", "stream": true}, "events": [ {"event": "message_delta", "data": {"type": "message_delta", "delta": {"stop_reason": "refusal", "stop_sequence": null}}}, {"event": "message_stop", "data": {"type": "message_stop"}} ] }, { "name": "anthropic whole: thinking then end_turn becomes an error", "response": {"id": "msg_1", "type": "message", "role": "assistant", "stop_reason": "end_turn", "content": [{"type": "thinking", "thinking": "Let me think about that.", "signature": ""}]}, "expect_response": {"type": "error", "error": {"type": "api_error", "message": "empty reply from the model (no text; try again)"}} }, { "name": "anthropic whole: text passes", "response": {"id": "msg_1", "type": "message", "role": "assistant", "stop_reason": "end_turn", "content": [{"type": "text", "text": "Hello"}]} }, { "name": "anthropic whole: tool call passes", "response": {"id": "msg_1", "type": "message", "role": "assistant", "stop_reason": "tool_use", "content": [{"type": "tool_use", "id": "toolu_1", "name": "Bash", "input": {"command": "echo hi"}}]} }, { "name": "responses stream: reasoning then completed is dropped", "ctx": {"protocol": "responses", "stream": true}, "events": [ {"event": "response.created", "data": {"type": "response.created", "response": {"id": "resp_1", "object": "response", "status": "in_progress", "output": []}}}, {"event": "response.output_item.added", "data": {"type": "response.output_item.added", "output_index": 0, "item": {"type": "reasoning", "id": "rs_1", "summary": []}}}, {"event": "response.reasoning_summary_part.added", "data": {"type": "response.reasoning_summary_part.added", "item_id": "rs_1", "summary_index": 0, "part": {"type": "summary_text", "text": ""}}}, {"event": "response.reasoning_summary_text.delta", "data": {"type": "response.reasoning_summary_text.delta", "item_id": "rs_1", "summary_index": 0, "delta": "Let me think about that."}}, {"event": "response.reasoning_summary_text.done", "data": {"type": "response.reasoning_summary_text.done", "item_id": "rs_1", "summary_index": 0, "text": "Let me think about that."}}, {"event": "response.output_item.done", "data": {"type": "response.output_item.done", "output_index": 0, "item": {"type": "reasoning", "id": "rs_1", "summary": [{"type": "summary_text", "text": "Let me think about that."}]}}}, {"event": "response.completed", "data": {"type": "response.completed", "response": {"id": "resp_1", "object": "response", "status": "completed", "output": [{"type": "reasoning", "id": "rs_1", "summary": [{"type": "summary_text", "text": "Let me think about that."}]}], "usage": {"input_tokens": 9, "output_tokens": 7, "total_tokens": 16}}}} ], "expect_events": [ {"type": "response.created", "response": {"id": "resp_1", "object": "response", "status": "in_progress", "output": []}}, {"type": "response.output_item.added", "output_index": 0, "item": {"type": "reasoning", "id": "rs_1", "summary": []}}, {"type": "response.reasoning_summary_part.added", "item_id": "rs_1", "summary_index": 0, "part": {"type": "summary_text", "text": ""}}, {"type": "response.reasoning_summary_text.delta", "item_id": "rs_1", "summary_index": 0, "delta": "Let me think about that."}, {"type": "response.reasoning_summary_text.done", "item_id": "rs_1", "summary_index": 0, "text": "Let me think about that."}, {"type": "response.output_item.done", "output_index": 0, "item": {"type": "reasoning", "id": "rs_1", "summary": [{"type": "summary_text", "text": "Let me think about that."}]}} ] }, { "name": "responses stream: message passes", "ctx": {"protocol": "responses", "stream": true}, "events": [ {"event": "response.output_item.added", "data": {"type": "response.output_item.added", "output_index": 0, "item": {"type": "message", "id": "msg_1", "role": "assistant", "content": []}}}, {"event": "response.content_part.added", "data": {"type": "response.content_part.added", "item_id": "msg_1", "output_index": 0, "content_index": 0, "part": {"type": "output_text", "text": ""}}}, {"event": "response.output_text.delta", "data": {"type": "response.output_text.delta", "item_id": "msg_1", "output_index": 0, "content_index": 0, "delta": "Hello"}}, {"event": "response.output_item.done", "data": {"type": "response.output_item.done", "output_index": 0, "item": {"type": "message", "id": "msg_1", "role": "assistant", "content": [{"type": "output_text", "text": "Hello"}]}}}, {"event": "response.completed", "data": {"type": "response.completed", "response": {"id": "resp_1", "object": "response", "status": "completed", "output": [{"type": "message", "id": "msg_1", "role": "assistant", "content": [{"type": "output_text", "text": "Hello"}]}]}}} ] }, { "name": "responses stream: function call passes", "ctx": {"protocol": "responses", "stream": true}, "events": [ {"event": "response.output_item.added", "data": {"type": "response.output_item.added", "output_index": 0, "item": {"type": "function_call", "id": "fc_1", "name": "shell", "arguments": ""}}}, {"event": "response.function_call_arguments.delta", "data": {"type": "response.function_call_arguments.delta", "item_id": "fc_1", "output_index": 0, "delta": "{\"command\":\"echo hi\"}"}}, {"event": "response.output_item.done", "data": {"type": "response.output_item.done", "output_index": 0, "item": {"type": "function_call", "id": "fc_1", "name": "shell", "arguments": "{\"command\":\"echo hi\"}"}}}, {"event": "response.completed", "data": {"type": "response.completed", "response": {"id": "resp_1", "object": "response", "status": "completed", "output": [{"type": "function_call", "id": "fc_1", "name": "shell", "arguments": "{\"command\":\"echo hi\"}"}]}}} ] }, { "name": "responses stream: incomplete is kept", "ctx": {"protocol": "responses", "stream": true}, "events": [ {"event": "response.output_item.added", "data": {"type": "response.output_item.added", "output_index": 0, "item": {"type": "reasoning", "id": "rs_1", "summary": []}}}, {"event": "response.completed", "data": {"type": "response.completed", "response": {"id": "resp_1", "object": "response", "status": "incomplete", "incomplete_details": {"reason": "max_output_tokens"}, "output": [{"type": "reasoning", "id": "rs_1", "summary": []}]}}} ] }, { "name": "responses whole: reasoning only becomes failed", "ctx": {"protocol": "responses"}, "response": {"id": "resp_1", "object": "response", "status": "completed", "output": [{"type": "reasoning", "id": "rs_1", "summary": [{"type": "summary_text", "text": "Let me think about that."}]}]}, "expect_response": {"id": "resp_1", "object": "response", "status": "failed", "output": [{"type": "reasoning", "id": "rs_1", "summary": [{"type": "summary_text", "text": "Let me think about that."}]}], "error": {"code": "empty_reply", "message": "empty reply from the model (no text; try again)"}} }, { "name": "responses whole: message passes", "ctx": {"protocol": "responses"}, "response": {"id": "resp_1", "object": "response", "status": "completed", "output": [{"type": "message", "id": "msg_1", "role": "assistant", "content": [{"type": "output_text", "text": "Hello"}]}]} }, { "name": "responses whole: empty message becomes failed", "ctx": {"protocol": "responses"}, "response": {"id": "resp_1", "object": "response", "status": "completed", "output": [{"type": "message", "id": "msg_1", "role": "assistant", "content": [{"type": "output_text", "text": ""}]}]}, "expect_response": {"id": "resp_1", "object": "response", "status": "failed", "output": [{"type": "message", "id": "msg_1", "role": "assistant", "content": [{"type": "output_text", "text": ""}]}], "error": {"code": "empty_reply", "message": "empty reply from the model (no text; try again)"}} }]