diff --git a/litellm/tests/test_aamazing_proxy_custom_logger.py b/litellm/tests/test_aamazing_proxy_custom_logger.py index 7ae3baec69..84883776e1 100644 --- a/litellm/tests/test_aamazing_proxy_custom_logger.py +++ b/litellm/tests/test_aamazing_proxy_custom_logger.py @@ -62,9 +62,11 @@ def test_embedding(client): my_custom_logger = litellm.callbacks[0] for callback in litellm.callbacks: - if "MyCustomHandler" in str(callback): + if "testCustomCallbackProxy" in str(callback): my_custom_logger = callback break + print("LiteLLM Callbacks", litellm.callbacks) + print("my_custom_logger", my_custom_logger) assert my_custom_logger.async_success_embedding == False test_data = { @@ -73,6 +75,8 @@ def test_embedding(client): } response = client.post("/embeddings", json=test_data, headers=headers) print("made request", response.status_code, response.text) + print("LiteLLM Callbacks", litellm.callbacks) + print("my_custom_logger", my_custom_logger) assert my_custom_logger.async_success_embedding == True # checks if the status of async_success is True, only the async_log_success_event can set this to true assert my_custom_logger.async_embedding_kwargs["model"] == "azure-embedding-model" # checks if kwargs passed to async_log_success_event are correct @@ -103,9 +107,11 @@ def test_chat_completion(client): # assert len(litellm.callbacks) == 1 # assert litellm is initialized with 1 callback my_custom_logger = litellm.callbacks[0] for callback in litellm.callbacks: - if "MyCustomHandler" in str(callback): + if "testCustomCallbackProxy" in str(callback): my_custom_logger = callback break + print("LiteLLM Callbacks", litellm.callbacks) + print("my_custom_logger", my_custom_logger) assert my_custom_logger.async_success == False test_data = { @@ -122,6 +128,8 @@ def test_chat_completion(client): response = client.post("/chat/completions", json=test_data, headers=headers) print("made request", response.status_code, response.text) + print("LiteLLM Callbacks", litellm.callbacks) + print("my_custom_logger", my_custom_logger) assert my_custom_logger.async_success == True # checks if the status of async_success is True, only the async_log_success_event can set this to true assert my_custom_logger.async_completion_kwargs["model"] == "chatgpt-v-2" # checks if kwargs passed to async_log_success_event are correct print("\n\n Custom Logger Async Completion args", my_custom_logger.async_completion_kwargs) @@ -153,11 +161,15 @@ def test_chat_completion_stream(client): # assert len(litellm.callbacks) == 1 # assert litellm is initialized with 1 callback my_custom_logger = litellm.callbacks[0] + for callback in litellm.callbacks: - if "MyCustomHandler" in str(callback): + if "testCustomCallbackProxy" in str(callback): my_custom_logger = callback break + print("LiteLLM Callbacks", litellm.callbacks) + print("my_custom_logger", my_custom_logger) + assert my_custom_logger.streaming_response_obj == None # no streaming response obj is set pre call test_data = { diff --git a/litellm/tests/test_configs/custom_callbacks.py b/litellm/tests/test_configs/custom_callbacks.py index 71f74bbc2d..a415fe5e49 100644 --- a/litellm/tests/test_configs/custom_callbacks.py +++ b/litellm/tests/test_configs/custom_callbacks.py @@ -2,7 +2,7 @@ from litellm.integrations.custom_logger import CustomLogger import inspect import litellm -class MyCustomHandler(CustomLogger): +class testCustomCallbackProxy(CustomLogger): def __init__(self): self.success: bool = False # type: ignore self.failure: bool = False # type: ignore @@ -107,4 +107,4 @@ class MyCustomHandler(CustomLogger): self.async_completion_kwargs_fail = kwargs -my_custom_logger = MyCustomHandler() \ No newline at end of file +my_custom_logger = testCustomCallbackProxy() \ No newline at end of file diff --git a/litellm/tests/test_router_get_deployments.py b/litellm/tests/test_router_get_deployments.py index 3e6bbd2b6e..f9ca124c26 100644 --- a/litellm/tests/test_router_get_deployments.py +++ b/litellm/tests/test_router_get_deployments.py @@ -326,7 +326,7 @@ def test_model_group_aliases(): selected_model = router.get_available_deployment("gpt-4") print("\n selected model", selected_model) selected_model_name = selected_model.get("model_name") - if selected_model_name is not "gpt-3.5-turbo": + if selected_model_name != "gpt-3.5-turbo": pytest.fail(f"Selected model {selected_model_name} is not gpt-3.5-turbo") router.reset()