Hierarchy

  • Embeddings
    • ByteDanceDoubaoEmbeddings

Implements

Constructors

Properties

apiKey: string
batchSize: number = 24

The maximum number of documents to embed in a single request. This is limited by the ByteDanceDoubao API to a maximum of 2048.

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.

model: string

Model name to use

stripNewLines: boolean = true

Whether to strip new lines from the input text.

Methods

  • Method to generate embeddings for an array of documents. Splits the documents into batches and makes requests to the ByteDanceDoubao API to generate embeddings.

    Parameters

    • texts: string[]

      Array of documents to generate embeddings for.

    Returns Promise<number[][]>

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

  • Method to generate an embedding for a single document. Calls the embeddingWithRetry method with the document as the input.

    Parameters

    • text: string

      Document to generate an embedding for.

    Returns Promise<number[]>

    Promise that resolves to an embedding for the document.