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 testing

Krrish Dholakia81a1494a51af
diff --git a/tests/litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py b/tests/litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py
new file mode 100644
index 00000000000..04f2728284d
--- /dev/null
+++ b/tests/litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py
@@ -0,0 +1,35 @@
+import json
+import os
+import sys
+
+import pytest
+from fastapi.testclient import TestClient
+
+sys.path.insert(
+ 0, os.path.abspath("../../../../..")
+) # Adds the parent directory to the system path
+from unittest.mock import MagicMock, patch
+
+from litellm.llms.anthropic.chat.transformation import AnthropicConfig
+
+
+def test_response_format_transformation_unit_test():
+ config = AnthropicConfig()
+
+ response_format_json_schema = {
+ "description": 'Progress report for the thinking process\n\nThis model represents a snapshot of the agent\'s current progress during\nthe thinking process, providing a brief description of the current activity.\n\nAttributes:\n agent_doing: Brief description of what the agent is currently doing.\n Should be kept under 10 words. Example: "Learning about home automation"',
+ "properties": {"agent_doing": {"title": "Agent Doing", "type": "string"}},
+ "required": ["agent_doing"],
+ "title": "ThinkingStep",
+ "type": "object",
+ "additionalProperties": False,
+ }
+
+ result = config._create_json_tool_call_for_response_format(
+ json_schema=response_format_json_schema
+ )
+
+ assert result["input_schema"]["properties"] == {
+ "agent_doing": {"title": "Agent Doing", "type": "string"}
+ }
+ print(result)