Class for interacting with SingleStoreDB, a high-performance distributed SQL database. It provides vector storage and vector functions.

Hierarchy

Constructors

Properties

FilterType: string | object
connectionPool: Pool
contentColumnName: string
distanceMetric: DistanceMetrics
embeddings: Embeddings
metadataColumnName: string
tableName: string
vectorColumnName: string

Methods

  • Adds new documents to the SingleStoreDB database.

    Parameters

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

      An array of Document objects.

    Returns Promise<void>

  • Adds new vectors to the SingleStoreDB database.

    Parameters

    • vectors: number[][]

      An array of vectors.

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

      An array of Document objects.

    Returns Promise<void>

  • Creates a new table in the SingleStoreDB database if it does not already exist.

    Returns Promise<void>

  • Parameters

    • Optional _params: Record<string, any>

    Returns Promise<void>

  • Ends the connection to the SingleStoreDB database.

    Returns Promise<void>

  • Parameters

    • query: string
    • k: number = 4
    • filter: undefined | string | object = undefined
    • _callbacks: undefined | Callbacks = undefined

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

  • Performs a similarity search on the vectors stored in the SingleStoreDB database.

    Parameters

    • query: number[]

      An array of numbers representing the query vector.

    • k: number

      The number of nearest neighbors to return.

    • Optional filter: Metadata

      Optional metadata to filter the vectors by.

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

    Top matching vectors with score

  • Parameters

    • query: string
    • k: number = 4
    • filter: undefined | string | object = undefined
    • _callbacks: undefined | Callbacks = undefined

    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 instance of the SingleStoreVectorStore class from a list of texts.

    Parameters

    • texts: string[]

      An array of strings.

    • metadatas: object[]

      An array of metadata objects.

    • embeddings: Embeddings

      An Embeddings object.

    • dbConfig: SingleStoreVectorStoreConfig

      A SingleStoreVectorStoreConfig object.

    Returns Promise<SingleStoreVectorStore>

    A new SingleStoreVectorStore instance

Generated using TypeDoc