mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
(test) sentry callback
This commit is contained in:
parent
1d955e7b07
commit
933cc235c3
1 changed files with 36 additions and 0 deletions
36
litellm/tests/test_sentry.py
Normal file
36
litellm/tests/test_sentry.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import sys
|
||||
import os
|
||||
import io
|
||||
|
||||
sys.path.insert(0, os.path.abspath('../..'))
|
||||
|
||||
from litellm import completion
|
||||
import litellm
|
||||
|
||||
litellm.failure_callback = ["sentry"]
|
||||
|
||||
import time
|
||||
|
||||
def test_exception_tracking():
|
||||
litellm.set_verbose=True
|
||||
os.environ["OPENAI_API_KEY"] = "ss"
|
||||
try:
|
||||
response = completion(model="gpt-3.5-turbo",
|
||||
messages=[{
|
||||
"role": "user",
|
||||
"content": "Hi 👋 - i'm claude"
|
||||
}],
|
||||
max_tokens=10,
|
||||
temperature=0.2
|
||||
)
|
||||
print(response)
|
||||
except Exception as e:
|
||||
print("got_exception")
|
||||
print(e)
|
||||
|
||||
test_exception_tracking()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Reference in a new issue