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]

fix(complexity_router): use Mapping instead of dict in turn_off_message_logging helper parameter

Tin Chi Lo074eda52222d
diff --git a/litellm/router_strategy/complexity_router/complexity_router.py b/litellm/router_strategy/complexity_router/complexity_router.py
index bbeeeb0be64..1da8ee68c6e 100644
--- a/litellm/router_strategy/complexity_router/complexity_router.py
+++ b/litellm/router_strategy/complexity_router/complexity_router.py
@@ -18,6 +18,7 @@ from __future__ import annotations
import asyncio
import random
import re
+from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, Literal, Union, cast
from pydantic import BaseModel
@@ -113,12 +114,14 @@ def _classifier_call_metadata(metadata: dict[str, Any] | None) -> dict[str, Any]
}
-def _effective_turn_off_message_logging(request_kwargs: dict[str, Any] | None) -> bool | None:
+def _effective_turn_off_message_logging(request_kwargs: Mapping[str, Any] | None) -> bool | None:
from litellm.litellm_core_utils.initialize_dynamic_callback_params import (
initialize_standard_callback_dynamic_params,
)
- return initialize_standard_callback_dynamic_params(request_kwargs or {}).get("turn_off_message_logging")
+ return initialize_standard_callback_dynamic_params(dict(request_kwargs) if request_kwargs else {}).get(
+ "turn_off_message_logging"
+ )
class DimensionScore: