Strands Agents Typescript SDK
    Preparing search index...

    Class DocumentBlock

    Document content block.

    Implements

    Index

    Constructors

    Properties

    type: "documentBlock" = ...

    Discriminator for document content.

    name: string

    Document name.

    Document format.

    Document source.

    citations?: { enabled: boolean }

    Citation configuration.

    context?: string

    Context information for the document.

    Methods

    • Serializes the DocumentBlock to a JSON-compatible ContentBlockData object. Called automatically by JSON.stringify(). Uint8Array bytes are encoded as base64 string.

      Returns {
          document: {
              name: string;
              format: DocumentFormat;
              source:
                  | { bytes: string }
                  | { text: string }
                  | { content: { text: string }[] }
                  | { s3Location: { uri: string; bucketOwner?: string } };
              citations?: { enabled: boolean };
              context?: string;
          };
      }

    • Creates a DocumentBlock instance from its wrapped data format. Base64-encoded bytes are decoded back to Uint8Array.

      Parameters

      • data: {
            document: {
                name: string;
                format: DocumentFormat;
                source:
                    | { bytes: string
                    | Uint8Array<ArrayBufferLike> }
                    | { text: string }
                    | { content: { text: string }[] }
                    | { s3Location: { uri: string; bucketOwner?: string } };
                citations?: { enabled: boolean };
                context?: string;
            };
        }

        Wrapped DocumentBlockData to deserialize (accepts both string and Uint8Array for bytes)

      Returns DocumentBlock

      DocumentBlock instance