pub struct ConchDB { /* private fields */ }Expand description
High-level API wrapping storage + embeddings.
Implementations§
Source§impl ConchDB
impl ConchDB
pub fn open(path: &str) -> Result<Self, ConchError>
pub fn open_with_namespace( path: &str, namespace: &str, ) -> Result<Self, ConchError>
pub fn open_in_memory_with( embedder: Box<dyn Embedder>, ) -> Result<Self, ConchError>
pub fn open_in_memory_with_namespace( embedder: Box<dyn Embedder>, namespace: &str, ) -> Result<Self, ConchError>
pub fn namespace(&self) -> &str
pub fn store(&self) -> &MemoryStore
pub fn remember_fact( &self, subject: &str, relation: &str, object: &str, ) -> Result<MemoryRecord, ConchError>
pub fn remember_fact_full( &self, subject: &str, relation: &str, object: &str, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, ) -> Result<MemoryRecord, ConchError>
Sourcepub fn upsert_fact(
&self,
subject: &str,
relation: &str,
object: &str,
) -> Result<(MemoryRecord, bool), ConchError>
pub fn upsert_fact( &self, subject: &str, relation: &str, object: &str, ) -> Result<(MemoryRecord, bool), ConchError>
Upsert a fact: if a fact with the same subject+relation exists, update
its object. Otherwise insert a new fact.
Returns (record, was_updated).
pub fn remember_episode(&self, text: &str) -> Result<MemoryRecord, ConchError>
pub fn remember_episode_full( &self, text: &str, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, ) -> Result<MemoryRecord, ConchError>
Sourcepub fn remember_fact_dedup(
&self,
subject: &str,
relation: &str,
object: &str,
) -> Result<RememberResult, ConchError>
pub fn remember_fact_dedup( &self, subject: &str, relation: &str, object: &str, ) -> Result<RememberResult, ConchError>
Store a fact with dedup check. If a near-duplicate exists (cosine sim > 0.95), the existing memory is reinforced instead of creating a new one.
Store a fact with dedup check and tags.
Sourcepub fn remember_fact_dedup_full(
&self,
subject: &str,
relation: &str,
object: &str,
tags: &[String],
source: Option<&str>,
session_id: Option<&str>,
channel: Option<&str>,
) -> Result<RememberResult, ConchError>
pub fn remember_fact_dedup_full( &self, subject: &str, relation: &str, object: &str, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, ) -> Result<RememberResult, ConchError>
Store a fact with upsert + dedup check, tags, and source tracking.
Pipeline:
- If a fact with the same subject+relation exists, update its object (upsert).
- Otherwise, check for near-duplicate embeddings (cosine sim > 0.95).
- If neither, create a new fact.
Sourcepub fn remember_episode_dedup(
&self,
text: &str,
) -> Result<RememberResult, ConchError>
pub fn remember_episode_dedup( &self, text: &str, ) -> Result<RememberResult, ConchError>
Store an episode with dedup check. If a near-duplicate exists (cosine sim > 0.95), the existing memory is reinforced instead of creating a new one.
Store an episode with dedup check and tags.
Sourcepub fn remember_episode_dedup_full(
&self,
text: &str,
tags: &[String],
source: Option<&str>,
session_id: Option<&str>,
channel: Option<&str>,
) -> Result<RememberResult, ConchError>
pub fn remember_episode_dedup_full( &self, text: &str, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, ) -> Result<RememberResult, ConchError>
Store an episode with dedup check, tags, and source tracking.
pub fn recall( &self, query: &str, limit: usize, ) -> Result<Vec<RecallResult>, ConchError>
pub fn recall_with_tag( &self, query: &str, limit: usize, tag: Option<&str>, ) -> Result<Vec<RecallResult>, ConchError>
pub fn forget_by_subject(&self, subject: &str) -> Result<usize, ConchError>
pub fn forget_by_id(&self, id: &str) -> Result<usize, ConchError>
pub fn forget_older_than(&self, secs: i64) -> Result<usize, ConchError>
pub fn decay(&self) -> Result<DecayResult, ConchError>
pub fn stats(&self) -> Result<MemoryStats, ConchError>
pub fn embed_all(&self) -> Result<usize, ConchError>
Find all facts related to a subject via graph traversal up to max_depth hops.
Returns a list of GraphNodes with hop distance.
Sourcepub fn why(&self, id: i64) -> Result<Option<ProvenanceInfo>, ConchError>
pub fn why(&self, id: i64) -> Result<Option<ProvenanceInfo>, ConchError>
Get provenance information for a memory by ID, including metadata and 1-hop related facts.
pub fn export(&self) -> Result<ExportData, ConchError>
pub fn consolidate( &self, dry_run: bool, ) -> Result<ConsolidateResult, ConchError>
pub fn consolidate_clusters( &self, ) -> Result<Vec<ConsolidateCluster>, ConchError>
pub fn score_importance(&self) -> Result<usize, ConchError>
pub fn list_importance(&self) -> Result<Vec<ImportanceInfo>, ConchError>
pub fn set_importance(&self, id: i64, importance: f64) -> Result<(), ConchError>
pub fn import(&self, data: &ExportData) -> Result<usize, ConchError>
pub fn audit_log( &self, limit: usize, memory_id: Option<i64>, actor: Option<&str>, ) -> Result<Vec<AuditEntry>, ConchError>
pub fn verify(&self) -> Result<VerifyResult, ConchError>
Auto Trait Implementations§
impl !Freeze for ConchDB
impl !RefUnwindSafe for ConchDB
impl Send for ConchDB
impl !Sync for ConchDB
impl Unpin for ConchDB
impl UnsafeUnpin for ConchDB
impl !UnwindSafe for ConchDB
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more