forked from phoenix/litellm-mirror
fix(huggingface_restapi.py): fix linting errors
This commit is contained in:
parent
99dc7d2e97
commit
43958907bf
1 changed files with 4 additions and 4 deletions
|
@ -310,7 +310,7 @@ class Huggingface(BaseLLM):
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
def validate_environment(self, api_key, headers) -> dict:
|
def _validate_environment(self, api_key, headers) -> dict:
|
||||||
default_headers = {
|
default_headers = {
|
||||||
"content-type": "application/json",
|
"content-type": "application/json",
|
||||||
}
|
}
|
||||||
|
@ -460,7 +460,7 @@ class Huggingface(BaseLLM):
|
||||||
super().completion()
|
super().completion()
|
||||||
exception_mapping_worked = False
|
exception_mapping_worked = False
|
||||||
try:
|
try:
|
||||||
headers = self.validate_environment(api_key, headers)
|
headers = self._validate_environment(api_key, headers)
|
||||||
task, model = get_hf_task_for_model(model)
|
task, model = get_hf_task_for_model(model)
|
||||||
## VALIDATE API FORMAT
|
## VALIDATE API FORMAT
|
||||||
if task is None or not isinstance(task, str) or task not in hf_task_list:
|
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_response: litellm.EmbeddingResponse,
|
||||||
model: str,
|
model: str,
|
||||||
input: List,
|
input: List,
|
||||||
encoding: Callable,
|
encoding: Any,
|
||||||
) -> litellm.EmbeddingResponse:
|
) -> litellm.EmbeddingResponse:
|
||||||
output_data = []
|
output_data = []
|
||||||
if "similarities" in embeddings:
|
if "similarities" in embeddings:
|
||||||
|
@ -1025,7 +1025,7 @@ class Huggingface(BaseLLM):
|
||||||
client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None,
|
client: Optional[Union[HTTPHandler, AsyncHTTPHandler]] = None,
|
||||||
) -> litellm.EmbeddingResponse:
|
) -> litellm.EmbeddingResponse:
|
||||||
super().embedding()
|
super().embedding()
|
||||||
headers = self.validate_environment(api_key, headers=None)
|
headers = self._validate_environment(api_key, headers=None)
|
||||||
# print_verbose(f"{model}, {task}")
|
# print_verbose(f"{model}, {task}")
|
||||||
embed_url = ""
|
embed_url = ""
|
||||||
if "https" in model:
|
if "https" in model:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue