mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
only show error log dashboard on fail
This commit is contained in:
parent
fc10cf5eeb
commit
2ba8e9bc02
1 changed files with 22 additions and 22 deletions
|
@ -1881,31 +1881,31 @@ def exception_type(
|
|||
global user_logger_fn, liteDebuggerClient
|
||||
exception_mapping_worked = False
|
||||
|
||||
litellm.error_logs['EXCEPTION'] = original_exception
|
||||
litellm.error_logs['KWARGS'] = completion_kwargs
|
||||
if litellm.set_verbose == True:
|
||||
litellm.error_logs['EXCEPTION'] = original_exception
|
||||
litellm.error_logs['KWARGS'] = completion_kwargs
|
||||
try:
|
||||
# code to show users their litellm error dashboard
|
||||
import urllib.parse
|
||||
import json
|
||||
for log_key in litellm.error_logs:
|
||||
current_logs = litellm.error_logs[log_key]
|
||||
if type(current_logs) == dict:
|
||||
filtered_error_logs = {key: str(value) for key, value in current_logs.items()}
|
||||
litellm.error_logs[log_key] = filtered_error_logs
|
||||
else:
|
||||
litellm.error_logs[log_key] = str(current_logs)
|
||||
|
||||
import urllib.parse
|
||||
import json
|
||||
for log_key in litellm.error_logs:
|
||||
current_logs = litellm.error_logs[log_key]
|
||||
if type(current_logs) == dict:
|
||||
filtered_error_logs = {key: value for key, value in current_logs.items() if isinstance(value, (str, int, float, bool, list, dict))}
|
||||
litellm.error_logs[log_key] = filtered_error_logs
|
||||
else:
|
||||
litellm.error_logs[log_key] = str(current_logs)
|
||||
# Convert the filtered_error_logs dictionary to a JSON string
|
||||
error_logs_json = json.dumps(litellm.error_logs)
|
||||
# URL-encode the JSON data
|
||||
encoded_data = urllib.parse.quote(error_logs_json)
|
||||
|
||||
# Convert the filtered_error_logs dictionary to a JSON string
|
||||
error_logs_json = json.dumps(litellm.error_logs)
|
||||
# URL-encode the JSON data
|
||||
encoded_data = urllib.parse.quote(error_logs_json)
|
||||
print(encoded_data)
|
||||
# Print the encoded data (this is what you can include in a URL)
|
||||
print("\033[91m" + str(litellm.error_logs) + "\033[0m")
|
||||
print("👉 view error logs:")
|
||||
print("\033[91m" + '\033[4m' + 'https://logs.litellm.ai/?data=' + str(encoded_data) + "\033[0m")
|
||||
|
||||
decoded_data = urllib.parse.unquote(encoded_data)
|
||||
|
||||
# Print the decoded data
|
||||
print(decoded_data)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
if isinstance(original_exception, OriginalError):
|
||||
# Handle the OpenAIError
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue