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(mypy): resolve type checking errors in 5 files (#20627)

shin-bot-litellm54618c5511c0
diff --git a/litellm/a2a_protocol/exception_mapping_utils.py b/litellm/a2a_protocol/exception_mapping_utils.py
index 8463080b358..49dbb22b158 100644
--- a/litellm/a2a_protocol/exception_mapping_utils.py
+++ b/litellm/a2a_protocol/exception_mapping_utils.py
@@ -30,7 +30,7 @@ try:
A2A_SDK_AVAILABLE = True
except ImportError:
- _A2AClient = None # type: ignore[misc]
+ _A2AClient = None # type: ignore[assignment, misc]
class A2AExceptionCheckers:
diff --git a/litellm/caching/redis_cache.py b/litellm/caching/redis_cache.py
index ea7e3f5a979..03d09ecc041 100644
--- a/litellm/caching/redis_cache.py
+++ b/litellm/caching/redis_cache.py
@@ -1123,7 +1123,7 @@ class RedisCache(BaseCache):
redis_client = redis_async.Redis(**self.redis_kwargs)
# Test the connection
- ping_result = await redis_client.ping()
+ ping_result = await redis_client.ping() # type: ignore[misc]
# Close the connection
await redis_client.aclose() # type: ignore[attr-defined]
diff --git a/litellm/caching/redis_cluster_cache.py b/litellm/caching/redis_cluster_cache.py
index 91fcf1d7288..664578c8700 100644
--- a/litellm/caching/redis_cluster_cache.py
+++ b/litellm/caching/redis_cluster_cache.py
@@ -83,7 +83,7 @@ class RedisClusterCache(RedisCache):
)
# Test the connection
- ping_result = await redis_client.ping() # type: ignore[attr-defined]
+ ping_result = await redis_client.ping() # type: ignore[attr-defined, misc]
# Close the connection
await redis_client.aclose() # type: ignore[attr-defined]
diff --git a/litellm/llms/deprecated_providers/palm.py b/litellm/llms/deprecated_providers/palm.py
index 3039222c0e2..657a6fdb229 100644
--- a/litellm/llms/deprecated_providers/palm.py
+++ b/litellm/llms/deprecated_providers/palm.py
@@ -139,7 +139,7 @@ def completion(
)
## COMPLETION CALL
try:
- response = palm.generate_text(prompt=prompt, **inference_params)
+ response = palm.generate_text(prompt=prompt, **inference_params) # type: ignore[attr-defined]
except Exception as e:
raise PalmError(
message=str(e),
diff --git a/litellm/proxy/auth/handle_jwt.py b/litellm/proxy/auth/handle_jwt.py
index 584be0a9496..15056cf64e6 100644
--- a/litellm/proxy/auth/handle_jwt.py
+++ b/litellm/proxy/auth/handle_jwt.py
@@ -659,7 +659,7 @@ class JWTHandler:
token,
public_key_obj, # type: ignore
algorithms=algorithms,
- options=decode_options,
+ options=decode_options, # type: ignore[arg-type]
audience=audience,
leeway=self.leeway, # allow testing of expired tokens
)