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

Hierarchy

  • VectorStore
    • SupabaseVectorStore

Constructors

Properties

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

Methods

  • Adds documents to the vector store.

    Parameters

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

      The documents to add.

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

      Optional parameters for adding the documents.

      • Optional ids?: 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<Record<string, any>>[]

      The documents associated with the vectors.

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

      Optional parameters for adding the vectors.

      • Optional ids?: 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

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

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

    Parameters

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

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

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

    Parameters

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

      The documents to create the instance from.

    • 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.

  • 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.

Generated using TypeDoc