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(huggingface_restapi.py): fix linting errors

Krrish Dholakia43958907bf65
diff --git a/litellm/llms/huggingface_restapi.py b/litellm/llms/huggingface_restapi.py
index f2d43c37e6f..2910a644e59 100644
--- a/litellm/llms/huggingface_restapi.py
+++ b/litellm/llms/huggingface_restapi.py
@@ -310,7 +310,7 @@ class Huggingface(BaseLLM):
def __init__(self) -> None:
super().__init__()
- def validate_environment(self, api_key, headers) -> dict:
+ def _validate_environment(self, api_key, headers) -> dict:
default_headers = {
"content-type": "application/json",
}
@@ -460,7 +460,7 @@ class Huggingface(BaseLLM):
super().completion()
exception_mapping_worked = False
try:
- headers = self.validate_environment(api_key, headers)
+ headers = self._validate_environment(api_key, headers)
task, model = get_hf_task_for_model(model)
## VALIDATE API FORMAT
if task is None or not isinstance(task, str) or task not in hf_task_list:
@@ -890,7 +890,7 @@ class Huggingface(BaseLLM):
model_response: litellm.EmbeddingResponse,
model: str,
input: List,
- encoding: Callable,
+ encoding: Any,
) -> litellm.EmbeddingResponse:
output_data = []
if "similarities" in embeddings:
@@ -1025,7 +1025,7 @@ class Huggingface(BaseLLM):
client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None,
) -> litellm.EmbeddingResponse:
super().embedding()
- headers = self.validate_environment(api_key, headers=None)
+ headers = self._validate_environment(api_key, headers=None)
# print_verbose(f"{model}, {task}")
embed_url = ""
if "https" in model: