mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
remove auto install
This commit is contained in:
parent
18561c11fe
commit
95f748ce91
2 changed files with 10 additions and 12 deletions
|
@ -3,7 +3,8 @@
|
|||
from datetime import datetime, timezone
|
||||
import traceback
|
||||
import dotenv
|
||||
import subprocess
|
||||
import importlib
|
||||
from pkg_resources import parse_version
|
||||
import sys
|
||||
|
||||
dotenv.load_dotenv()
|
||||
|
@ -56,19 +57,16 @@ class LunaryLogger:
|
|||
def __init__(self):
|
||||
try:
|
||||
import lunary
|
||||
# lunary.__version__ doesn't exist throws if lunary is not installed
|
||||
if not hasattr(lunary, "track_event"):
|
||||
version = importlib.metadata.version("lunary")
|
||||
# if version < 0.1.43 then raise ImportError
|
||||
if parse_version(version) < parse_version("0.1.43"):
|
||||
print("Lunary version outdated. Required: > 0.1.43. Upgrade via 'pip install lunary --upgrade'")
|
||||
raise ImportError
|
||||
|
||||
self.lunary_client = lunary
|
||||
except ImportError:
|
||||
print("Lunary not installed. Installing now...")
|
||||
subprocess.check_call([sys.executable, "-m", "pip", "install", "lunary", "--upgrade"])
|
||||
import importlib
|
||||
import lunary
|
||||
importlib.reload(lunary)
|
||||
|
||||
self.lunary_client = lunary
|
||||
print("Lunary not installed. Please install it using 'pip install lunary'")
|
||||
raise ImportError
|
||||
|
||||
|
||||
def log_event(
|
||||
|
|
|
@ -39,7 +39,7 @@ def test_lunary_template():
|
|||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
test_lunary_template()
|
||||
# test_lunary_template()
|
||||
|
||||
def test_lunary_logging_with_metadata():
|
||||
try:
|
||||
|
@ -80,4 +80,4 @@ def test_lunary_logging_with_streaming_and_metadata():
|
|||
print(e)
|
||||
|
||||
|
||||
#test_lunary_logging_with_streaming_and_metadata()
|
||||
test_lunary_logging_with_streaming_and_metadata()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue