Skip to main content

MemoryNode

Struct MemoryNode 

Source
pub struct MemoryNode {
Show 15 fields pub id: MemoryId, pub agent_id: AgentId, pub memory_type: MemoryType, pub embedding: Embedding, pub content: String, pub created_at: Timestamp, pub accessed_at: Timestamp, pub access_count: u32, pub salience: Salience, pub confidence: Confidence, pub space_id: SpaceId, pub attributes: HashMap<String, AttributeValue>, pub tags: Vec<String>, pub valid_from: Option<Timestamp>, pub valid_until: Option<Timestamp>,
}
Expand description

A memory node: the atomic unit of knowledge in MenteDB.

Combines vector embeddings, graph connections, temporal properties, and flexible attributes in a single primitive.

Fields§

§id: MemoryId

Unique identifier.

§agent_id: AgentId

The agent that owns this memory.

§memory_type: MemoryType

Memory type classification.

§embedding: Embedding

Embedding vector for semantic similarity search.

§content: String

Human-readable content.

§created_at: Timestamp

When this memory was created.

§accessed_at: Timestamp

When this memory was last accessed.

§access_count: u32

How many times this memory has been accessed.

§salience: Salience

Current salience score (decays over time).

§confidence: Confidence

Confidence in this memory’s accuracy.

§space_id: SpaceId

The memory space this belongs to.

§attributes: HashMap<String, AttributeValue>

Flexible key-value attributes.

§tags: Vec<String>

Tags for bitmap indexing.

§valid_from: Option<Timestamp>

When this fact became true in the real world. None means valid since creation.

§valid_until: Option<Timestamp>

When this fact stopped being true. None means still valid.

Implementations§

Source§

impl MemoryNode

Source

pub fn new( agent_id: AgentId, memory_type: MemoryType, content: String, embedding: Embedding, ) -> Self

Create a new memory node with the given content and embedding.

Source§

impl MemoryNode

Source

pub fn is_valid_at(&self, at: Timestamp) -> bool

Returns true if this memory is temporally valid at the given timestamp.

Source

pub fn invalidate(&mut self, at: Timestamp)

Mark this memory as no longer valid.

Source

pub fn is_invalidated(&self) -> bool

Returns true if this memory has been invalidated.

Trait Implementations§

Source§

impl Clone for MemoryNode

Source§

fn clone(&self) -> MemoryNode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MemoryNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for MemoryNode

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for MemoryNode

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,