Archived
feat: engram-reasoning — graph-native inference engine, evidence chains, confidence propagation
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
/// Engram Reasoning Engine — graph-native inference separated from language generation.
|
||||
///
|
||||
/// # What this crate is
|
||||
///
|
||||
/// This is NOT an LLM wrapper. It is a reasoning system that traverses the Engram
|
||||
/// knowledge graph to reach conclusions through evidence chains.
|
||||
///
|
||||
/// LLMs: input tokens → transformer → output tokens. Reasoning and generation are
|
||||
/// the same process. You cannot separate them.
|
||||
///
|
||||
/// This engine: hypothesis → graph traversal → evidence chains → confidence-weighted
|
||||
/// conclusion. Generation happens separately (a codec converts the conclusion to
|
||||
/// language). The reasoning IS the traversal.
|
||||
///
|
||||
/// # Quick Start
|
||||
///
|
||||
/// ```rust,no_run
|
||||
/// use engram_core::{EngramDb, Node, Edge, NodeType, MemoryTier, RelationType};
|
||||
/// use engram_reasoning::{ReasoningEngine, Hypothesis, HypothesisType, ReasoningConfig};
|
||||
/// use std::path::Path;
|
||||
/// use std::sync::{Arc, Mutex};
|
||||
///
|
||||
/// let db = Arc::new(Mutex::new(EngramDb::open(Path::new("/tmp/engram-reason-test")).unwrap()));
|
||||
/// let config = ReasoningConfig::default();
|
||||
/// let mut engine = ReasoningEngine::new(db, config);
|
||||
///
|
||||
/// let hypothesis = Hypothesis::new(
|
||||
/// "Spreading activation improves memory retrieval",
|
||||
/// vec![0.9f32, 0.1, 0.3, 0.7],
|
||||
/// HypothesisType::IsTrue,
|
||||
/// );
|
||||
///
|
||||
/// let result = engine.reason(&hypothesis).unwrap();
|
||||
/// println!("Verdict: {:?}", result.conclusion.verdict);
|
||||
/// println!("Confidence: {:.2}", result.confidence);
|
||||
/// ```
|
||||
|
||||
pub mod engine;
|
||||
pub mod types;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
// Re-export the primary public surface
|
||||
pub use engine::ReasoningEngine;
|
||||
pub use types::{
|
||||
CausalDirection, ChainType, Conclusion, EvidenceChain, EvidenceNode, EvidenceType,
|
||||
Hypothesis, HypothesisType, InferenceEdge, InferenceEdgeType, ReasoningConfig,
|
||||
ReasoningResult, Verdict,
|
||||
};
|
||||
Reference in New Issue
Block a user