diff --git a/litellm/router.py b/litellm/router.py index b345a2f25..f1e590545 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -1444,6 +1444,9 @@ class Router: response = await self.async_function_with_retries( *args, **kwargs ) + verbose_router_logger.info( + "Successful fallback b/w models." + ) return response except Exception as e: pass @@ -1478,6 +1481,9 @@ class Router: response = await self.async_function_with_fallbacks( *args, **kwargs ) + verbose_router_logger.info( + "Successful fallback b/w models." + ) return response except Exception as e: raise e diff --git a/litellm/tests/test_router_debug_logs.py b/litellm/tests/test_router_debug_logs.py index 202038d97..1d908abe8 100644 --- a/litellm/tests/test_router_debug_logs.py +++ b/litellm/tests/test_router_debug_logs.py @@ -85,6 +85,7 @@ def test_async_fallbacks(caplog): "litellm.acompletion(model=gpt-3.5-turbo)\x1b[31m Exception OpenAIException - Error code: 401 - {'error': {'message': 'Incorrect API key provided: bad-key. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}} \nModel: gpt-3.5-turbo\nAPI Base: https://api.openai.com\nMessages: [{'content': 'Hello, how are you?', 'role': 'user'}]\nmodel_group: gpt-3.5-turbo\n\ndeployment: gpt-3.5-turbo\n\x1b[0m", "Falling back to model_group = azure/gpt-3.5-turbo", "litellm.acompletion(model=azure/chatgpt-v-2)\x1b[32m 200 OK\x1b[0m", + "Successful fallback b/w models.", ] # Assert that the captured logs match the expected log messages