pub struct Entity {
pub base: DataPoint,
pub name: String,
pub is_a: Option<Uuid>,
pub description: String,
}Expand description
Storage-layer entity model.
Represents an entity (e.g., “TechCorp”, “Alice”, “London”) extracted from text. Each entity has a name, description, and a reference to its EntityType (e.g., “Organization”, “Person”, “Location”).
Fields§
§base: DataPointBase data point fields (id, timestamps, metadata, etc.)
name: StringEntity name (e.g., “TechCorp”)
is_a: Option<Uuid>Reference to EntityType UUID (e.g., UUID of “Organization” type)
description: StringEntity description from LLM extraction
Implementations§
Source§impl Entity
impl Entity
Sourcepub const INDEX_FIELDS: &'static [&'static str]
pub const INDEX_FIELDS: &'static [&'static str]
Index fields to embed for vector search.
Sourcepub fn new(
name: impl Into<String>,
entity_type_id: Option<Uuid>,
description: impl Into<String>,
dataset_id: Option<Uuid>,
) -> Self
pub fn new( name: impl Into<String>, entity_type_id: Option<Uuid>, description: impl Into<String>, dataset_id: Option<Uuid>, ) -> Self
Create a new Entity.
§Arguments
name- Entity nameentity_type_id- Optional reference to EntityTypedescription- Entity descriptiondataset_id- Dataset UUID
Sourcepub fn from_node(
node_id: impl Into<String>,
node_name: impl Into<String>,
node_description: impl Into<String>,
entity_type_id: Uuid,
dataset_id: Option<Uuid>,
) -> Self
pub fn from_node( node_id: impl Into<String>, node_name: impl Into<String>, node_description: impl Into<String>, entity_type_id: Uuid, dataset_id: Option<Uuid>, ) -> Self
Create Entity from LLM-extracted Node.
§Arguments
node_id- Original node ID from LLM extractionnode_name- Node namenode_description- Node descriptionentity_type_id- EntityType UUIDdataset_id- Dataset UUID
Sourcepub fn get_embeddable_text(&self) -> String
pub fn get_embeddable_text(&self) -> String
Get the entity name (for embedding).
Sourcepub fn set_description(&mut self, description: impl Into<String>)
pub fn set_description(&mut self, description: impl Into<String>)
Update entity description.
Sourcepub fn set_entity_type(&mut self, entity_type_id: Uuid)
pub fn set_entity_type(&mut self, entity_type_id: Uuid)
Update entity type reference.
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
Source§impl HasDataPoint for Entity
impl HasDataPoint for Entity
Source§fn data_point(&self) -> &DataPoint
fn data_point(&self) -> &DataPoint
Borrow the embedded
DataPoint of this container.Source§fn data_point_mut(&mut self) -> &mut DataPoint
fn data_point_mut(&mut self) -> &mut DataPoint
Mutably borrow the embedded
DataPoint of this container.Source§fn for_each_child_mut(&mut self, _visit: &mut dyn FnMut(&mut dyn HasDataPoint))
fn for_each_child_mut(&mut self, _visit: &mut dyn FnMut(&mut dyn HasDataPoint))
Visit every owned child that itself implements
HasDataPoint.
Default: no children. Override on container types whose fields
own (rather than reference by Uuid) another HasDataPoint.impl StructuralPartialEq for Entity
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