The main class that extends the VectorStore class. It provides methods for interacting with the Chroma database, such as adding documents, deleting documents, and searching for similar vectors.

Hierarchy

Constructors

Properties

FilterType: Where
collectionName: string
embeddings: Embeddings
url: string
collection?: Collection
collectionMetadata?: CollectionMetadata
filter?: object
index?: ChromaClient
numDimensions?: number

Methods

  • Adds documents to the Chroma database. The documents are first converted to vectors using the embeddings instance, and then added to the database.

    Parameters

    • documents: Document<Record<string, any>>[]

      An array of Document instances to be added to the database.

    • Optional options: {
          ids?: string[];
      }

      Optional. An object containing an array of ids for the documents.

      • Optional ids?: string[]

    Returns Promise<string[]>

    A promise that resolves when the documents have been added to the database.

  • Adds vectors to the Chroma database. The vectors are associated with the provided documents.

    Parameters

    • vectors: number[][]

      An array of vectors to be added to the database.

    • documents: Document<Record<string, any>>[]

      An array of Document instances associated with the vectors.

    • Optional options: {
          ids?: string[];
      }

      Optional. An object containing an array of ids for the vectors.

      • Optional ids?: string[]

    Returns Promise<string[]>

    A promise that resolves with an array of document IDs when the vectors have been added to the database.

  • Deletes documents from the Chroma database. The documents to be deleted can be specified by providing an array of ids or a filter object.

    Parameters

    • params: ChromaDeleteParams<Where>

      An object containing either an array of ids of the documents to be deleted or a filter object to specify the documents to be deleted.

    Returns Promise<void>

    A promise that resolves when the specified documents have been deleted from the database.

  • Ensures that a collection exists in the Chroma database. If the collection does not exist, it is created.

    Returns Promise<Collection>

    A promise that resolves with the Collection instance.

  • Parameters

    • query: string
    • Optional k: number
    • Optional filter: Where
    • Optional _callbacks: Callbacks

    Returns Promise<Document<Record<string, any>>[]>

  • Searches for vectors in the Chroma database that are similar to the provided query vector. The search can be filtered using the provided filter object or the filter property of the Chroma instance.

    Parameters

    • query: number[]

      The query vector.

    • k: number

      The number of similar vectors to return.

    • Optional filter: Where

      Optional. A filter object to filter the search results.

    Returns Promise<[Document<Record<string, any>>, number][]>

    A promise that resolves with an array of tuples, each containing a Document instance and a similarity score.

  • Parameters

    • query: string
    • Optional k: number
    • Optional filter: Where
    • Optional _callbacks: Callbacks

    Returns Promise<[Document<Record<string, any>>, number][]>

  • Return documents selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to the query AND diversity among selected documents.

    Parameters

    Returns Promise<Document<Record<string, any>>[]>

    • List of documents selected by maximal marginal relevance.
  • Creates a new Chroma instance from an array of Document instances. The documents are added to the Chroma database.

    Parameters

    • docs: Document<Record<string, any>>[]

      An array of Document instances.

    • embeddings: Embeddings

      An Embeddings instance used to generate embeddings for the documents.

    • dbConfig: ChromaLibArgs

      A ChromaLibArgs object containing the configuration for the Chroma database.

    Returns Promise<Chroma>

    A promise that resolves with a new Chroma instance.

  • Creates a new Chroma instance from an existing collection in the Chroma database.

    Parameters

    • embeddings: Embeddings

      An Embeddings instance used to generate embeddings for the documents.

    • dbConfig: ChromaLibArgs

      A ChromaLibArgs object containing the configuration for the Chroma database.

    Returns Promise<Chroma>

    A promise that resolves with a new Chroma instance.

  • Creates a new Chroma instance from an array of text strings. The text strings are converted to Document instances and added to the Chroma database.

    Parameters

    • texts: string[]

      An array of text strings.

    • metadatas: object | object[]

      An array of metadata objects or a single metadata object. If an array is provided, it must have the same length as the texts array.

    • embeddings: Embeddings

      An Embeddings instance used to generate embeddings for the documents.

    • dbConfig: ChromaLibArgs

      A ChromaLibArgs object containing the configuration for the Chroma database.

    Returns Promise<Chroma>

    A promise that resolves with a new Chroma instance.

  • Imports the ChromaClient from the chromadb module.

    Returns Promise<{
        ChromaClient: typeof ChromaClient;
    }>

    A promise that resolves with an object containing the ChromaClient constructor.

Generated using TypeDoc