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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
docs: reference the source union by type instead of a line number
feng.tsaibb51c121cf94
diff --git a/litellm/llms/anthropic/chat/guardrail_translation/handler.py b/litellm/llms/anthropic/chat/guardrail_translation/handler.pyindex 4b763d11652..5aa0dc94b89 100644--- a/litellm/llms/anthropic/chat/guardrail_translation/handler.py+++ b/litellm/llms/anthropic/chat/guardrail_translation/handler.py@@ -861,7 +861,7 @@ class AnthropicMessagesHandler(BaseTranslation):def _image_sources(block: Mapping[str, object]) -> tuple[str, ...]:"""Normalize an Anthropic image block into strings a guardrail can read.- `source` is one of three shapes (types/llms/anthropic.py:259):+ `source` is one of three shapes (`AnthropicMessagesImageParam.source`):{"type": "base64", "media_type": "image/png", "data": "<b64>"}{"type": "url", "url": "https://..."}diff --git a/tests/test_litellm/llms/anthropic/chat/guardrail_translation/test_anthropic_guardrail_handler.py b/tests/test_litellm/llms/anthropic/chat/guardrail_translation/test_anthropic_guardrail_handler.pyindex 2b606b9639a..0fe7730e91e 100644--- a/tests/test_litellm/llms/anthropic/chat/guardrail_translation/test_anthropic_guardrail_handler.py+++ b/tests/test_litellm/llms/anthropic/chat/guardrail_translation/test_anthropic_guardrail_handler.py@@ -1491,7 +1491,7 @@ class MockCanaryMaskingGuardrail(CustomGuardrail):class TestAnthropicMessagesImageSources:- """An Anthropic image block has three source shapes (types/llms/anthropic.py:259).+ """An Anthropic image block has three source shapes (`AnthropicMessagesImageParam.source`).Only the base64 one carries "data", so reading that key alone drops url imagesentirely -- for every guardrail consuming GenericGuardrailAPIInputs["images"],