Skip to main content

ConchDB

Struct ConchDB 

Source
pub struct ConchDB { /* private fields */ }
Expand description

High-level API wrapping storage + embeddings.

Implementations§

Source§

impl ConchDB

Source

pub fn open(path: &str) -> Result<Self, ConchError>

Source

pub fn open_with_namespace( path: &str, namespace: &str, ) -> Result<Self, ConchError>

Source

pub fn open_in_memory_with( embedder: Box<dyn Embedder>, ) -> Result<Self, ConchError>

Source

pub fn open_in_memory_with_namespace( embedder: Box<dyn Embedder>, namespace: &str, ) -> Result<Self, ConchError>

Source

pub fn namespace(&self) -> &str

Source

pub fn store(&self) -> &MemoryStore

Source

pub fn remember_fact( &self, subject: &str, relation: &str, object: &str, ) -> Result<MemoryRecord, ConchError>

Source

pub fn remember_fact_with_tags( &self, subject: &str, relation: &str, object: &str, tags: &[String], ) -> Result<MemoryRecord, ConchError>

Source

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>

Source

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).

Source

pub fn upsert_fact_with_tags( &self, subject: &str, relation: &str, object: &str, tags: &[String], ) -> Result<(MemoryRecord, bool), ConchError>

Source

pub fn remember_episode(&self, text: &str) -> Result<MemoryRecord, ConchError>

Source

pub fn remember_episode_with_tags( &self, text: &str, tags: &[String], ) -> Result<MemoryRecord, ConchError>

Source

pub fn remember_episode_full( &self, text: &str, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, ) -> Result<MemoryRecord, ConchError>

Source

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.

Source

pub fn remember_fact_dedup_with_tags( &self, subject: &str, relation: &str, object: &str, tags: &[String], ) -> Result<RememberResult, ConchError>

Store a fact with dedup check and tags.

Source

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:

  1. If a fact with the same subject+relation exists, update its object (upsert).
  2. Otherwise, check for near-duplicate embeddings (cosine sim > 0.95).
  3. If neither, create a new fact.
Source

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.

Source

pub fn remember_episode_dedup_with_tags( &self, text: &str, tags: &[String], ) -> Result<RememberResult, ConchError>

Store an episode with dedup check and tags.

Source

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.

Source

pub fn recall( &self, query: &str, limit: usize, ) -> Result<Vec<RecallResult>, ConchError>

Source

pub fn recall_with_tag( &self, query: &str, limit: usize, tag: Option<&str>, ) -> Result<Vec<RecallResult>, ConchError>

Source

pub fn forget_by_subject(&self, subject: &str) -> Result<usize, ConchError>

Source

pub fn forget_by_id(&self, id: &str) -> Result<usize, ConchError>

Source

pub fn forget_older_than(&self, secs: i64) -> Result<usize, ConchError>

Source

pub fn decay(&self) -> Result<DecayResult, ConchError>

Source

pub fn stats(&self) -> Result<MemoryStats, ConchError>

Source

pub fn embed_all(&self) -> Result<usize, ConchError>

Source

pub fn related( &self, subject: &str, max_depth: usize, ) -> Result<Vec<GraphNode>, ConchError>

Find all facts related to a subject via graph traversal up to max_depth hops. Returns a list of GraphNodes with hop distance.

Source

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.

Source

pub fn export(&self) -> Result<ExportData, ConchError>

Source

pub fn consolidate( &self, dry_run: bool, ) -> Result<ConsolidateResult, ConchError>

Source

pub fn consolidate_clusters( &self, ) -> Result<Vec<ConsolidateCluster>, ConchError>

Source

pub fn score_importance(&self) -> Result<usize, ConchError>

Source

pub fn list_importance(&self) -> Result<Vec<ImportanceInfo>, ConchError>

Source

pub fn set_importance(&self, id: i64, importance: f64) -> Result<(), ConchError>

Source

pub fn import(&self, data: &ExportData) -> Result<usize, ConchError>

Source

pub fn audit_log( &self, limit: usize, memory_id: Option<i64>, actor: Option<&str>, ) -> Result<Vec<AuditEntry>, ConchError>

Source

pub fn verify(&self) -> Result<VerifyResult, ConchError>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V