pub struct Entity {
pub id: EntityId,
pub project_id: ProjectId,
pub name: String,
pub entity_type: EntityType,
pub observations: Vec<Observation>,
pub tags: Vec<String>,
pub metadata: HashMap<String, Value>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub embedding: Option<Vec<f32>>,
}Expand description
An entity in the knowledge graph (a node)
Fields§
§id: EntityIdUnique identifier
project_id: ProjectIdProject this entity belongs to
name: StringEntity name (unique within project)
entity_type: EntityTypeEntity type/category
observations: Vec<Observation>Observations (facts) about this entity
Tags for categorization
metadata: HashMap<String, Value>Arbitrary metadata
created_at: DateTime<Utc>Creation timestamp
updated_at: DateTime<Utc>Last update timestamp
embedding: Option<Vec<f32>>Optional vector embedding for semantic search
Implementations§
Source§impl Entity
impl Entity
Sourcepub fn new(
project_id: ProjectId,
name: impl Into<String>,
entity_type: impl Into<EntityType>,
) -> Self
pub fn new( project_id: ProjectId, name: impl Into<String>, entity_type: impl Into<EntityType>, ) -> Self
Create a new entity
Sourcepub fn add_observation(&mut self, content: impl Into<String>) -> &Observation
pub fn add_observation(&mut self, content: impl Into<String>) -> &Observation
Add an observation to this entity
Sourcepub fn remove_tag(&mut self, tag: &str) -> bool
pub fn remove_tag(&mut self, tag: &str) -> bool
Remove a tag from this entity
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Entity
impl<'de> Deserialize<'de> for Entity
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Entity
impl RefUnwindSafe for Entity
impl Send for Entity
impl Sync for Entity
impl Unpin for Entity
impl UnsafeUnpin for Entity
impl UnwindSafe for Entity
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
Mutably borrows from an owned value. Read more