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: include response key in response.completed chunk for ID hook test

Sameer Kankute15288f3ae7d5
diff --git a/tests/llm_responses_api_testing/test_responses_hooks.py b/tests/llm_responses_api_testing/test_responses_hooks.py
index 8933ec8f3c5..3799a0b9121 100644
--- a/tests/llm_responses_api_testing/test_responses_hooks.py
+++ b/tests/llm_responses_api_testing/test_responses_hooks.py
@@ -384,7 +384,13 @@ def test_process_chunk_completed_response_updates_id_and_usage_cost(monkeypatch)
)
try:
- event = iterator._process_chunk(json.dumps({"type": "response.completed"}))
+ # Chunk must include a top-level "response" key so BaseResponsesAPIStreamingIterator
+ # runs _update_responses_api_response_id_with_model_id (see streaming_iterator.py).
+ event = iterator._process_chunk(
+ json.dumps(
+ {"type": "response.completed", "response": {"id": "resp_live"}}
+ )
+ )
finally:
litellm.include_cost_in_streaming_usage = original_include_cost