From bd5d4472313727e1859a29c555979cbc3faead41 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Mon, 26 Feb 2024 07:36:15 -0800 Subject: [PATCH] (test) clickhouse callback --- litellm/tests/test_clickhouse_logger.py | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 litellm/tests/test_clickhouse_logger.py diff --git a/litellm/tests/test_clickhouse_logger.py b/litellm/tests/test_clickhouse_logger.py new file mode 100644 index 00000000000..ab9a72a3806 --- /dev/null +++ b/litellm/tests/test_clickhouse_logger.py @@ -0,0 +1,38 @@ +import sys +import os +import io, asyncio + +# import logging +# logging.basicConfig(level=logging.DEBUG) +sys.path.insert(0, os.path.abspath("../..")) +print("Modified sys.path:", sys.path) + + +from litellm import completion +import litellm + +litellm.num_retries = 3 + +import time, random +import pytest + + +@pytest.mark.asyncio +async def test_custom_api_logging(): + try: + litellm.success_callback = ["clickhouse"] + litellm.set_verbose = True + await litellm.acompletion( + model="gpt-3.5-turbo", + messages=[{"role": "user", "content": f"This is a test"}], + max_tokens=10, + temperature=0.7, + user="ishaan-2", + ) + + except Exception as e: + pytest.fail(f"An exception occurred - {e}") + finally: + # post, close log file and verify + # Reset stdout to the original value + print("Passed!")