refactor: instrument 'dynamic_rate_limiting' callback on proxy

This commit is contained in:
Krrish Dholakia 2024-06-22 00:32:29 -07:00
parent 068e8dff5b
commit 532f24bfb7
8 changed files with 136 additions and 28 deletions

View file

@ -340,14 +340,15 @@ def function_setup(
)
try:
global callback_list, add_breadcrumb, user_logger_fn, Logging
function_id = kwargs["id"] if "id" in kwargs else None
if len(litellm.callbacks) > 0:
for callback in litellm.callbacks:
# check if callback is a string - e.g. "lago", "openmeter"
if isinstance(callback, str):
callback = litellm.litellm_core_utils.litellm_logging._init_custom_logger_compatible_class(
callback
callback = litellm.litellm_core_utils.litellm_logging._init_custom_logger_compatible_class( # type: ignore
callback, internal_usage_cache=None, llm_router=None
)
if any(
isinstance(cb, type(callback))