UNPKG

@adonis-agora/agent

Version:

Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.

33 lines • 1.62 kB
import { type BuildDocumentTreeOptions } from './build.js'; import type { DocumentTreeStore } from './store.js'; import type { DocumentTree, DocumentTreeInput } from './types.js'; export interface IndexDocumentTreeOptions extends Omit<BuildDocumentTreeOptions, 'previous'> { store: DocumentTreeStore; /** * Only documents with at least this many units (pages, or sections) get a tree; a shorter one is * skipped and any tree it had is removed. Default 20 — tree navigation pays off on long * structured documents and costs latency and LLM spend for nothing on short notes. */ minUnits?: number; /** …or at least this many characters, whichever is met first. Default 60 000 (~15k tokens). */ minChars?: number; } export type IndexDocumentTreeResult = { status: 'skipped'; reason: string; } | { status: 'unchanged'; tree: DocumentTree; } | { status: 'built'; tree: DocumentTree; }; /** * Build (or rebuild) a document's tree and store it — the call to make at upload/ingestion time, * next to chunking and embedding. Short documents are skipped (see `minUnits`/`minChars`); an * unchanged document costs one store read and no LLM call; a changed one reuses the summaries of * its unchanged sections. Never throws for a document the LLM cannot structure: the tree falls back * to page groups and `tree.stats.fallbackReason` says why. Store errors do propagate. */ export declare function indexDocumentTree(input: DocumentTreeInput, options: IndexDocumentTreeOptions): Promise<IndexDocumentTreeResult>; //# sourceMappingURL=index-document.d.ts.map