Expand description
Ingest a folder into a named vector index in the store file. Unchanged files are skipped by content hash, changed files are replaced whole, a file that fails is recorded and the walk goes on, and the sources of files gone from the folder are removed.
Structs§
- Chunk
Config - Size limits for
chunk, in estimated tokens of four chars each.max_tokensbounds every chunk;overlap_tokensis how much of a chunk’s end is repeated at the start of the next one, and must be belowmax_tokens. - Ingest
Report - What one
ingest_dircall did: files added, replaced and skipped as unchanged, sources removed because their file is gone, files the walk passed over (unsupported,symlinks), failed files with their error, and the chunks written. - Ingest
Settings - Settings for
ingest_dir. Defaults: scopedocs, chunks of 200 tokens with 20 of overlap, the safe folder walk ofLoadSettingsandOrigin::External, so folder text is fenced as untrusted in prompts. A run never removes more than half the scope, or all of it from an empty folder, unless allowed. Changed origin or chunk config re-ingests. - Knowledge
- A folder an agent can search:
Knowledge::dir("docs")plus settings. Atbuildthe folder is ingested into indexindexof the store file (unchanged files skipped) and the agent gets thesearch_knowledgetool. The embedder defaults to the catalog’s for the agent’s vendor. - Load
Settings - Bounds and filters of a folder walk. Every field has a safe default:
the five text extensions, 10 000 files, 8 MiB per file, depth 16,
100 000 directory entries, symlinks not followed, hidden entries
skipped. Built with
Defaultand thewith_*setters.
Traits§
- Embedder
- Turns texts into fixed-length vectors for a
VectorStore. Object safe, so the model can be chosen at runtime asArc<dyn Embedder>.embedreturns one vector ofdims()floats per input text, in order.
Functions§
- ingest_
dir - Ingests every loadable file under
dirintovectors: unchanged files are skipped, others swapped in withreplace_source, and after a complete walk a source is removed only when its file is gone from disk, checked again just before removal; filtered-out files stay. Output: the report, or an error for a walk cap, a blank scope or a store write that fails.