mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
28 lines
766 B
Python
28 lines
766 B
Python
import sys, os
|
|
import traceback
|
|
|
|
# Get the current directory of the script
|
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
# Get the parent directory by joining the current directory with '..'
|
|
parent_dir = os.path.join(current_dir, '..')
|
|
|
|
# Add the parent directory to the system path
|
|
sys.path.append(parent_dir)
|
|
|
|
import main
|
|
from main import embedding, completion
|
|
main.success_callback = ["posthog"]
|
|
main.failure_callback = ["slack", "sentry", "posthog"]
|
|
|
|
main.set_verbose = True
|
|
|
|
user_message = "Hello, how are you?"
|
|
messages = [{ "content": user_message,"role": "user"}]
|
|
model_val = "krrish is a model"
|
|
# test on empty
|
|
try:
|
|
response = completion(model=model_val, messages=messages)
|
|
except Exception as e:
|
|
print(f"error occurred: {e}")
|
|
pass
|