Skip to main content

reindex_knowledge

Function reindex_knowledge 

Source
pub async fn reindex_knowledge(
    runtime: &KhiveRuntime,
    token: &NamespaceToken,
    opts: KnowledgeReindexOptions,
    on_atom_progress: Option<&(dyn Fn(u64, u64) + Send + Sync)>,
    on_section_progress: Option<&(dyn Fn(u64, u64) + Send + Sync)>,
) -> Result<Value, RuntimeError>
Expand description

Reindex the knowledge corpus for token’s namespace: embed atoms and/or sections with the default embedder and (optionally) rebuild the atom Vamana ANN snapshot.

Library entry for kkernel reindex — callable without an MCP server. Knowledge is single-model (search retrieves via the default embedder’s ANN), so this does not fan out across registered models the way entity/note reindex does. Returns {atoms_indexed, sections_indexed, failed, ann_failed, sections_failed}.

Optional progress callbacks receive (processed, total) after each batch.