langchain.js
    Preparing search index...

    Interface StandardContentBlockConverter<Formats>

    Utility interface for converting between standard and provider-specific data content blocks, to be used when implementing chat model providers.

    Meant to be used with convertToProviderContentBlock and convertToStandardContentBlock rather than being consumed directly.

    Don't use data content blocks. Use ContentBlock.Multimodal.Data instead.

    interface StandardContentBlockConverter<
        Formats extends Partial<ProviderFormatTypes>,
    > {
        providerName: string;
        fromStandardAudioBlock?(block: StandardAudioBlock): Formats["audio"];
        fromStandardFileBlock?(block: StandardFileBlock): Formats["file"];
        fromStandardImageBlock?(block: StandardImageBlock): Formats["image"];
        fromStandardTextBlock?(block: StandardTextBlock): Formats["text"];
    }

    Type Parameters

    Index

    Properties

    providerName: string

    The name of the provider type that corresponds to the provider-specific content block types that this converter supports.

    Methods

    • Convert from a standard audio block to a provider's proprietary audio block format.

      Parameters

      Returns Formats["audio"]

      The provider audio block.

    • Convert from a standard file block to a provider's proprietary file block format.

      Parameters

      Returns Formats["file"]

      The provider file block.

    • Convert from a standard image block to a provider's proprietary image block format.

      Parameters

      Returns Formats["image"]

      The provider image block.

    • Convert from a standard text block to a provider's proprietary text block format.

      Parameters

      Returns Formats["text"]

      The provider text block.