multiple: permit optional fields on multimodal content blocks (#30887)

Instead of stuffing provider-specific fields in `metadata`, they can go
directly on the content block.
This commit is contained in:
ccurme
2025-04-17 08:48:46 -04:00
committed by GitHub
parent 83b66cb916
commit 86d51f6be6
7 changed files with 27 additions and 17 deletions

View File

@@ -1107,6 +1107,15 @@ def test_is_data_content_block() -> None:
"mime_type": "image/jpeg",
}
)
assert is_data_content_block(
{
"type": "image",
"source_type": "base64",
"data": "<base64 data>",
"mime_type": "image/jpeg",
"cache_control": {"type": "ephemeral"},
}
)
assert is_data_content_block(
{
"type": "image",
@@ -1148,7 +1157,7 @@ def test_convert_to_openai_image_block() -> None:
"type": "image",
"source_type": "url",
"url": "https://...",
"metadata": {"cache_control": {"type": "ephemeral"}},
"cache_control": {"type": "ephemeral"},
}
expected = {
"type": "image_url",
@@ -1162,7 +1171,7 @@ def test_convert_to_openai_image_block() -> None:
"source_type": "base64",
"data": "<base64 data>",
"mime_type": "image/jpeg",
"metadata": {"cache_control": {"type": "ephemeral"}},
"cache_control": {"type": "ephemeral"},
}
expected = {
"type": "image_url",