From a61d261c0639a1eae562965bc0ec009055f83bb7 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Tue, 22 Aug 2023 16:06:41 -0700 Subject: [PATCH] fix linting errors --- litellm/__init__.py | 2 +- litellm/_version.py | 3 ++- litellm/main.py | 2 +- .../tests/test_litedebugger_integration.py | 19 +++++++++++++------ litellm/utils.py | 7 ++++++- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/litellm/__init__.py b/litellm/__init__.py index bb1a25f707..2073e7423d 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -6,7 +6,7 @@ input_callback: List[str] = [] success_callback: List[str] = [] failure_callback: List[str] = [] set_verbose = False -email = None # for hosted dashboard. Learn more - https://docs.litellm.ai/docs/debugging/hosted_debugging +email: Optional[str] = None # for hosted dashboard. Learn more - https://docs.litellm.ai/docs/debugging/hosted_debugging telemetry = True max_tokens = 256 # OpenAI Defaults retry = True diff --git a/litellm/_version.py b/litellm/_version.py index 4bb27b6e47..78e569b025 100644 --- a/litellm/_version.py +++ b/litellm/_version.py @@ -1,2 +1,3 @@ import importlib_metadata -version = importlib_metadata.version('litellm') \ No newline at end of file + +version = importlib_metadata.version("litellm") diff --git a/litellm/main.py b/litellm/main.py index 96ee03aeaa..87a41b8af4 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -202,7 +202,7 @@ def completion( elif ( model in litellm.open_ai_chat_completion_models or custom_llm_provider == "custom_openai" - or "ft:gpt-3.5-turbo" in model # finetuned gpt-3.5-turbo + or "ft:gpt-3.5-turbo" in model # finetuned gpt-3.5-turbo ): # allow user to make an openai call with a custom base openai.api_type = "openai" # note: if a user sets a custom base - we should ensure this works diff --git a/litellm/tests/test_litedebugger_integration.py b/litellm/tests/test_litedebugger_integration.py index 79b1436242..5e163017d2 100644 --- a/litellm/tests/test_litedebugger_integration.py +++ b/litellm/tests/test_litedebugger_integration.py @@ -5,18 +5,25 @@ import sys, os import traceback import pytest -sys.path.insert(0, os.path.abspath('../..')) # Adds the parent directory to the system path +sys.path.insert( + 0, os.path.abspath("../..") +) # Adds the parent directory to the system path import litellm from litellm import embedding, completion litellm.email = "krrish@berri.ai" user_message = "Hello, how are you?" -messages = [{ "content": user_message,"role": "user"}] +messages = [{"content": user_message, "role": "user"}] -#openai call -response = completion(model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Hi 👋 - i'm openai"}]) +# openai call +response = completion( + model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Hi 👋 - i'm openai"}] +) -#bad request call -response = completion(model="chatgpt-test", messages=[{"role": "user", "content": "Hi 👋 - i'm a bad request"}]) +# bad request call +response = completion( + model="chatgpt-test", + messages=[{"role": "user", "content": "Hi 👋 - i'm a bad request"}], +) diff --git a/litellm/utils.py b/litellm/utils.py index ba2f6ce405..cc87f2a820 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -1022,6 +1022,7 @@ def handle_success(args, kwargs, result, start_time, end_time): ) pass + def get_model_list(): global last_fetched_at # if user is using hosted product -> get their updated model list - refresh every 5 minutes @@ -1035,7 +1036,11 @@ def get_model_list(): # make the api call last_fetched_at = time.time() print(f"last_fetched_at: {last_fetched_at}") - response = requests.post(url="http://api.litellm.ai/get_model_list", headers={"content-type": "application/json"}, data=json.dumps({"user_email": user_email})) + response = requests.post( + url="http://api.litellm.ai/get_model_list", + headers={"content-type": "application/json"}, + data=json.dumps({"user_email": user_email}), + ) print_verbose(f"get_model_list response: {response.text}") data = response.json() # update model list