agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
35 lines (34 loc) • 1.46 kB
TypeScript
import type { DocumentLoader, DocumentSource, FailedDocument, LoadedDocument } from './types.js';
export interface LoadDocumentsOptions {
/**
* Loaders to route with, consulted BEFORE the built-ins. Passing one that
* claims `.md` overrides the Markdown loader without editing a registry.
*/
readonly loaders?: readonly DocumentLoader[];
/**
* Skip files larger than this many bytes, recording them in `failed[]`.
* Default 25 MB — a corpus is other people's directories, and a stray
* database dump should be reported rather than read into memory.
*/
readonly maxBytes?: number;
}
export interface LoadDocumentsResult {
readonly documents: readonly LoadedDocument[];
readonly failed: readonly FailedDocument[];
/** How many files the source turned up, before any of them were read. */
readonly discovered: number;
}
/**
* Read a source into documents.
*
* @throws TypeError when the source names more than one mode, or none.
* @throws when a named directory or file cannot be reached at all.
*
* @example
* ```ts
* const { documents, failed } = await loadDocuments({ dir: './docs' });
* const { documents } = await loadDocuments({ files: ['./a.md', './b.pdf'] });
* const { documents } = await loadDocuments({ text: 'inline', uri: 'note.md' });
* ```
*/
export declare function loadDocuments(source: DocumentSource, options?: LoadDocumentsOptions): Promise<LoadDocumentsResult>;