1pub mod backup;
2pub mod cli;
3pub mod daemon;
4pub mod embedding;
5pub mod errors;
6pub mod hook;
7pub mod install;
8pub mod kb;
9pub mod llm;
10pub mod llm_trace;
11pub mod mcp;
12pub mod migrate;
13pub mod paths;
14pub mod refine;
15pub mod settings;
16pub mod storage;
17pub mod upgrade;
18pub mod utils;
19pub mod web;
20
21#[cfg(test)]
22mod tests;
23
24pub use errors::{InnateError, Result};
25pub use kb::{CurateReport, KnowledgeBase, RecallParams, RecallResult, RecordParams};
26
27pub fn open_kb(db_path: impl AsRef<std::path::Path>) -> Result<KnowledgeBase> {
31 use std::sync::Arc;
32 let s = settings::load()?;
33
34 let embedding: Option<Arc<dyn embedding::EmbeddingProvider>> = s.embedding.as_ref().map(|c| {
35 Arc::new(llm::LlmEmbeddingProvider::new(c.clone())) as Arc<dyn embedding::EmbeddingProvider>
36 });
37
38 let distiller: Option<Arc<dyn refine::Distiller>> = s
39 .llm
40 .as_ref()
41 .map(|c| llm::build_distiller(c) as Arc<dyn refine::Distiller>);
42
43 KnowledgeBase::open_with(db_path, embedding, None, distiller, None, None)
44}