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]

fix _get_spend_logs_metadata

Ishaan Jafferdc71eb12e339
diff --git a/litellm/proxy/spend_tracking/spend_tracking_utils.py b/litellm/proxy/spend_tracking/spend_tracking_utils.py
index 02adcac0eca..303f0016503 100644
--- a/litellm/proxy/spend_tracking/spend_tracking_utils.py
+++ b/litellm/proxy/spend_tracking/spend_tracking_utils.py
@@ -51,7 +51,7 @@ def _get_spend_logs_metadata(
vector_store_request_metadata: Optional[
List[StandardLoggingVectorStoreRequest]
] = None,
- guardrail_information: Optional[list[StandardLoggingGuardrailInformation]] = None,
+ guardrail_information: Optional[List[StandardLoggingGuardrailInformation]] = None,
usage_object: Optional[dict] = None,
model_map_information: Optional[StandardLoggingModelInformation] = None,
cold_storage_object_key: Optional[str] = None,
diff --git a/tests/guardrails_tests/test_tracing_guardrails.py b/tests/guardrails_tests/test_tracing_guardrails.py
index edd7369933f..ec240482d2e 100644
--- a/tests/guardrails_tests/test_tracing_guardrails.py
+++ b/tests/guardrails_tests/test_tracing_guardrails.py
@@ -465,6 +465,7 @@ async def test_noma_guardrail_status_blocked():
mock_response.status_code = 200
mock_response.json.return_value = {
"verdict": False,
+ "aggregatedScanResult": True,
"originalResponse": {
"prompt": {
"topicDetector": {"harmful": {"result": True}}
@@ -549,6 +550,7 @@ async def test_noma_guardrail_status_success():
mock_response.status_code = 200
mock_response.json.return_value = {
"verdict": True,
+ "aggregatedScanResult": False,
"originalResponse": {"prompt": {}}
}
mock_response.raise_for_status = MagicMock()
diff --git a/tests/test_litellm/litellm_core_utils/test_litellm_logging.py b/tests/test_litellm/litellm_core_utils/test_litellm_logging.py
index 6c306ea690c..64f3a652ba6 100644
--- a/tests/test_litellm/litellm_core_utils/test_litellm_logging.py
+++ b/tests/test_litellm/litellm_core_utils/test_litellm_logging.py
@@ -682,7 +682,7 @@ async def test_e2e_generate_cold_storage_object_key_with_logger_no_s3_path():
# Verify the S3 function was called with empty s3_path (fallback)
mock_get_s3_key.assert_called_once_with(
s3_path="", # Should fall back to empty string
- team_alias_prefix="",
+ prefix="",
start_time=start_time,
s3_file_name="time-10-30-45-123456_chatcmpl-test-12345",
)