From 7cc63a77c6a57784b394880cf0f3c7e5c4967863 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Sat, 25 May 2024 17:23:37 -0700 Subject: [PATCH] fix - router debug logs --- litellm/tests/test_router_debug_logs.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/litellm/tests/test_router_debug_logs.py b/litellm/tests/test_router_debug_logs.py index cde9a8edd..c01b6eecb 100644 --- a/litellm/tests/test_router_debug_logs.py +++ b/litellm/tests/test_router_debug_logs.py @@ -54,11 +54,11 @@ def test_async_fallbacks(caplog): async def _make_request(): try: - response = await router.acompletion( + await router.acompletion( model="gpt-3.5-turbo", messages=messages, max_tokens=1 ) router.reset() - except litellm.Timeout as e: + except litellm.Timeout: pass except Exception as e: pytest.fail(f"An exception occurred: {e}") @@ -68,8 +68,7 @@ def test_async_fallbacks(caplog): asyncio.run(_make_request()) captured_logs = [rec.message for rec in caplog.records] - # on circle ci the captured logs get some async task exception logs - filter them out - "Task exception was never retrieved" + # on circle ci the captured logs get some async task exception logs - filter them out "Task exception was never retrieved" captured_logs = [ log for log in captured_logs @@ -82,7 +81,7 @@ def test_async_fallbacks(caplog): # Define the expected log messages # - error request, falling back notice, success notice expected_logs = [ - "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'}}\x1b[0m", + "litellm.acompletion(model=gpt-3.5-turbo)\x1b[31m Exception AuthenticationError: 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'}}\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.",