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: type the background response retrieval test helpers

mateo-berri547f81c1a527
diff --git a/tests/test_litellm/proxy/policy_engine/test_response_retrieval.py b/tests/test_litellm/proxy/policy_engine/test_response_retrieval.py
index 8c00b18eb63..b704f666646 100644
--- a/tests/test_litellm/proxy/policy_engine/test_response_retrieval.py
+++ b/tests/test_litellm/proxy/policy_engine/test_response_retrieval.py
@@ -1,4 +1,5 @@
import logging
+from collections.abc import Mapping
import pytest
@@ -76,14 +77,16 @@ def policy_engine():
attachment_registry.clear()
-def _retrieval_data(model_id: str) -> dict:
+def _retrieval_data(model_id: str) -> dict[str, object]:
return {"response_id": _encoded_response_id(model_id), "litellm_metadata": {}}
-def _attached_pipelines(data: dict) -> tuple[tuple[str, str], ...]:
+def _attached_pipelines(data: Mapping[str, object]) -> tuple[tuple[str, str], ...]:
+ bucket = data["litellm_metadata"]
+ assert isinstance(bucket, dict)
return tuple(
(policy_name, ",".join(step.guardrail for step in pipeline.steps))
- for policy_name, pipeline in data["litellm_metadata"]["_guardrail_pipelines"]
+ for policy_name, pipeline in bucket["_guardrail_pipelines"]
)
diff --git a/tests/test_litellm/proxy/test_common_request_processing.py b/tests/test_litellm/proxy/test_common_request_processing.py
index 08007e22cfb..c451a3b4cb0 100644
--- a/tests/test_litellm/proxy/test_common_request_processing.py
+++ b/tests/test_litellm/proxy/test_common_request_processing.py
@@ -8340,7 +8340,7 @@ class TestBackgroundResponseRetrievalGovernance:
)
return router
- async def _pre_call(self, route_type: str, monkeypatch) -> dict:
+ async def _pre_call(self, route_type: str, monkeypatch: pytest.MonkeyPatch) -> dict[str, object]:
from litellm.responses.utils import ResponsesAPIRequestUtils
client_facing_response_id = "resp_opaque-client-facing-id"