diff --git a/litellm/llms/bedrock/chat/invoke_handler.py b/litellm/llms/bedrock/chat/invoke_handler.py index 822a2e6ac00..5f335dfdb8e 100644 --- a/litellm/llms/bedrock/chat/invoke_handler.py +++ b/litellm/llms/bedrock/chat/invoke_handler.py @@ -1272,15 +1272,15 @@ class BedrockLLM(BaseAWSLLM): return cast(litellm.BEDROCK_INVOKE_PROVIDERS_LITERAL, provider) return None + @staticmethod def get_bedrock_model_id( - self, optional_params: dict, provider: Optional[litellm.BEDROCK_INVOKE_PROVIDERS_LITERAL], model: str, ) -> str: modelId = optional_params.pop("model_id", None) if modelId is not None: - modelId = self.encode_model_id(model_id=modelId) + modelId = BedrockLLM.encode_model_id(model_id=modelId) else: modelId = model @@ -1288,19 +1288,19 @@ class BedrockLLM(BaseAWSLLM): modelId, optional_params ) if provider == "llama" and "llama/" in modelId: - modelId = self._get_model_id_for_llama_like_model(modelId) + modelId = BedrockLLM._get_model_id_for_llama_like_model(modelId) return modelId + @staticmethod def _get_model_id_for_llama_like_model( - self, model: str, ) -> str: """ Remove `llama` from modelID since `llama` is simply a spec to follow for custom bedrock models """ model_id = model.replace("llama/", "") - return self.encode_model_id(model_id=model_id) + return BedrockLLM.encode_model_id(model_id=model_id) def get_response_stream_shape(): diff --git a/litellm/llms/bedrock/chat/invoke_transformations/base_invoke_transformation.py b/litellm/llms/bedrock/chat/invoke_transformations/base_invoke_transformation.py index 8c1205c3c91..b6cf7aa91c4 100644 --- a/litellm/llms/bedrock/chat/invoke_transformations/base_invoke_transformation.py +++ b/litellm/llms/bedrock/chat/invoke_transformations/base_invoke_transformation.py @@ -568,15 +568,15 @@ class AmazonInvokeConfig(BaseConfig, BaseAWSLLM): return cast(litellm.BEDROCK_INVOKE_PROVIDERS_LITERAL, provider) return None + @staticmethod def get_bedrock_model_id( - self, optional_params: dict, provider: Optional[litellm.BEDROCK_INVOKE_PROVIDERS_LITERAL], model: str, ) -> str: modelId = optional_params.pop("model_id", None) if modelId is not None: - modelId = self.encode_model_id(model_id=modelId) + modelId = AmazonInvokeConfig.encode_model_id(model_id=modelId) else: modelId = model @@ -585,15 +585,17 @@ class AmazonInvokeConfig(BaseConfig, BaseAWSLLM): modelId, optional_params ) if provider == "llama" and "llama/" in modelId: - modelId = self._get_model_id_from_model_with_spec(modelId, spec="llama") + modelId = AmazonInvokeConfig._get_model_id_from_model_with_spec( + modelId, spec="llama" + ) elif provider == "deepseek_r1" and "deepseek_r1/" in modelId: - modelId = self._get_model_id_from_model_with_spec( + modelId = AmazonInvokeConfig._get_model_id_from_model_with_spec( modelId, spec="deepseek_r1" ) return modelId + @staticmethod def _get_model_id_from_model_with_spec( - self, model: str, spec: str, ) -> str: @@ -601,9 +603,10 @@ class AmazonInvokeConfig(BaseConfig, BaseAWSLLM): Remove `llama` from modelID since `llama` is simply a spec to follow for custom bedrock models """ model_id = model.replace(spec + "/", "") - return self.encode_model_id(model_id=model_id) + return AmazonInvokeConfig.encode_model_id(model_id=model_id) - def encode_model_id(self, model_id: str) -> str: + @staticmethod + def encode_model_id(model_id: str) -> str: """ Double encode the model ID to ensure it matches the expected double-encoded format. Args: diff --git a/litellm/llms/gemini/videos/transformation.py b/litellm/llms/gemini/videos/transformation.py index 99feb8eb6b5..c7116940b22 100644 --- a/litellm/llms/gemini/videos/transformation.py +++ b/litellm/llms/gemini/videos/transformation.py @@ -343,7 +343,7 @@ class GeminiVideoConfig(BaseVideoConfig): model=model, ) - usage_data = {} + usage_data: Dict[str, Any] = {} if request_data: parameters = request_data.get("parameters", {}) duration = ( diff --git a/litellm/llms/vertex_ai/vertex_embeddings/transformation.py b/litellm/llms/vertex_ai/vertex_embeddings/transformation.py index a3018c5bd6b..24396628dbd 100644 --- a/litellm/llms/vertex_ai/vertex_embeddings/transformation.py +++ b/litellm/llms/vertex_ai/vertex_embeddings/transformation.py @@ -132,7 +132,7 @@ class VertexAITextEmbeddingConfig(BaseModel): vertex_request["labels"] = labels return vertex_request - vertex_request: VertexEmbeddingRequest = VertexEmbeddingRequest() + vertex_request = VertexEmbeddingRequest() vertex_text_embedding_input_list: List[TextEmbeddingInput] = [] task_type: Optional[TaskType] = optional_params.get("task_type") title = optional_params.get("title") diff --git a/litellm/llms/vertex_ai/videos/transformation.py b/litellm/llms/vertex_ai/videos/transformation.py index 83bd9eda674..ed6176cef05 100644 --- a/litellm/llms/vertex_ai/videos/transformation.py +++ b/litellm/llms/vertex_ai/videos/transformation.py @@ -363,7 +363,7 @@ class VertexAIVideoConfig(BaseVideoConfig, VertexBase): id=video_id, object="video", status="processing", model=model ) - usage_data = {} + usage_data: Dict[str, Any] = {} if request_data: parameters = request_data.get("parameters", {}) duration = ( diff --git a/litellm/responses/litellm_completion_transformation/transformation.py b/litellm/responses/litellm_completion_transformation/transformation.py index 32bda43eb63..b1986ec0a77 100644 --- a/litellm/responses/litellm_completion_transformation/transformation.py +++ b/litellm/responses/litellm_completion_transformation/transformation.py @@ -181,7 +181,7 @@ class LiteLLMCompletionResponsesConfig: ) # Extract reasoning_effort from reasoning parameter - reasoning_effort = None + reasoning_effort: Optional[Any] = None reasoning_param = responses_api_request.get("reasoning") if reasoning_param: if isinstance(reasoning_param, dict):