Interface IVectorDatabaseConnector

The vector database connector interface.

interface IVectorDatabaseConnector {
    getBuffer(): ArrayBuffer;
    insert(name: string, content: string, index: IIndex[], vectors: number[][]): void;
    remove(name: string): void;
    search(vector: number[], k: number, minRelevance?: number, contentSize?: number): ISearchResult[];
}

Methods

  • Insert vectors into the database.

    Parameters

    • name: string

      The name of the content.

    • content: string

      The content.

    • index: IIndex[]

      The index of the vectors.

    • vectors: number[][]

      The vectors to insert.

    Returns void

  • Remove vectors from the database.

    Parameters

    • name: string

      The name of the content.

    Returns void

  • Search for the k nearest vectors.

    Parameters

    • vector: number[]

      The vector to search for.

    • k: number

      The number of nearest vectors to return.

    • OptionalminRelevance: number

      The minimum relevance of the vectors (default 0).

    • OptionalcontentSize: number

      The size of the content to return (content +/- contentSize, default 0).

    Returns ISearchResult[]

    An array of search results.