Skip to content

Commit 46c7136

Browse files
committed
feat: Anthropic raises FeatureNotSupportedError for audio inputs
1 parent 91bfcb2 commit 46c7136

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

python/mirascope/llm/clients/anthropic/_utils/encode.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ def _encode_content(
8383
url=part.source.url,
8484
)
8585
blocks.append(anthropic_types.ImageBlockParam(type="image", source=source))
86+
elif part.type == "audio":
87+
raise FeatureNotSupportedError(
88+
"audio input",
89+
"anthropic",
90+
message="Anthropic does not support audio inputs.",
91+
)
8692
elif part.type == "tool_output":
8793
blocks.append(
8894
anthropic_types.ToolResultBlockParam(

python/tests/e2e/input/snapshots/test_call_with_audio/anthropic_claude_sonnet_4_0_snapshots.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
test_snapshot = snapshot(
44
{
55
"exception": {
6-
"type": "NotImplementedError",
7-
"args": "('Unsupported content type: audio',)",
6+
"type": "FeatureNotSupportedError",
7+
"args": "('Anthropic does not support audio inputs.',)",
8+
"feature": "audio input",
9+
"model_id": "None",
10+
"provider": "anthropic",
811
}
912
}
1013
)

0 commit comments

Comments
 (0)