diff --git a/litellm/tests/test_custom_logger.py b/litellm/tests/test_custom_logger.py index 333293596dc..0702cb52c22 100644 --- a/litellm/tests/test_custom_logger.py +++ b/litellm/tests/test_custom_logger.py @@ -142,8 +142,8 @@ def test_async_custom_handler(): assert len(str(customHandler2.async_completion_kwargs_fail.get("exception"))) > 10 # exppect APIError("OpenAIException - Error code: 401 - {'error': {'message': 'Incorrect API key provided: test. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}"), 'traceback_exception': 'Traceback (most recent call last):\n File "/Users/ishaanjaffer/Github/litellm/litellm/llms/openai.py", line 269, in acompletion\n response = await openai_aclient.chat.completions.create(**data)\n File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/openai/resources/chat/completions.py", line 119 print("Passed setting async failure") - def test_2(): - response = litellm.completion( + async def test_2(): + response = await litellm.acompletion( model="gpt-3.5-turbo", messages=[{ "role": "user", @@ -152,7 +152,7 @@ def test_async_custom_handler(): ) print("\n response", response) assert customHandler2.async_success == False - test_2() + asyncio.run(test_2()) assert customHandler2.async_success == True, "async success is not set to True even after success" assert customHandler2.async_completion_kwargs.get("model") == "gpt-3.5-turbo"