Home / Class/ BaseMedia Class — langchain Architecture

BaseMedia Class — langchain Architecture

Architecture documentation for the BaseMedia class in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  ba6283e7_314f_f690_d884_764090007051["BaseMedia"]
  f3658565_d05c_7f49_b7f8_622b7ef34f33["Serializable"]
  ba6283e7_314f_f690_d884_764090007051 -->|extends| f3658565_d05c_7f49_b7f8_622b7ef34f33
  1241bfcd_16b1_a16e_1fde_a4ccdbf83db2["base.py"]
  ba6283e7_314f_f690_d884_764090007051 -->|defined in| 1241bfcd_16b1_a16e_1fde_a4ccdbf83db2

Relationship Graph

Source Code

libs/core/langchain_core/documents/base.py lines 34–56

class BaseMedia(Serializable):
    """Base class for content used in retrieval and data processing workflows.

    Provides common fields for content that needs to be stored, indexed, or searched.

    !!! note

        For multimodal content in **chat messages** (images, audio sent to/from LLMs),
        use `langchain.messages` content blocks instead.
    """

    # The ID field is optional at the moment.
    # It will likely become required in a future major release after
    # it has been adopted by enough VectorStore implementations.
    id: str | None = Field(default=None, coerce_numbers_to_str=True)
    """An optional identifier for the document.

    Ideally this should be unique across the document collection and formatted
    as a UUID, but this will not be enforced.
    """

    metadata: dict = Field(default_factory=dict)
    """Arbitrary metadata associated with the content."""

Extends

Frequently Asked Questions

What is the BaseMedia class?
BaseMedia is a class in the langchain codebase, defined in libs/core/langchain_core/documents/base.py.
Where is BaseMedia defined?
BaseMedia is defined in libs/core/langchain_core/documents/base.py at line 34.
What does BaseMedia extend?
BaseMedia extends Serializable.

Analyze Your Own Codebase

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

Try Supermodel Free