Interface that extends EmbeddingsParams and defines additional parameters specific to the CohereEmbeddings class.

interface CohereEmbeddingsParams {
    batchSize?: number;
    embeddingTypes?: string[];
    inputType?: string;
    maxConcurrency?: number;
    maxRetries?: number;
    model?: string;
    onFailedAttempt?: FailedAttemptHandler;
}

Hierarchy

  • EmbeddingsParams
    • CohereEmbeddingsParams

Implemented by

Properties

batchSize?: number

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

embeddingTypes?: string[]

Specifies the type of embeddings you want to generate.

inputType?: string

Specifies the type of input you're giving to the model. Not required for older versions of the embedding models (i.e. anything lower than v3), but is required for more recent versions (i.e. anything bigger than v2).

  • search_document - Use this when you encode documents for embeddings that you store in a vector database for search use-cases.
  • search_query - Use this when you query your vector DB to find relevant documents.
  • classification - Use this when you use the embeddings as an input to a text classifier.
  • clustering - Use this when you want to cluster the embeddings.
maxConcurrency?: number

The maximum number of concurrent calls that can be made. Defaults to Infinity, which means no limit.

maxRetries?: number

The maximum number of retries that can be made for a single call, with an exponential backoff between each attempt. Defaults to 6.

model?: string
onFailedAttempt?: FailedAttemptHandler

Custom handler to handle failed attempts. Takes the originally thrown error object as input, and should itself throw an error if the input error is not retryable.