diff --git a/litellm/main.py b/litellm/main.py index b62cb78cf..dd1fdb9f9 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -475,11 +475,13 @@ def mock_completion( except Exception: # dont let setting a hidden param block a mock_respose pass - logging.post_call( - input=messages, - api_key="my-secret-key", - original_response="my-original-response", - ) + + if logging is not None: + logging.post_call( + input=messages, + api_key="my-secret-key", + original_response="my-original-response", + ) return model_response except Exception as e: