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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
chore(types): type the dict-shim helpers to offset the budget gate
Kent6a940ef3f4c3
diff --git a/litellm/types/router.py b/litellm/types/router.pyindex 87e3364ac7e..75370d94895 100644--- a/litellm/types/router.py+++ b/litellm/types/router.py@@ -154,19 +154,19 @@ class ModelInfo(BaseModel):model_config = ConfigDict(extra="allow")- def __contains__(self, key):+ def __contains__(self, key: str) -> bool:# Define custom behavior for the 'in' operatorreturn hasattr(self, key)- def get(self, key, default=None):+ def get(self, key: str, default=None):# Custom .get() method to access attributes with a default value if the attribute doesn't existreturn getattr(self, key, default)- def __getitem__(self, key):+ def __getitem__(self, key: str):# Allow dictionary-style access to attributesreturn getattr(self, key)- def __setitem__(self, key, value):+ def __setitem__(self, key: str, value) -> None:# Allow dictionary-style assignment of attributessetattr(self, key, value)@@ -303,19 +303,19 @@ class GenericLiteLLMParams(CredentialLiteLLMParams, CustomPricingLiteLLMParams):return filteredreturn data- def __contains__(self, key):+ def __contains__(self, key: str) -> bool:# Define custom behavior for the 'in' operatorreturn hasattr(self, key)- def get(self, key, default=None):+ def get(self, key: str, default=None):# Custom .get() method to access attributes with a default value if the attribute doesn't existreturn getattr(self, key, default)- def __getitem__(self, key):+ def __getitem__(self, key: str):# Allow dictionary-style access to attributesreturn getattr(self, key)- def __setitem__(self, key, value):+ def __setitem__(self, key: str, value) -> None:# Allow dictionary-style assignment of attributessetattr(self, key, value)@@ -328,19 +328,19 @@ class LiteLLM_Params(GenericLiteLLMParams):model: strmodel_config = ConfigDict(extra="allow", arbitrary_types_allowed=True)- def __contains__(self, key):+ def __contains__(self, key: str) -> bool:# Define custom behavior for the 'in' operatorreturn hasattr(self, key)- def get(self, key, default=None):+ def get(self, key: str, default=None):# Custom .get() method to access attributes with a default value if the attribute doesn't existreturn getattr(self, key, default)- def __getitem__(self, key):+ def __getitem__(self, key: str):# Allow dictionary-style access to attributesreturn getattr(self, key)- def __setitem__(self, key, value):+ def __setitem__(self, key: str, value) -> None:# Allow dictionary-style assignment of attributessetattr(self, key, value)@@ -473,19 +473,19 @@ class Deployment(BaseModel):# if using pydantic v1return self.dict(**kwargs)- def __contains__(self, key):+ def __contains__(self, key: str) -> bool:# Define custom behavior for the 'in' operatorreturn hasattr(self, key)- def get(self, key, default=None):+ def get(self, key: str, default=None):# Custom .get() method to access attributes with a default value if the attribute doesn't existreturn getattr(self, key, default)- def __getitem__(self, key):+ def __getitem__(self, key: str):# Allow dictionary-style access to attributesreturn getattr(self, key)- def __setitem__(self, key, value):+ def __setitem__(self, key: str, value) -> None:# Allow dictionary-style assignment of attributessetattr(self, key, value)