Home / Class/ AudioContentBlock Class — langchain Architecture

AudioContentBlock Class — langchain Architecture

Architecture documentation for the AudioContentBlock class in content.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  3a0b58c5_9056_996d_5179_6550b2a700b5["AudioContentBlock"]
  c7f11daf_e104_efbe_7225_f1d6da8e8630["content.py"]
  3a0b58c5_9056_996d_5179_6550b2a700b5 -->|defined in| c7f11daf_e104_efbe_7225_f1d6da8e8630

Relationship Graph

Source Code

libs/core/langchain_core/messages/content.py lines 600–648

class AudioContentBlock(TypedDict):
    """Audio data.

    !!! note "Factory function"

        `create_audio_block` may also be used as a factory to create an
        `AudioContentBlock`. Benefits include:

        * Automatic ID generation (when not provided)
        * Required arguments strictly validated at creation time
    """

    type: Literal["audio"]
    """Type of the content block. Used for discrimination."""

    id: NotRequired[str]
    """Unique identifier for this content block.

    Either:

    - Generated by the provider
    - Generated by LangChain upon creation (`UUID4` prefixed with `'lc_'`))
    """

    file_id: NotRequired[str]
    """Reference to the audio file in an external file storage system.

    For example, OpenAI or Anthropic's Files API.
    """

    mime_type: NotRequired[str]
    """MIME type of the audio.

    Required for base64 data.

    [Examples from IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#audio)
    """

    index: NotRequired[int | str]
    """Index of block in aggregate response. Used during streaming."""

    url: NotRequired[str]
    """URL of the audio."""

    base64: NotRequired[str]
    """Data as a base64 string."""

    extras: NotRequired[dict[str, Any]]
    """Provider-specific metadata. This shouldn't be used for the audio data itself."""

Frequently Asked Questions

What is the AudioContentBlock class?
AudioContentBlock is a class in the langchain codebase, defined in libs/core/langchain_core/messages/content.py.
Where is AudioContentBlock defined?
AudioContentBlock is defined in libs/core/langchain_core/messages/content.py at line 600.

Analyze Your Own Codebase

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

Try Supermodel Free