Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

test: add unit test

Krrish Dholakia75722c4b1375
diff --git a/tests/litellm/litellm_core_utils/test_litellm_logging.py b/tests/litellm/litellm_core_utils/test_litellm_logging.py
new file mode 100644
index 00000000000..eedc15dd362
--- /dev/null
+++ b/tests/litellm/litellm_core_utils/test_litellm_logging.py
@@ -0,0 +1,34 @@
+import json
+import os
+import sys
+from unittest.mock import MagicMock, patch
+
+import pytest
+
+sys.path.insert(
+ 0, os.path.abspath("../../..")
+) # Adds the parent directory to the system path
+
+import time
+
+from litellm.litellm_core_utils.litellm_logging import Logging as LitellmLogging
+
+
+def logging_obj():
+ return LitellmLogging(
+ model="bedrock/claude-3-5-sonnet-20240620-v1:0",
+ messages=[{"role": "user", "content": "Hey"}],
+ stream=True,
+ call_type="completion",
+ start_time=time.time(),
+ litellm_call_id="12345",
+ function_id="1245",
+ )
+
+
+def test_get_masked_api_base(logging_obj):
+ api_base = "https://api.openai.com/v1"
+ masked_api_base = logging_obj._get_masked_api_base(api_base)
+ assert masked_api_base == "https://api.openai.com/v1"
+ assert type(masked_api_base) == str