-
Notifications
You must be signed in to change notification settings - Fork 569
fix(litellm): Guard against module shadowing #5249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
bacb63b
c5c81ad
88f2478
8637b1b
e24f7c2
9939e78
fce4a67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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") | ||
|
|
||
|
|
@@ -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 on lines
+282
to
292
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: User-configured LiteLLM callbacks are overwritten during Sentry initialization if they are set before 🔍 Detailed AnalysisThe change imports 💡 Suggested FixIn 🤖 Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fair point, but by design |
||
Uh oh!
There was an error while loading. Please reload this page.