Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

test(integration): follow #46101 in the breakpoint cache mark census expectation (#46509)

Mateo Wangbbd58931fea5
diff --git a/tests/integration/providers/test_cache_control_tool_call_marks_wire.py b/tests/integration/providers/test_cache_control_tool_call_marks_wire.py
index 8c698817ccf..47d28860018 100644
--- a/tests/integration/providers/test_cache_control_tool_call_marks_wire.py
+++ b/tests/integration/providers/test_cache_control_tool_call_marks_wire.py
@@ -467,14 +467,25 @@ def _openai_message_marks(message: dict[str, JsonValue]) -> list[str]:
@pytest.mark.parametrize(
- "options",
+ "options, expected_marks",
(
- pytest.param({"prompt_cache_options": {"mode": "explicit"}}, id="breakpoint-dialect"),
- pytest.param({}, id="plain"),
+ pytest.param(
+ {"prompt_cache_options": {"mode": "explicit"}},
+ [f"prompt_cache_breakpoint@user:text:{ASK}"],
+ id="breakpoint-dialect",
+ ),
+ pytest.param(
+ {},
+ [
+ f"cache_control@user:text:{ASK}",
+ *(f"cache_control@tool_call:{call_id(city)}" for city in CITIES),
+ ],
+ id="plain",
+ ),
),
)
def test_openai_points_skip_injection_when_client_marks_fill_the_cap(
- gateway: Gateway, options: dict[str, JsonValue]
+ gateway: Gateway, options: dict[str, JsonValue], expected_marks: list[str]
) -> None:
marker: Final = new_marker()
with wire_server(lambda request: Reply(body=_OPENAI_REPLY)) as wire, gateway.scenario() as scenario:
@@ -488,7 +499,7 @@ def test_openai_points_skip_injection_when_client_marks_fill_the_cap(
status, _, text = post_chat(gateway, chat_body(model, conversation(marker, marked_calls())))
assert status == 200, text
marks: Final = _openai_marks(_only_request(wire))
- assert marks == [f"cache_control@user:text:{ASK}", *(f"cache_control@tool_call:{call_id(city)}" for city in CITIES)]
+ assert marks == expected_marks
@pytest.mark.parametrize("stream", (False, True), ids=("json", "stream"))