From 46d5aae2ae4e67f314ff24463509ae05d6edafae Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Thu, 21 Nov 2024 21:27:19 -0800 Subject: [PATCH] add testing for spend logs payload --- .../anthropic_passthrough_logging_handler.py | 2 ++ tests/pass_through_tests/test_anthropic_passthrough.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.py b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.py index 314f68e87..35cff0db3 100644 --- a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.py +++ b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.py @@ -118,6 +118,8 @@ class AnthropicPassthroughLoggingHandler: # set litellm_call_id to logging response object litellm_model_response.id = logging_obj.litellm_call_id + litellm_model_response.model = model + logging_obj.model_call_details["model"] = model return kwargs @staticmethod diff --git a/tests/pass_through_tests/test_anthropic_passthrough.py b/tests/pass_through_tests/test_anthropic_passthrough.py index 277adcdb9..b062a025a 100644 --- a/tests/pass_through_tests/test_anthropic_passthrough.py +++ b/tests/pass_through_tests/test_anthropic_passthrough.py @@ -150,6 +150,8 @@ async def test_anthropic_basic_completion_with_headers(): "user_api_key" in log_entry["metadata"] ), "Should have user API key in metadata" + assert "claude" in log_entry["model"] + @pytest.mark.asyncio async def test_anthropic_streaming_with_headers(): @@ -257,3 +259,5 @@ async def test_anthropic_streaming_with_headers(): assert ( "user_api_key" in log_entry["metadata"] ), "Should have user API key in metadata" + + assert "claude" in log_entry["model"]