_is_message_content_block() — langchain Function Reference
Architecture documentation for the _is_message_content_block() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 64a8d1bb_a7d8_b2fb_33c5_60cdd93b87a6["_is_message_content_block()"] 80cebff4_efbd_4311_85e9_de0dc81a7eee["base.py"] 64a8d1bb_a7d8_b2fb_33c5_60cdd93b87a6 -->|defined in| 80cebff4_efbd_4311_85e9_de0dc81a7eee 8e2aa8da_dbf5_6b94_c484_cfc2e4ce5b93["_is_message_content_type()"] 8e2aa8da_dbf5_6b94_c484_cfc2e4ce5b93 -->|calls| 64a8d1bb_a7d8_b2fb_33c5_60cdd93b87a6 style 64a8d1bb_a7d8_b2fb_33c5_60cdd93b87a6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/tools/base.py lines 1298–1313
def _is_message_content_block(obj: Any) -> bool:
"""Check if object is a valid message content block.
Validates content blocks for OpenAI or Anthropic format.
Args:
obj: The object to check.
Returns:
`True` if the object is a valid content block, `False` otherwise.
"""
if isinstance(obj, str):
return True
if isinstance(obj, dict):
return obj.get("type", None) in TOOL_MESSAGE_BLOCK_TYPES
return False
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does _is_message_content_block() do?
_is_message_content_block() is a function in the langchain codebase, defined in libs/core/langchain_core/tools/base.py.
Where is _is_message_content_block() defined?
_is_message_content_block() is defined in libs/core/langchain_core/tools/base.py at line 1298.
What calls _is_message_content_block()?
_is_message_content_block() is called by 1 function(s): _is_message_content_type.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free