Core - v1.0.0
    Preparing search index...

    Interface VectorIndex<TRuntime>

    Storage and nearest-neighbour search over embeddings.

    Has no opinion about where a vector came from — pairing it with InferenceEngine is the caller's decision, and an embedding produced anywhere else indexes just as well.

    Writes are applied asynchronously by most backends, so a mutation id comes back rather than the applied state: a vector just written is not necessarily a vector already searchable.

    Bayu Dwiyan Satria

    1.0.0

    1.0.0

    interface VectorIndex<TRuntime = unknown> {
        index(
            runtime: TRuntime,
            id: string,
            vector: number[],
            metadata?: Record<string, unknown>,
        ): Promise<string>;
        isAvailable(runtime: TRuntime): boolean;
        remove(runtime: TRuntime, ids: string[]): Promise<string>;
        search(
            runtime: TRuntime,
            vector: number[],
            topK?: number,
        ): Promise<VectorMatch[]>;
        similar(runtime: TRuntime, id: string): Promise<VectorMatch[]>;
    }

    Type Parameters

    • TRuntime = unknown

      The runtime handle the index is resolved from.

    Hierarchy (View Summary)

    Index
    • Stores a vector, replacing any vector already under that id.

      Parameters

      • runtime: TRuntime

        The runtime handle.

      • id: string

        Id to store the vector under.

      • vector: number[]

        The embedding.

      • Optionalmetadata: Record<string, unknown>

        Metadata to store alongside it.

      Returns Promise<string>

      The mutation id.

    • Reports whether the capability is actually usable on this runtime.

      Parameters

      Returns boolean

      true when calls will reach a real backing resource.

      A capability backed by an optional resource answers false when that resource was never provisioned. Implementations must document what each method does in that state — degrade or throw — and must not vary it, since a caller choosing between two implementations is relying on the answer meaning the same thing in both.

    • Finds the vectors nearest to one supplied.

      Parameters

      • runtime: TRuntime

        The runtime handle.

      • vector: number[]

        The query embedding.

      • OptionaltopK: number

        How many matches to return. Falls back to the configured default.

      Returns Promise<VectorMatch[]>

      The matches, nearest first.