Class for interacting with a Supabase database to store and manage vectors.

Hierarchy (view full)

Constructors

Properties

client: SupabaseClient<any, "public", any>
queryName: string
tableName: string
upsertBatchSize: number = 500

Methods

  • Adds documents to the vector store.

    Parameters

    • documents: Document[]

      The documents to add.

    • Optionaloptions: {
          ids?: string[] | number[];
      }

      Optional parameters for adding the documents.

      • Optionalids?: string[] | number[]

    Returns Promise<string[]>

    A promise that resolves when the documents have been added.

  • Adds vectors to the vector store.

    Parameters

    • vectors: number[][]

      The vectors to add.

    • documents: Document[]

      The documents associated with the vectors.

    • Optionaloptions: {
          ids?: string[] | number[];
      }

      Optional parameters for adding the vectors.

      • Optionalids?: string[] | number[]

    Returns Promise<string[]>

    A promise that resolves with the IDs of the added vectors when the vectors have been added.

  • Deletes vectors from the vector store.

    Parameters

    • params: {
          ids: string[] | number[];
      }

      The parameters for deleting vectors.

      • ids: string[] | number[]

    Returns Promise<void>

    A promise that resolves when the vectors have been deleted.

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

    Parameters

    • query: string

      Text to look up documents similar to.

    • options: MaxMarginalRelevanceSearchOptions<this["FilterType"]>

    Returns Promise<Document[]>

    • List of documents selected by maximal marginal relevance.
  • Performs a similarity search on the vector store.

    Parameters

    Returns Promise<[Document, number][]>

    A promise that resolves with the search results when the search is complete.

  • Creates a new SupabaseVectorStore instance from an array of texts.

    Parameters

    • texts: string[]

      The texts to create documents from.

    • metadatas: object | object[]

      The metadata for the documents.

    • embeddings: EmbeddingsInterface

      The embeddings to use.

    • dbConfig: SupabaseLibArgs

      The configuration for the Supabase database.

    Returns Promise<SupabaseVectorStore>

    A promise that resolves with a new SupabaseVectorStore instance when the instance has been created.

""