From 0ba0ca6896f307f1b4e75821036c4e53eb70910f Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Fri, 18 Aug 2023 06:20:16 -0700 Subject: [PATCH] automatically log data to sentry if it's present in the environment variables --- litellm/__pycache__/utils.cpython-311.pyc | Bin 48799 -> 48767 bytes .../tests/test_model_response_typing/test.py | 2 +- litellm/utils.py | 4 ++-- pyproject.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/litellm/__pycache__/utils.cpython-311.pyc b/litellm/__pycache__/utils.cpython-311.pyc index c4e28b05a5c266aa65dc92d1dc5bfcf64aa7d6f7..b872895f9865e6836b2f8d31cc4383376dc91729 100644 GIT binary patch delta 378 zcmWNM+bg7D0EhkF`Mz(*CnpP*R21`liC4uk!E%?qdPooVt40Nmz0 zfKnbzyb`FE_rVle12;eo?}L9#(ar0bHQ+5LX4?fmGd47!!pGt8h$&j*h}aZ_`R-eq OiX7IhUxFVuJf{EXV2Dlt delta 430 zcmYk2O-NL60L0(?--o-KFN5`~HkC5e6?{D5!YYLJ2(x_CN&fvMm(Y2N*0K zinc#R3Aq~LR;1{Tmo+>n3VDdc0znU9&_z@N>7cmOJ2uR5_%Sno4@Dv)%%o|06i17l zKkT-+c^vuE4titX+#>ML$9hQcAZG$ZJQA~o`;t5UA&cTvM;V-C0~-L4p}Fz&i0 z(7VrgBiuQa7DzF9=DNVVJSh8u zCHc9$2Xj1EaR*pt(tiT@&V|Z=h7ImpK7j=D&UOnN@c#K*Dzdm4s1hh)PVf;>#%Gs4 z=&0r8T3g2iN9u#XIM*9GJV-MT?(kxp&+VVbaFfyKsDT%-{lclwA*6+(>dN zR%qZ4m!J4GWVjbE&``=FFE0vQkfB#=4&V3s9T4K;&}o4txjTH4>YFW~mAk{+sxx!r zZ3?L7)3MtE_m~-ftQ&)>^WQ^h%@i{6F{(PX@}|5RCh4Ck(NV|7^e^NpuvV0+|NUE| I^(n0W1MN?h`2YX_ diff --git a/litellm/tests/test_model_response_typing/test.py b/litellm/tests/test_model_response_typing/test.py index c1620e9412..12d2b259b3 100644 --- a/litellm/tests/test_model_response_typing/test.py +++ b/litellm/tests/test_model_response_typing/test.py @@ -3,7 +3,7 @@ # BASE_URL = 'http://localhost:8080' # def test_hello_route(): -# data = {"model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "hey, how's it going?"}]} +# data = {"model": "claude-instant-1", "messages": [{"role": "user", "content": "hey, how's it going?"}]} # headers = {'Content-Type': 'application/json'} # response = requests.get(BASE_URL, headers=headers, data=json.dumps(data)) # print(response.text) diff --git a/litellm/utils.py b/litellm/utils.py index 8646037680..b45418933e 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -440,7 +440,7 @@ def set_callbacks(callback_list): global sentry_sdk_instance, capture_exception, add_breadcrumb, posthog, slack_app, alerts_channel, heliconeLogger, aispendLogger, berrispendLogger, supabaseClient try: for callback in callback_list: - if callback == "sentry": + if callback == "sentry" or "SENTRY_API_URL" in os.environ: try: import sentry_sdk except ImportError: @@ -449,7 +449,7 @@ def set_callbacks(callback_list): import sentry_sdk sentry_sdk_instance = sentry_sdk sentry_trace_rate = os.environ.get("SENTRY_API_TRACE_RATE") if "SENTRY_API_TRACE_RATE" in os.environ else "1.0" - sentry_sdk_instance.init(dsn=os.environ.get("SENTRY_API_URL"), traces_sample_rate=float(os.environ.get("SENTRY_API_TRACE_RATE"))) + sentry_sdk_instance.init(dsn=os.environ.get("SENTRY_API_URL"), traces_sample_rate=float(sentry_trace_rate)) capture_exception = sentry_sdk_instance.capture_exception add_breadcrumb = sentry_sdk_instance.add_breadcrumb elif callback == "posthog": diff --git a/pyproject.toml b/pyproject.toml index 4c1b088a69..dab74454d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "litellm" -version = "0.1.424" +version = "0.1.425" description = "Library to easily interface with LLM API providers" authors = ["BerriAI"] license = "MIT License"