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(tests): revert casting of litellm_logging_obj to correctly inject mocks

KnyazSh9e5a710e8ebe
diff --git a/litellm/passthrough/main.py b/litellm/passthrough/main.py
index 6143afa1199..95ec4b04b27 100644
--- a/litellm/passthrough/main.py
+++ b/litellm/passthrough/main.py
@@ -396,13 +396,9 @@ def llm_passthrough_route(
_is_async = bool(kwargs.get("allm_passthrough_route", False))
- _raw_logging_obj = kwargs.get("litellm_logging_obj")
- if not isinstance(_raw_logging_obj, LiteLLMLoggingObj):
- raise TypeError(
- "litellm_logging_obj is required and must be a LiteLLMLoggingObj instance; "
- f"got {type(_raw_logging_obj).__name__}"
- )
- litellm_logging_obj: LiteLLMLoggingObj = _raw_logging_obj
+ litellm_logging_obj = cast(
+ LiteLLMLoggingObj, kwargs.get("litellm_logging_obj")
+ ) # cast-ok: logging obj is constructed upstream; tests inject mocks
model, custom_llm_provider, api_key, api_base = get_llm_provider(
model=model,