mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 19:54:13 +00:00
fix: fix linting errors
This commit is contained in:
parent
7c0ab40fd5
commit
ef72f25ab6
3 changed files with 16 additions and 15 deletions
|
@ -16,11 +16,11 @@ repos:
|
||||||
name: Check if files match
|
name: Check if files match
|
||||||
entry: python3 ci_cd/check_files_match.py
|
entry: python3 ci_cd/check_files_match.py
|
||||||
language: system
|
language: system
|
||||||
# - repo: local
|
- repo: local
|
||||||
# hooks:
|
hooks:
|
||||||
# - id: mypy
|
- id: mypy
|
||||||
# name: mypy
|
name: mypy
|
||||||
# entry: python3 -m mypy --ignore-missing-imports
|
entry: python3 -m mypy --ignore-missing-imports
|
||||||
# language: system
|
language: system
|
||||||
# types: [python]
|
types: [python]
|
||||||
# files: ^litellm/
|
files: ^litellm/
|
|
@ -399,10 +399,11 @@ class Huggingface(BaseLLM):
|
||||||
data = {
|
data = {
|
||||||
"inputs": prompt,
|
"inputs": prompt,
|
||||||
"parameters": optional_params,
|
"parameters": optional_params,
|
||||||
"stream": (
|
"stream": ( # type: ignore
|
||||||
True
|
True
|
||||||
if "stream" in optional_params
|
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
|
else False
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
@ -433,7 +434,7 @@ class Huggingface(BaseLLM):
|
||||||
data = {
|
data = {
|
||||||
"inputs": prompt,
|
"inputs": prompt,
|
||||||
"parameters": inference_params,
|
"parameters": inference_params,
|
||||||
"stream": (
|
"stream": ( # type: ignore
|
||||||
True
|
True
|
||||||
if "stream" in optional_params
|
if "stream" in optional_params
|
||||||
and optional_params["stream"] == True
|
and optional_params["stream"] == True
|
||||||
|
|
|
@ -129,7 +129,7 @@ class PredibaseChatCompletion(BaseLLM):
|
||||||
)
|
)
|
||||||
super().__init__()
|
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:
|
if api_key is None:
|
||||||
raise ValueError(
|
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"
|
"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,
|
logger_fn=None,
|
||||||
headers: dict = {},
|
headers: dict = {},
|
||||||
) -> Union[ModelResponse, CustomStreamWrapper]:
|
) -> Union[ModelResponse, CustomStreamWrapper]:
|
||||||
headers = self.validate_environment(api_key, headers)
|
headers = self._validate_environment(api_key, headers)
|
||||||
completion_url = ""
|
completion_url = ""
|
||||||
input_text = ""
|
input_text = ""
|
||||||
base_url = "https://serving.app.predibase.com"
|
base_url = "https://serving.app.predibase.com"
|
||||||
|
@ -411,13 +411,13 @@ class PredibaseChatCompletion(BaseLLM):
|
||||||
data=json.dumps(data),
|
data=json.dumps(data),
|
||||||
stream=stream,
|
stream=stream,
|
||||||
)
|
)
|
||||||
response = CustomStreamWrapper(
|
_response = CustomStreamWrapper(
|
||||||
response.iter_lines(),
|
response.iter_lines(),
|
||||||
model,
|
model,
|
||||||
custom_llm_provider="predibase",
|
custom_llm_provider="predibase",
|
||||||
logging_obj=logging_obj,
|
logging_obj=logging_obj,
|
||||||
)
|
)
|
||||||
return response
|
return _response
|
||||||
### SYNC COMPLETION
|
### SYNC COMPLETION
|
||||||
else:
|
else:
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue