The main class that extends the 'VectorStore' class. It provides methods for interacting with Upstash index, such as adding documents, deleting documents, performing similarity search and more.

Hierarchy

Constructors

Properties

FilterType: string | object
caller: AsyncCaller
index: Index<Record<string, unknown>>

Methods

  • This method adds documents to Upstash database. Documents are first converted to vectors using the provided embeddings instance, and then upserted to the database.

    Parameters

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

      Array of Document objects to be added to the database.

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

      Optional object containing array of ids for the documents.

      • Optional ids?: string[]

    Returns Promise<string[]>

    Promise that resolves with the ids of the provided documents when the upsert operation is done.

  • This method adds the provided vectors to Upstash database.

    Parameters

    • vectors: number[][]

      Array of vectors to be added to the Upstash database.

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

      Array of Document objects, each associated with a vector.

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

      Optional object containing the array of ids foor the vectors.

      • Optional ids?: string[]

    Returns Promise<string[]>

    Promise that resolves with the ids of the provided documents when the upsert operation is done.

  • This method deletes documents from the Upstash database. You can either provide the target ids, or delete all vectors in the database.

    Parameters

    • params: UpstashDeleteParams

      Object containing either array of ids of the documents or boolean deleteAll.

    Returns Promise<void>

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

  • Parameters

    • query: string
    • Optional k: number
    • Optional filter: string | object
    • Optional _callbacks: Callbacks

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

  • This method performs a similarity search in the Upstash database over the existing vectors.

    Parameters

    • query: number[]

      Query vector for the similarity search.

    • k: number

      The number of similar vectors to return as result.

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

    Promise that resolves with an array of tuples, each containing Document object and similarity score. The length of the result will be maximum of 'k' and vectors in the index.

  • Parameters

    • query: string
    • Optional k: number
    • Optional filter: string | object
    • Optional _callbacks: Callbacks

    Returns Promise<[DocumentInterface<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<DocumentInterface<Record<string, any>>[]>

    • List of documents selected by maximal marginal relevance.

Generated using TypeDoc