Class for generating embeddings using the Nomic API.

Hierarchy (view full)

Implements

Constructors

Properties

batchSize: number = 400

The maximum number of documents to embed in a single request.

Default

{400}
client: AtlasUser
model: string = "nomic-embed-text-v1"

The name of the model to use.

Default

{"nomic-embed-text-v1"}
modelName: string = "nomic-embed-text-v1"

The name of the model to use. Alias for model

Default

{"nomic-embed-text-v1"}
stripNewLines: boolean = true

Whether to strip new lines from the input text. This is recommended, but may not be suitable for all use cases.

Default

{true}
taskType: EmbeddingTaskType = "search_document"

The task your embeddings should be specialized for: search_query, search_document, clustering, classification.

Default

{"search_document"}
dimensionality?: number

The output size of the embedding model. Applicable only to models that support variable dimensionality and defaults to the models largest embedding size.

Methods

  • Method to generate embeddings for an array of documents. Splits the documents into batches and makes requests to the Nomic 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.

Generated using TypeDoc