tRAGar - v0.1.0
    Preparing search index...

    Interface TRAGarInstance

    interface TRAGarInstance {
        count: number;
        dim: number;
        modelId: string;
        namespace: string;
        storeMode: StoreMode;
        close(): Promise<void>;
        ingest(doc: IngestDoc): Promise<void>;
        query(text: string, opts?: QueryOptions): Promise<Hit[]>;
        queryStream(text: string, opts?: QueryOptions): AsyncIterable<Hit>;
        stats(): Promise<Stats>;
    }
    Index

    Properties

    count: number

    Number of chunks currently stored. Updated after each ingest() call.

    dim: number

    Embedding dimension.

    modelId: string

    Model identifier passed to the embedder.

    namespace: string

    Corpus namespace this instance was opened with.

    storeMode: StoreMode

    Active backing-store mode ("memory" | "opfs" | "indexeddb").

    Methods

    • Release all resources held by this instance. Resolves on success; rejects with TRAGarError("InstanceClosed") if already closed.

      Returns Promise<void>

    • Ingest one document: chunk → embed → store. Resolves when all chunks are stored; rejects with TRAGarError("InstanceClosed") if closed.

      Parameters

      Returns Promise<void>

    • Query the corpus for the top-k most relevant chunks. Returns an empty array when no chunks have been ingested. Rejects with TRAGarError("InstanceClosed") if closed.

      Parameters

      Returns Promise<Hit[]>

    • Stream the top-k hits as an async iterator, yielding in descending score order. Safe to abandon with break or an exception — resources are released when the iterator protocol's return() method is called. Throws TRAGarError("InstanceClosed") on first iteration if closed.

      Parameters

      Returns AsyncIterable<Hit>

    • Return a summary of the current corpus state. Rejects with TRAGarError("InstanceClosed") if closed.

      Returns Promise<Stats>