feat: Automate installation of required libraries. (#1795)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import subprocess
|
||||
import sys
|
||||
import httpx
|
||||
from typing import Optional, List, Union
|
||||
import threading
|
||||
@@ -5,9 +7,17 @@ import threading
|
||||
try:
|
||||
import litellm
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
"litellm requires extra dependencies. Install with `pip install litellm`"
|
||||
) from None
|
||||
user_input = input("The 'litellm' library is required. Install it now? [y/N]: ")
|
||||
if user_input.lower() == 'y':
|
||||
try:
|
||||
subprocess.check_call([sys.executable, "-m", "pip", "install", "litellm"])
|
||||
import litellm
|
||||
except subprocess.CalledProcessError:
|
||||
print("Failed to install 'litellm'. Please install it manually using 'pip install litellm'.")
|
||||
sys.exit(1)
|
||||
else:
|
||||
raise ImportError("The required 'litellm' library is not installed.")
|
||||
sys.exit(1)
|
||||
|
||||
from mem0.memory.telemetry import capture_client_event
|
||||
from mem0 import Memory, MemoryClient
|
||||
|
||||
Reference in New Issue
Block a user