mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
cleaning up client, and fixing replicate bug
This commit is contained in:
parent
22374705b0
commit
745252e3bf
6 changed files with 216 additions and 186 deletions
25
litellm/tests/test_model_fallback.py
Normal file
25
litellm/tests/test_model_fallback.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
import sys, os
|
||||
import traceback
|
||||
sys.path.append('..') # Adds the parent directory to the system path
|
||||
import main
|
||||
from main import embedding, completion
|
||||
main.success_callback = ["posthog"]
|
||||
main.failure_callback = ["slack", "sentry", "posthog"]
|
||||
|
||||
main.set_verbose = True
|
||||
|
||||
model_fallback_list = ["replicate/llama-2-70b-chat:2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1", "claude-instant-1", "gpt-3.5-turbo"]
|
||||
|
||||
user_message = "Hello, how are you?"
|
||||
messages = [{ "content": user_message,"role": "user"}]
|
||||
|
||||
# for _ in range(10):
|
||||
for model in model_fallback_list:
|
||||
try:
|
||||
response = completion(model=model, messages=messages)
|
||||
print(response)
|
||||
if response != None:
|
||||
break
|
||||
except:
|
||||
print(f"error occurred: {traceback.format_exc()}")
|
||||
pass
|
Loading…
Add table
Add a link
Reference in a new issue