Home / Function/ _is_message_content_type() — langchain Function Reference

_is_message_content_type() — langchain Function Reference

Architecture documentation for the _is_message_content_type() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  b15470fa_e581_5cdd_5f58_a4d833f2e3f2["_is_message_content_type()"]
  6508e071_ac7c_8516_5d11_f42f8a45558c["base.py"]
  b15470fa_e581_5cdd_5f58_a4d833f2e3f2 -->|defined in| 6508e071_ac7c_8516_5d11_f42f8a45558c
  072dc76c_9dad_af1b_6c54_935cef325ab4["_format_output()"]
  072dc76c_9dad_af1b_6c54_935cef325ab4 -->|calls| b15470fa_e581_5cdd_5f58_a4d833f2e3f2
  229863fe_caa2_7de1_b918_6f386fde6873["_is_message_content_block()"]
  b15470fa_e581_5cdd_5f58_a4d833f2e3f2 -->|calls| 229863fe_caa2_7de1_b918_6f386fde6873
  style b15470fa_e581_5cdd_5f58_a4d833f2e3f2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tools/base.py lines 1282–1295

def _is_message_content_type(obj: Any) -> bool:
    """Check if object is valid message content format.

    Validates content for OpenAI or Anthropic format tool messages.

    Args:
        obj: The object to check.

    Returns:
        `True` if the object is valid message content, `False` otherwise.
    """
    return isinstance(obj, str) or (
        isinstance(obj, list) and all(_is_message_content_block(e) for e in obj)
    )

Domain

Subdomains

Called By

Frequently Asked Questions

What does _is_message_content_type() do?
_is_message_content_type() is a function in the langchain codebase, defined in libs/core/langchain_core/tools/base.py.
Where is _is_message_content_type() defined?
_is_message_content_type() is defined in libs/core/langchain_core/tools/base.py at line 1282.
What does _is_message_content_type() call?
_is_message_content_type() calls 1 function(s): _is_message_content_block.
What calls _is_message_content_type()?
_is_message_content_type() is called by 1 function(s): _format_output.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free