mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-15 06:26:12 +00:00
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:
@@ -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",
|
||||
|
Reference in New Issue
Block a user