#[non_exhaustive]pub struct MemoryConfig {Show 13 fields
pub policy: WritePolicy,
pub commit_each_turn: bool,
pub default_tags: Vec<String>,
pub scope: Option<String>,
pub principal: Option<String>,
pub persist_assistant: bool,
pub supplemental_profile_cards: bool,
pub auto_tag: bool,
pub extract_dates: bool,
pub extract_triplets: bool,
pub observe_conversation_id: Option<String>,
pub on_write_failure: WriteFailure,
pub rewrite_principal_pronouns: bool,
}Expand description
Configuration for MemvidPersistHook.
MemoryConfig is #[non_exhaustive] so new fields can be added without a
SemVer-major bump; build instances through MemoryConfig::default +
field updates, or through MemoryConfig::builder for a fluent shape.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.policy: WritePolicyWhat to persist on each turn.
commit_each_turn: boolIf true, call commit() after every turn so the new frames are
immediately searchable. If false, the caller is responsible for
committing periodically.
Tags applied to every persisted frame, useful for later filtering.
scope: Option<String>Logical scope written into the frame’s URI prefix. When set, every
frame produced by this hook is stored with PutOptions.uri = Some(scope),
which makes MemvidFilter::eq("scope", scope) match those
frames at query time (memvid’s scope is a URI prefix filter).
principal: Option<String>Stable identity for the human side of the conversation.
When set, user turns are lightly rewritten before memvid sees
them so first-person pronouns resolve to this principal. For
example, with principal = Some("Alice".into()), I like espresso is persisted as Alice likes espresso. This improves
memvid’s entity / slot / value extraction without requiring an
LLM or a new runtime dependency.
persist_assistant: boolIf true, persist assistant responses as well as user turns.
Defaults to true to preserve the full conversation transcript.
Set to false when the archive is primarily used for user profile
memory and assistant paraphrases would add noisy duplicate cards.
supplemental_profile_cards: boolAdd small deterministic cards for principal-bound user turns when memvid’s built-in triplet extractor misses common user-profile or relationship facts.
Currently covers allergy / avoidance statements and simple
manager / reporting statements after Self::principal has
bound first-person pronouns to the stable entity. Defaults to
true; it is a no-op when principal is None.
auto_tag: boolRun memvid’s auto-tagger over each persisted frame to attach
extracted entity / topic tags. Defaults to true, mirroring
memvid_core::PutOptions::default.
extract_dates: boolRun memvid’s date extractor over each persisted frame so dates
mentioned in conversation become queryable. Defaults to true.
extract_triplets: boolExtract Subject-Predicate-Object triplets from each persisted
frame and store them as memvid_core::MemoryCards on the
memories track. Cards become queryable through
crate::MemvidStore::entity_memories,
crate::MemvidStore::current_memory,
crate::MemvidStore::entity_preferences, and the rest of the
memory-card surface. Defaults to true.
observe_conversation_id: Option<String>Conversation ID stamped on rig_tap events emitted by this
hook (memory.frame_written). When None, the hook falls back to
Self::scope and finally to "default" so existing consumers
keep working, but explicitly setting this field is preferred: it
decouples telemetry correlation from memvid’s URI-prefix scope.
No effect when the observe feature is off.
on_write_failure: WriteFailureWhat to do when a frame fails to write. Defaults to
WriteFailure::Warn (log + continue) to preserve pre-0.2
behaviour. Switch to WriteFailure::Halt when durable memory is a
hard requirement, or supply a WriteFailure::Custom callback to
route the failure into your own metrics / alerting.
rewrite_principal_pronouns: boolWhether to rewrite first-person pronouns in user turns into the
configured Self::principal (English-only heuristic). Defaults
to true, but the rewrite is also a no-op when principal is
None. Set to false to disable the heuristic entirely (e.g.
for non-English transcripts or when callers already canonicalise
text upstream).
The rewrite also short-circuits on a per-text basis when the
turn contains a triple-backtick code fence or a balanced
double-quoted span containing the standalone token I; both are
strong signals that the literal I is quoted speech or code and
must not be rewritten.
Implementations§
Source§impl MemoryConfig
impl MemoryConfig
Sourcepub fn builder() -> MemoryConfigBuilder
pub fn builder() -> MemoryConfigBuilder
Start a MemoryConfigBuilder for fluent construction. Equivalent
to MemoryConfigBuilder::default() but easier to discover.
Trait Implementations§
Source§impl Clone for MemoryConfig
impl Clone for MemoryConfig
Source§fn clone(&self) -> MemoryConfig
fn clone(&self) -> MemoryConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MemoryConfig
impl Debug for MemoryConfig
Auto Trait Implementations§
impl Freeze for MemoryConfig
impl !RefUnwindSafe for MemoryConfig
impl Send for MemoryConfig
impl Sync for MemoryConfig
impl Unpin for MemoryConfig
impl UnsafeUnpin for MemoryConfig
impl !UnwindSafe for MemoryConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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