FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(litellm): Guard against module shadowing by alexander-alderman-webb · Pull Request #5249 · getsentry/sentry-python · GitHub

7 changes: 4 additions & 3 deletions sentry_sdk/integrations/litellm.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

try:
import litellm # type: ignore[import-not-found]
from litellm import input_callback, success_callback, failure_callback
except ImportError:
raise DidNotEnable("LiteLLM not installed")

Expand Down Expand Up @@ -278,14 +279,14 @@ def __init__(self: "LiteLLMIntegration", include_prompts: bool = True) -> None:
@staticmethod
def setup_once() -> None:
"""Set up LiteLLM callbacks for monitoring."""
litellm.input_callback = litellm.input_callback or []
litellm.input_callback = input_callback or []
if _input_callback not in litellm.input_callback:
litellm.input_callback.append(_input_callback)

litellm.success_callback = litellm.success_callback or []
litellm.success_callback = success_callback or []
if _success_callback not in litellm.success_callback:
litellm.success_callback.append(_success_callback)

litellm.failure_callback = litellm.failure_callback or []
litellm.failure_callback = failure_callback or []
if _failure_callback not in litellm.failure_callback:
litellm.failure_callback.append(_failure_callback)
Comment thread
alexander-alderman-webb marked this conversation as resolved.
Comment thread
alexander-alderman-webb marked this conversation as resolved.
6 changes: 1 addition & 5 deletions tests/test_shadowed_module.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ def pytest_generate_tests(metafunc):

metafunc.parametrize(
"integration_submodule_name",
# Temporarily skip some integrations
submodule_names
- {
"litellm",
},
submodule_names,
)


Expand Down
Loading

Back | FazBrowse Home | New Git URL