A library's sources in one collection of a vector store. Every passage of a source carries the source's tenant, access groups, kind, folder, tags and title in its metadata, so the store's own filter selects who sees it and the index checks what the store answers: indexSource replaces a source whole, setSourceScope changes who may see it and where it is filed, removeSource and removeTenant delete, and search reads only what its scope may see.

Constructors

Methods

  • Indexes a source, replacing whatever the collection held under its id: the old passages are deleted first, then the new ones are embedded and written batchSize at a time. A failed batch leaves the passages written before it, and indexing the source again replaces them. A delete or a write the store reports as failed in its result, instead of throwing, fails the call as well.

    Parameters

    Returns Promise<{
        passages: number;
    }>

  • Removes a source's passages and answers the store's deletedCount: how many went on a store that counts a delete by filter, as PostgresVectorStore and InMemoryVectorStore do, and the store's own value on one that does not (-1 on PineconeVectorStore, 0 on QdrantVectorStore). Throws when the store reports the delete as failed.

    Parameters

    • sourceId: string

    Returns Promise<number>

  • Removes every passage of one tenant and answers the store's deletedCount, as removeSource does. Throws when the store reports the delete as failed.

    Parameters

    • tenantId: string

    Returns Promise<number>

  • Changes who may see a source, its folder, its tags or its title; folderId: null takes it out of its folder.

    Parameters

    • sourceId: string
    • change: {
          aclGroups?: string[];
          folderId?: null | string;
          tags?: string[];
          title?: string;
      }
      • Optional aclGroups?: string[]
      • Optional folderId?: null | string
      • Optional tags?: string[]
      • Optional title?: string

    Returns Promise<number>

  • Searches what the scope may see. The store's filter selects the passages, and the index keeps only those whose metadata meets the scope and the narrowing: a store whose filter drops or ignores a condition cannot widen the answer, which can then hold fewer than topK passages. With anyOf, each narrowing is searched leg by leg under the same scope and the answers are ranked as one search's (LibrarySearch.anyOf). Once its signal has aborted, a search starts no further call to the embedder or the store and rejects (LibrarySearch.signal).

    Parameters

    Returns Promise<LibraryPassage[]>