Class that extends the Embeddings class and provides methods for generating embeddings using the Bedrock API.

Hierarchy

Implements

Constructors

Properties

batchSize: number = 512
caller: AsyncCaller

The async caller should be used by subclasses to make any async calls, which will thus benefit from the concurrency and retry logic.

client: BedrockRuntimeClient

A client provided by the user that allows them to customze any SDK configuration options.

model: string

Model Name to use. Defaults to amazon.titan-embed-text-v1 if not provided

Methods

  • Method to generate embeddings for an array of texts. Calls _embedText method which batches and handles retry logic when calling the AWS Bedrock API.

    Parameters

    • documents: string[]

      Array of texts for which to generate embeddings.

    Returns Promise<number[][]>

    Promise that resolves to a 2D array of embeddings for each input document.

  • Method that takes a document as input and returns a promise that resolves to an embedding for the document. It calls the _embedText method with the document as the input.

    Parameters

    • document: string

      Document for which to generate an embedding.

    Returns Promise<number[]>

    Promise that resolves to an embedding for the input document.

  • Protected method to make a request to the Bedrock API to generate embeddings. Handles the retry logic and returns the response from the API.

    Parameters

    • text: string

    Returns Promise<number[]>

    Promise that resolves to the response from the API.

Generated using TypeDoc