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(anthropic): pin dropped file-id and empty-url document sources to string output

mateo-berric3c9e3a91968
diff --git a/tests/test_litellm/llms/anthropic/experimental_pass_through/responses_adapters/test_responses_adapters_transformation.py b/tests/test_litellm/llms/anthropic/experimental_pass_through/responses_adapters/test_responses_adapters_transformation.py
index f0cdaa4e8e3..44c956c8ee8 100644
--- a/tests/test_litellm/llms/anthropic/experimental_pass_through/responses_adapters/test_responses_adapters_transformation.py
+++ b/tests/test_litellm/llms/anthropic/experimental_pass_through/responses_adapters/test_responses_adapters_transformation.py
@@ -1644,6 +1644,23 @@ class TestToolResultDocuments:
output = self._tool_output(self._translate([{"type": "text", "text": "plain result"}]))
assert output == "plain result"
+ def test_file_id_source_document_keeps_string_output(self):
+ output = self._tool_output(
+ self._translate(
+ [
+ {"type": "text", "text": "stub"},
+ {"type": "document", "source": {"type": "file", "file_id": "file_abc123"}},
+ ]
+ )
+ )
+ assert output == "stub"
+
+ def test_url_source_without_url_keeps_string_output(self):
+ output = self._tool_output(
+ self._translate([{"type": "text", "text": "stub"}, {"type": "document", "source": {"type": "url"}}])
+ )
+ assert output == "stub"
+
def test_text_image_and_document_mix(self):
items = self._translate(
[