From dc71eb12e339dae8ebc265e57b9ce7520ccf8252 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Thu, 6 Nov 2025 17:08:53 -0800 Subject: [PATCH] fix _get_spend_logs_metadata --- litellm/proxy/spend_tracking/spend_tracking_utils.py | 2 +- tests/guardrails_tests/test_tracing_guardrails.py | 2 ++ tests/test_litellm/litellm_core_utils/test_litellm_logging.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/litellm/proxy/spend_tracking/spend_tracking_utils.py b/litellm/proxy/spend_tracking/spend_tracking_utils.py index 02adcac0ec..303f001650 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 edd7369933..ec240482d2 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 6c306ea690..64f3a652ba 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", )