pub struct Entity {
pub id: String,
pub entity_type: EntityType,
pub name: String,
pub content: String,
pub metadata: HashMap<String, String>,
pub embedding: Option<Vec<f32>>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub document_time: Option<DateTime<Utc>>,
pub event_time: Option<DateTime<Utc>>,
pub source_ref: Option<SourceRef>,
}Expand description
An entity in archival memory.
TigerStyle: Explicit fields, no Option where not needed.
§Temporal Metadata (ADR-006)
Entities support bi-temporal tracking:
document_time: When the source document was created (e.g., email sent date)event_time: When the event actually occurred (e.g., “I met Alice last Tuesday”)
This enables queries like “What happened last week?” to find events by when they occurred, not just when they were recorded.
Fields§
§id: StringUnique identifier (UUID v4)
entity_type: EntityTypeType of entity
name: StringDisplay name
content: StringMain content
metadata: HashMap<String, String>Additional metadata
embedding: Option<Vec<f32>>Embedding vector (for semantic search)
created_at: DateTime<Utc>Creation timestamp (when stored in Umi)
updated_at: DateTime<Utc>Last update timestamp
document_time: Option<DateTime<Utc>>When source document was created (e.g., email sent date)
event_time: Option<DateTime<Utc>>When event actually occurred (e.g., “last Tuesday”)
source_ref: Option<SourceRef>Reference to source content (for multimedia workflows)
Implementations§
Source§impl Entity
impl Entity
Sourcepub fn new(entity_type: EntityType, name: String, content: String) -> Self
pub fn new(entity_type: EntityType, name: String, content: String) -> Self
Sourcepub fn builder(
entity_type: EntityType,
name: String,
content: String,
) -> EntityBuilder
pub fn builder( entity_type: EntityType, name: String, content: String, ) -> EntityBuilder
Create a builder for more complex entity construction.
Sourcepub fn has_embedding(&self) -> bool
pub fn has_embedding(&self) -> bool
Check if entity has an embedding.
Sourcepub fn get_metadata(&self, key: &str) -> Option<&str>
pub fn get_metadata(&self, key: &str) -> Option<&str>
Get metadata value.
Sourcepub fn update_content(&mut self, content: String)
pub fn update_content(&mut self, content: String)
Update content and timestamp.
Sourcepub fn set_embedding(&mut self, embedding: Vec<f32>)
pub fn set_embedding(&mut self, embedding: Vec<f32>)
Set embedding.
Sourcepub fn set_document_time(&mut self, time: DateTime<Utc>)
pub fn set_document_time(&mut self, time: DateTime<Utc>)
Set document time (when source was created).
Sourcepub fn set_event_time(&mut self, time: DateTime<Utc>)
pub fn set_event_time(&mut self, time: DateTime<Utc>)
Set event time (when event actually occurred).
Sourcepub fn document_time(&self) -> Option<DateTime<Utc>>
pub fn document_time(&self) -> Option<DateTime<Utc>>
Get document time.
Sourcepub fn event_time(&self) -> Option<DateTime<Utc>>
pub fn event_time(&self) -> Option<DateTime<Utc>>
Get event time.
Sourcepub fn has_temporal_metadata(&self) -> bool
pub fn has_temporal_metadata(&self) -> bool
Check if entity has temporal metadata.
Sourcepub fn set_source_ref(&mut self, source_ref: SourceRef)
pub fn set_source_ref(&mut self, source_ref: SourceRef)
Set source reference (for multimedia content).
Sourcepub fn source_ref(&self) -> Option<&SourceRef>
pub fn source_ref(&self) -> Option<&SourceRef>
Get source reference.
Sourcepub fn has_source_ref(&self) -> bool
pub fn has_source_ref(&self) -> bool
Check if entity has a source reference.