forked from phoenix/litellm-mirror
adding litedebugger dashboard url in print statements
This commit is contained in:
parent
9922e1032f
commit
dab594ed0c
3 changed files with 9 additions and 3 deletions
|
@ -2,6 +2,7 @@ import requests, traceback, json, os
|
|||
|
||||
class LiteDebugger:
|
||||
user_email = None
|
||||
dashboard_url = None
|
||||
def __init__(self):
|
||||
self.api_url = "https://api.litellm.ai/debugger"
|
||||
self.validate_environment()
|
||||
|
@ -10,7 +11,8 @@ class LiteDebugger:
|
|||
def validate_environment(self):
|
||||
try:
|
||||
self.user_email = os.getenv("LITELLM_EMAIL")
|
||||
print(f"Here's your free Dashboard 👉 {'https://admin.litellm.ai/' + self.user_email}")
|
||||
self.dashboard_url = 'https://admin.litellm.ai/' + self.user_email
|
||||
print(f"Here's your free Dashboard 👉 {self.dashboard_url}")
|
||||
if self.user_email == None:
|
||||
raise Exception("[Non-Blocking Error] LiteLLMDebugger: Missing LITELLM_EMAIL. Set it in your environment. Eg.: os.environ['LITELLM_EMAIL']= <your_email>")
|
||||
except Exception as e:
|
||||
|
|
|
@ -280,6 +280,7 @@ def exception_logging(
|
|||
####### CLIENT ###################
|
||||
# make it easy to log if completion/embedding runs succeeded or failed + see what happened | Non-Blocking
|
||||
def client(original_function):
|
||||
global liteDebuggerClient
|
||||
def function_setup(
|
||||
*args, **kwargs
|
||||
): # just run once to check if user wants to send their data anywhere - PostHog/Sentry/Slack/etc.
|
||||
|
@ -410,6 +411,9 @@ def client(original_function):
|
|||
args=(e, traceback_exception, start_time, end_time, args, kwargs),
|
||||
) # don't interrupt execution of main thread
|
||||
my_thread.start()
|
||||
if hasattr(e, "message"):
|
||||
if liteDebuggerClient and liteDebuggerClient.dashboard_url != None: # make it easy to get to the debugger logs if you've initialized it
|
||||
e.message += f"\n Check the log in your dashboard - {liteDebuggerClient.dashboard_url}"
|
||||
raise e
|
||||
|
||||
return wrapper
|
||||
|
@ -1027,7 +1031,7 @@ def modify_integration(integration_name, integration_params):
|
|||
|
||||
|
||||
def exception_type(model, original_exception, custom_llm_provider):
|
||||
global user_logger_fn
|
||||
global user_logger_fn, liteDebuggerClient
|
||||
exception_mapping_worked = False
|
||||
try:
|
||||
if isinstance(original_exception, OriginalError):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "litellm"
|
||||
version = "0.1.439"
|
||||
version = "0.1.440"
|
||||
description = "Library to easily interface with LLM API providers"
|
||||
authors = ["BerriAI"]
|
||||
license = "MIT License"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue