import { LoadTextOptions, RagLoaderResult } from "./loader.type.mjs"; //#region ../ai/src/rag/loaders/load-text.d.ts /** * One raw text item — a bare string, or a `{ id, text, … }` record giving the * item its own id / metadata / tags. Passing records lets a single * {@link loadText} call turn many strings into many distinctly-identified * {@link RagDocument}s. */ type TextInput = string | { /** Stable id for this item. Falls back to the option `id` + index. */id?: string; /** The text body. */ text: string; /** Per-item metadata, merged under the shared option `metadata`. */ metadata?: Record; /** Per-item tags (override the shared option `tags` when present). */ tags?: string[]; }; /** * Load plain text into {@link RagDocument}(s) — the zero-dependency base * loader every other loader ultimately funnels into. Accepts a single * string, a single `{ id, text }` record, or an array mixing both; each * input becomes one document carrying `metadata.loader = "text"` plus a * `metadata.source` (the resolved id). * * Caller `metadata` always wins over the loader-derived keys, and per-item * `metadata` / `tags` (when an item is a record) layer on top of the shared * option values. Empty / whitespace-only items are dropped — they would * chunk to nothing anyway, so the result never carries a no-op document. * * The output is the exact shape `index()` consumes: * * @example * const kb = ai.rag({ embedder, store }); * await kb.index(loadText("a long string of notes…")); * * @example * await kb.index(loadText([ * { id: "faq-1", text: "…", metadata: { section: "billing" } }, * { id: "faq-2", text: "…" }, * ])); * * @param input - A string, a `{ id, text }` record, or an array of either. * @param options - Shared `id` / `metadata` / `tags` ({@link LoadTextOptions}). * @returns A {@link RagLoaderResult} ready to hand to `rag.index()`. */ declare function loadText(input: TextInput | TextInput[], options?: LoadTextOptions): RagLoaderResult; //#endregion export { TextInput, loadText }; //# sourceMappingURL=load-text.d.mts.map