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]

refactor(proxy): type the post_call deferral helpers' request-state parameters

mateo-berri071f83980c31
diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py
index e48bd3851fb..e653ca6b62c 100644
--- a/litellm/proxy/utils.py
+++ b/litellm/proxy/utils.py
@@ -544,7 +544,7 @@ def _guardrails_outside_pipeline(policy_name: str, pipeline: "GuardrailPipeline"
def _without_names(
- bucket: dict, # mutable-ok: the applied_* header slots live in the request-state dict every hook writes in place
+ bucket: dict[str, object], # mutable-ok: the applied_* header slots live in the request-state dict hooks write
slot: str,
names: frozenset[str],
) -> None:
@@ -561,7 +561,7 @@ def _without_names(
def _withdraw_deferred_claims(
- data: dict, # mutable-ok: same request-payload shape as post_call_success_hook's data
+ data: dict[str, object], # mutable-ok: same request-payload shape as post_call_success_hook's data
deferred: Sequence[tuple[str, "GuardrailPipeline"]],
) -> None:
outside_by_policy: Final = MappingProxyType(
@@ -586,7 +586,7 @@ def _withdraw_deferred_claims(
def _defer_post_call_pipelines(
- data: dict, # mutable-ok: same request-payload shape as post_call_success_hook's data
+ data: dict[str, object], # mutable-ok: same request-payload shape as post_call_success_hook's data
response: ResponsesAPIResponse,
) -> None:
deferred: Final = _post_call_pipelines(data)
@@ -2990,7 +2990,7 @@ class ProxyLogging:
async def _run_post_call_pipelines(
self,
- data: dict, # mutable-ok: same request-payload shape as post_call_success_hook's data
+ data: dict[str, object], # mutable-ok: same request-payload shape as post_call_success_hook's data
user_api_key_dict: UserAPIKeyAuth,
response: LLMResponseTypes,
) -> LLMResponseTypes | None: