From b81f5b8ae46b343622c50ca15f591f5f79c1ea23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dandelion=20Man=C3=A9?= Date: Tue, 21 Oct 2025 16:23:39 -0700 Subject: [PATCH] feat: Anthropic raises FeatureNotSupportedError for audio inputs --- python/mirascope/llm/clients/anthropic/_utils/encode.py | 6 ++++++ .../anthropic_claude_sonnet_4_0_snapshots.py | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/python/mirascope/llm/clients/anthropic/_utils/encode.py b/python/mirascope/llm/clients/anthropic/_utils/encode.py index bb4eed632..22685ea35 100644 --- a/python/mirascope/llm/clients/anthropic/_utils/encode.py +++ b/python/mirascope/llm/clients/anthropic/_utils/encode.py @@ -83,6 +83,12 @@ def _encode_content( url=part.source.url, ) blocks.append(anthropic_types.ImageBlockParam(type="image", source=source)) + elif part.type == "audio": + raise FeatureNotSupportedError( + "audio input", + "anthropic", + message="Anthropic does not support audio inputs.", + ) elif part.type == "tool_output": blocks.append( anthropic_types.ToolResultBlockParam( diff --git a/python/tests/e2e/input/snapshots/test_call_with_audio/anthropic_claude_sonnet_4_0_snapshots.py b/python/tests/e2e/input/snapshots/test_call_with_audio/anthropic_claude_sonnet_4_0_snapshots.py index 7150d176a..df9b18a3c 100644 --- a/python/tests/e2e/input/snapshots/test_call_with_audio/anthropic_claude_sonnet_4_0_snapshots.py +++ b/python/tests/e2e/input/snapshots/test_call_with_audio/anthropic_claude_sonnet_4_0_snapshots.py @@ -3,8 +3,11 @@ test_snapshot = snapshot( { "exception": { - "type": "NotImplementedError", - "args": "('Unsupported content type: audio',)", + "type": "FeatureNotSupportedError", + "args": "('Anthropic does not support audio inputs.',)", + "feature": "audio input", + "model_id": "None", + "provider": "anthropic", } } )