From 61441744014662f2b0c407a96191ea9402a408ff Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 2 Oct 2026 18:29:07 +0000 Subject: [PATCH] fix(proxy): flatten remaining callbacks with a helper generator Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/proxy/proxy_server.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 9d7cfca5940..003e8ae7af0 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -22,6 +22,7 @@ from collections.abc import ( Awaitable, Callable, Collection, + Iterator, Mapping, MutableMapping, Sequence, @@ -19004,6 +19005,11 @@ def _configured_callback_names(value: object) -> tuple[object, ...]: return () +def _remaining_callback_names(settings: Mapping[str, object]) -> Iterator[object]: + for key in _CALLBACK_LIST_KEYS: + yield from _configured_callback_names(settings.get(key)) + + def _is_callback_name(entry: object, callback_name: str) -> bool: return isinstance(entry, str) and entry.lower() == callback_name @@ -19090,9 +19096,7 @@ async def delete_callback( return { "message": f"Successfully deleted callback: {callback_name}", "removed_callback": callback_name, - "remaining_callbacks": [ - entry for key in _CALLBACK_LIST_KEYS for entry in _configured_callback_names(updated_settings.get(key)) - ], + "remaining_callbacks": list(_remaining_callback_names(updated_settings)), "deleted_at": datetime.now().isoformat(), }