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(e2e): emit gemini stream usage only on the final chunk

kerryef1f306a7dc0
diff --git a/tests/e2e/cost_calculation/scripted_provider.py b/tests/e2e/cost_calculation/scripted_provider.py
index 982132ed8df..90d95441e5c 100644
--- a/tests/e2e/cost_calculation/scripted_provider.py
+++ b/tests/e2e/cost_calculation/scripted_provider.py
@@ -750,10 +750,8 @@ def _gemini_body(scenario: Scenario, requested_model: str) -> Mapping[str, objec
def _gemini_sse(scenario: Scenario, requested_model: str) -> bytes:
emit_usage: Final = scenario.stream_usage == "final_chunk"
- first: Final = (
- _jobj(*((key, value) for key, value in _gemini_body(scenario, requested_model).items() if key != "usageMetadata"))
- if scenario.stream_usage == "absent"
- else _gemini_body(scenario, requested_model)
+ first: Final = _jobj(
+ *((key, value) for key, value in _gemini_body(scenario, requested_model).items() if key != "usageMetadata")
)
return _sse(
(