mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
test(anthropic): assert upstream request order in multi-turn Claude Code tests
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
337d5cc482
commit
0ea21ef9e0
5 changed files with 10 additions and 5 deletions
|
|
@ -105,4 +105,5 @@ def test_compaction_edit_and_applied_edit_block_round_trip_through_anthropic(gat
|
|||
"POST", "/v1/messages", {**turn3, "model": model}, params={"beta": "true"}, headers=headers
|
||||
)
|
||||
assert response2.status_code == 200, response2.text
|
||||
assert len(wire.drain()) == 2
|
||||
bodies: Final = tuple(cc.JSON_OBJECT.validate_json(request.body) for request in wire.drain())
|
||||
assert bodies == (first_expected, second_expected), bodies
|
||||
|
|
|
|||
|
|
@ -64,4 +64,5 @@ def test_tool_result_image_block_and_pasted_image_reach_anthropic_identical(gate
|
|||
"POST", "/v1/messages", {**pasted, "model": model}, params={"beta": "true"}, headers=headers
|
||||
)
|
||||
assert response2.status_code == 200, response2.text
|
||||
assert len(wire.drain()) == 2
|
||||
bodies: Final = tuple(cc.JSON_OBJECT.validate_json(request.body) for request in wire.drain())
|
||||
assert bodies == (first_expected, second_expected), bodies
|
||||
|
|
|
|||
|
|
@ -163,4 +163,5 @@ def test_interleaved_thinking_text_and_tool_use_history_reaches_anthropic_identi
|
|||
]
|
||||
assert started == [(0, "thinking"), (1, "text"), (2, "tool_use")], started
|
||||
assert events[-1][0] == "message_stop"
|
||||
assert len(wire.drain()) == 2
|
||||
bodies: Final = tuple(cc.JSON_OBJECT.validate_json(request.body) for request in wire.drain())
|
||||
assert bodies == (turn2_expected, turn3_expected), bodies
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@ def test_claude_code_mid_loop_model_switch_replays_history_byte_identical(gatewa
|
|||
"POST", "/v1/messages", {**turn2, "model": opus}, params={"beta": "true"}, headers=headers
|
||||
)
|
||||
assert response2.status_code == 200, response2.text
|
||||
assert len(wire.drain()) == 2
|
||||
bodies: Final = tuple(cc.JSON_OBJECT.validate_json(request.body) for request in wire.drain())
|
||||
assert bodies == (first_expected, second_expected), bodies
|
||||
rows: Final = eventually(
|
||||
lambda: read_rows(
|
||||
'SELECT model FROM "LiteLLM_SpendLogs" WHERE request_id=%s',
|
||||
|
|
|
|||
|
|
@ -101,7 +101,8 @@ def test_claude_code_tool_loop_round_trips_thinking_tool_use_and_tool_result(gat
|
|||
events2: Final = cc.sse_events(response2.text)
|
||||
assert events2[2][1]["delta"] == {"type": "text_delta", "text": "PROBE"}
|
||||
assert events2[4][1]["delta"]["stop_reason"] == "end_turn"
|
||||
assert len(wire.drain()) == 2
|
||||
bodies: Final = tuple(cc.JSON_OBJECT.validate_json(request.body) for request in wire.drain())
|
||||
assert bodies == (first_expected, second_expected), bodies
|
||||
rows: Final = eventually(
|
||||
lambda: read_rows(
|
||||
'SELECT prompt_tokens FROM "LiteLLM_SpendLogs" WHERE request_id=%s',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue