fix: fix linting errors

This commit is contained in:
Krrish Dholakia 2024-05-09 17:55:27 -07:00
parent d7189c21fd
commit 9083d8e490
3 changed files with 16 additions and 15 deletions

View file

@ -16,11 +16,11 @@ repos:
name: Check if files match
entry: python3 ci_cd/check_files_match.py
language: system
# - repo: local
# hooks:
# - id: mypy
# name: mypy
# entry: python3 -m mypy --ignore-missing-imports
# language: system
# types: [python]
# files: ^litellm/
- repo: local
hooks:
- id: mypy
name: mypy
entry: python3 -m mypy --ignore-missing-imports
language: system
types: [python]
files: ^litellm/

View file

@ -399,10 +399,11 @@ class Huggingface(BaseLLM):
data = {
"inputs": prompt,
"parameters": optional_params,
"stream": (
"stream": ( # type: ignore
True
if "stream" in optional_params
and optional_params["stream"] == True
and isinstance(optional_params["stream"], bool)
and optional_params["stream"] == True # type: ignore
else False
),
}
@ -433,7 +434,7 @@ class Huggingface(BaseLLM):
data = {
"inputs": prompt,
"parameters": inference_params,
"stream": (
"stream": ( # type: ignore
True
if "stream" in optional_params
and optional_params["stream"] == True

View file

@ -129,7 +129,7 @@ class PredibaseChatCompletion(BaseLLM):
)
super().__init__()
def validate_environment(self, api_key: Optional[str], user_headers: dict) -> dict:
def _validate_environment(self, api_key: Optional[str], user_headers: dict) -> dict:
if api_key is None:
raise ValueError(
"Missing Predibase API Key - A call is being made to predibase but no key is set either in the environment variables or via params"
@ -309,7 +309,7 @@ class PredibaseChatCompletion(BaseLLM):
logger_fn=None,
headers: dict = {},
) -> Union[ModelResponse, CustomStreamWrapper]:
headers = self.validate_environment(api_key, headers)
headers = self._validate_environment(api_key, headers)
completion_url = ""
input_text = ""
base_url = "https://serving.app.predibase.com"
@ -411,13 +411,13 @@ class PredibaseChatCompletion(BaseLLM):
data=json.dumps(data),
stream=stream,
)
response = CustomStreamWrapper(
_response = CustomStreamWrapper(
response.iter_lines(),
model,
custom_llm_provider="predibase",
logging_obj=logging_obj,
)
return response
return _response
### SYNC COMPLETION
else:
response = requests.post(