mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
fix(main.py): removing print_verbose
This commit is contained in:
parent
c04cad208c
commit
3743893e76
3 changed files with 22 additions and 65 deletions
|
@ -416,9 +416,6 @@ def completion(
|
||||||
or None # default - https://github.com/openai/openai-python/blob/284c1799070c723c6a553337134148a7ab088dd8/openai/util.py#L105
|
or None # default - https://github.com/openai/openai-python/blob/284c1799070c723c6a553337134148a7ab088dd8/openai/util.py#L105
|
||||||
)
|
)
|
||||||
# set API KEY
|
# set API KEY
|
||||||
print_verbose(
|
|
||||||
f"api_key: {api_key}; dynamic_api_key: {dynamic_api_key}; litellm.api_key: {litellm.api_key}; litellm.openai_key: {litellm.openai_key}; os.environ['OPENAI_API_KEY']: {os.environ['OPENAI_API_KEY']}"
|
|
||||||
)
|
|
||||||
api_key = (
|
api_key = (
|
||||||
api_key or
|
api_key or
|
||||||
dynamic_api_key or # allows us to read env variables for compatible openai api's like perplexity
|
dynamic_api_key or # allows us to read env variables for compatible openai api's like perplexity
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
#### What this tests ####
|
# #### What this tests ####
|
||||||
# This tests if logging to the helicone integration actually works
|
# # This tests if logging to the helicone integration actually works
|
||||||
|
|
||||||
import sys, os
|
# import sys, os
|
||||||
import traceback
|
# import traceback
|
||||||
import pytest
|
# import pytest
|
||||||
|
|
||||||
sys.path.insert(
|
# sys.path.insert(
|
||||||
0, os.path.abspath("../..")
|
# 0, os.path.abspath("../..")
|
||||||
) # Adds the parent directory to the system path
|
# ) # Adds the parent directory to the system path
|
||||||
import litellm
|
# import litellm
|
||||||
from litellm import embedding, completion
|
# from litellm import embedding, completion
|
||||||
|
|
||||||
litellm.success_callback = ["helicone"]
|
# litellm.success_callback = ["helicone"]
|
||||||
|
|
||||||
litellm.set_verbose = True
|
# litellm.set_verbose = True
|
||||||
|
|
||||||
user_message = "Hello, how are you?"
|
# user_message = "Hello, how are you?"
|
||||||
messages = [{"content": user_message, "role": "user"}]
|
# messages = [{"content": user_message, "role": "user"}]
|
||||||
|
|
||||||
|
|
||||||
# openai call
|
# # openai call
|
||||||
response = completion(
|
# response = completion(
|
||||||
model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Hi 👋 - i'm openai"}]
|
# model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Hi 👋 - i'm openai"}]
|
||||||
)
|
# )
|
||||||
|
|
||||||
# cohere call
|
# # cohere call
|
||||||
response = completion(
|
# response = completion(
|
||||||
model="command-nightly", messages=[{"role": "user", "content": "Hi 👋 - i'm cohere"}]
|
# model="command-nightly", messages=[{"role": "user", "content": "Hi 👋 - i'm cohere"}]
|
||||||
)
|
# )
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
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():
|
|
||||||
print('expect this to fail and log to sentry')
|
|
||||||
litellm.set_verbose=True
|
|
||||||
old_api_key = os.environ["OPENAI_API_KEY"]
|
|
||||||
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)
|
|
||||||
os.environ["OPENAI_API_KEY"] = old_api_key
|
|
||||||
except Exception as e:
|
|
||||||
print("got_exception")
|
|
||||||
print(e)
|
|
||||||
os.environ["OPENAI_API_KEY"] = old_api_key
|
|
||||||
|
|
||||||
test_exception_tracking()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue