Skip to content

Commit e8fdf9e

Browse files
authored
Fix litellm max callbacks override (#180)
1 parent ca1a7b2 commit e8fdf9e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/data_designer/engine/models/litellm_overrides.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import litellm
1111
from litellm import RetryPolicy
1212
from litellm.caching.in_memory_cache import InMemoryCache
13+
from litellm.litellm_core_utils.logging_callback_manager import LoggingCallbackManager
1314
from litellm.router import Router
1415
from pydantic import BaseModel, Field
1516
from typing_extensions import override
@@ -154,7 +155,7 @@ def apply_litellm_patches():
154155
litellm.in_memory_llm_clients_cache = ThreadSafeCache()
155156

156157
# Workaround for the litellm issue described in https://github.com/BerriAI/litellm/issues/9792
157-
litellm.litellm_core_utils.logging_callback_manager.LoggingCallbackManager.MAX_CALLBACKS = DEFAULT_MAX_CALLBACKS
158+
LoggingCallbackManager.MAX_CALLBACKS = DEFAULT_MAX_CALLBACKS
158159

159160
quiet_noisy_logger("httpx")
160161
quiet_noisy_logger("LiteLLM")

tests/engine/models/test_litellm_overrides.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ def test_custom_router_calculate_exponential_backoff(retry_count: int, jitter: f
4747
)
4848

4949

50+
def test_apply_litellm_patches_no_exceptions():
51+
try:
52+
apply_litellm_patches()
53+
except Exception as e:
54+
pytest.fail(f"apply_litellm_patches() raised an unexpected exception: {e}")
55+
56+
5057
@patch("data_designer.engine.models.litellm_overrides.quiet_noisy_logger", autospec=True)
5158
def test_apply_litellm_patches(mock_quiet_noisy_logger):
5259
apply_litellm_patches()

0 commit comments

Comments
 (0)