test_content_block_transformation_v0_to_v1_image() — langchain Function Reference
Architecture documentation for the test_content_block_transformation_v0_to_v1_image() function in test_base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD a1ab9f8f_1e78_ba5e_37e3_e8998ac49d70["test_content_block_transformation_v0_to_v1_image()"] 8830054d_ac1e_daa9_c6c5_ff55b10d0bf3["test_base.py"] a1ab9f8f_1e78_ba5e_37e3_e8998ac49d70 -->|defined in| 8830054d_ac1e_daa9_c6c5_ff55b10d0bf3 style a1ab9f8f_1e78_ba5e_37e3_e8998ac49d70 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/language_models/chat_models/test_base.py lines 561–593
def test_content_block_transformation_v0_to_v1_image() -> None:
"""Test that v0 format image content blocks are transformed to v1 format."""
# Create a message with v0 format image content
image_message = AIMessage(
content=[
{
"type": "image",
"source_type": "url",
"url": "https://example.com/image.png",
}
]
)
llm = GenericFakeChatModel(messages=iter([image_message]), output_version="v1")
response = llm.invoke("test")
# With v1 output_version, .content should be transformed
# Check structure, ignoring auto-generated IDs
assert len(response.content) == 1
content_block = response.content[0]
if isinstance(content_block, dict) and "id" in content_block:
# Remove auto-generated id for comparison
content_without_id = {k: v for k, v in content_block.items() if k != "id"}
expected_content = {
"type": "image",
"url": "https://example.com/image.png",
}
assert content_without_id == expected_content
else:
assert content_block == {
"type": "image",
"url": "https://example.com/image.png",
}
Domain
Subdomains
Source
Frequently Asked Questions
What does test_content_block_transformation_v0_to_v1_image() do?
test_content_block_transformation_v0_to_v1_image() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/language_models/chat_models/test_base.py.
Where is test_content_block_transformation_v0_to_v1_image() defined?
test_content_block_transformation_v0_to_v1_image() is defined in libs/core/tests/unit_tests/language_models/chat_models/test_base.py at line 561.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free