The interface for the vector database.

interface IVectorDatabase {
    close(): void;
    getName(): string;
    getOwnerId(): string;
    insert(name: string, content: string, index: IIndex[], vectors: number[][]): void;
    remove(name: string): void;
    search(vector: number[], k: number, minRelevance?: number, contentSize?: number): ISearchResult[];
}

Hierarchy (view full)

Methods

  • Close the database.

    Returns void

  • Get the name of the database.

    Returns string

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