_content_blocks_equal_ignore_id() — langchain Function Reference
Architecture documentation for the _content_blocks_equal_ignore_id() function in test_base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 04b88a04_551f_0236_7b9e_35e0e9609d87["_content_blocks_equal_ignore_id()"] 8830054d_ac1e_daa9_c6c5_ff55b10d0bf3["test_base.py"] 04b88a04_551f_0236_7b9e_35e0e9609d87 -->|defined in| 8830054d_ac1e_daa9_c6c5_ff55b10d0bf3 bdb33a6a_96ac_203e_de97_551be488886e["test_extend_support_to_openai_multimodal_formats()"] bdb33a6a_96ac_203e_de97_551be488886e -->|calls| 04b88a04_551f_0236_7b9e_35e0e9609d87 style 04b88a04_551f_0236_7b9e_35e0e9609d87 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/language_models/chat_models/test_base.py lines 50–78
def _content_blocks_equal_ignore_id(
actual: str | list[Any], expected: str | list[Any]
) -> bool:
"""Compare content blocks, ignoring auto-generated `id` fields.
Args:
actual: Actual content from response (string or list of content blocks).
expected: Expected content to compare against (string or list of blocks).
Returns:
True if content matches (excluding `id` fields), `False` otherwise.
"""
if isinstance(actual, str) or isinstance(expected, str):
return actual == expected
if len(actual) != len(expected):
return False
for actual_block, expected_block in zip(actual, expected, strict=False):
actual_without_id = (
{k: v for k, v in actual_block.items() if k != "id"}
if isinstance(actual_block, dict) and "id" in actual_block
else actual_block
)
if actual_without_id != expected_block:
return False
return True
Domain
Subdomains
Source
Frequently Asked Questions
What does _content_blocks_equal_ignore_id() do?
_content_blocks_equal_ignore_id() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/language_models/chat_models/test_base.py.
Where is _content_blocks_equal_ignore_id() defined?
_content_blocks_equal_ignore_id() is defined in libs/core/tests/unit_tests/language_models/chat_models/test_base.py at line 50.
What calls _content_blocks_equal_ignore_id()?
_content_blocks_equal_ignore_id() is called by 1 function(s): test_extend_support_to_openai_multimodal_formats.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free