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::{
26 AppraiseParams, Contributor, CurateReport, FlaggedPoint, KnowledgeBase, RecallParams,
27 RecallResult, RecordParams, Situation, Tier, Valence, Verdict,
28};
29
30pub fn open_kb(db_path: impl AsRef<std::path::Path>) -> Result<KnowledgeBase> {
34 use std::sync::Arc;
35 let s = settings::load()?;
36
37 let embedding: Option<Arc<dyn embedding::EmbeddingProvider>> = s.embedding.as_ref().map(|c| {
38 Arc::new(llm::LlmEmbeddingProvider::new(c.clone())) as Arc<dyn embedding::EmbeddingProvider>
39 });
40
41 let distiller: Option<Arc<dyn refine::Distiller>> = s.llm.as_ref().map(|c| {
46 let primary = llm::build_distiller(c) as Arc<dyn refine::Distiller>;
47 Arc::new(refine::ResilientDistiller::new(
48 primary,
49 Arc::new(refine::HeuristicDistiller),
50 2,
51 )) as Arc<dyn refine::Distiller>
52 });
53
54 KnowledgeBase::open_with(db_path, embedding, None, distiller, None, None)
55}