Class: Llmemory::LongTerm::GraphBased::Node
- Inherits:
-
Struct
- Object
- Struct
- Llmemory::LongTerm::GraphBased::Node
- Defined in:
- lib/llmemory/long_term/graph_based/node.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#entity_type ⇒ Object
Returns the value of attribute entity_type.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#provenance ⇒ Object
Lineage of this node, stored within properties so it round-trips through every backend without a schema change.
- #to_h ⇒ Object
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at
6 7 8 |
# File 'lib/llmemory/long_term/graph_based/node.rb', line 6 def created_at @created_at end |
#entity_type ⇒ Object
Returns the value of attribute entity_type
6 7 8 |
# File 'lib/llmemory/long_term/graph_based/node.rb', line 6 def entity_type @entity_type end |
#id ⇒ Object
Returns the value of attribute id
6 7 8 |
# File 'lib/llmemory/long_term/graph_based/node.rb', line 6 def id @id end |
#name ⇒ Object
Returns the value of attribute name
6 7 8 |
# File 'lib/llmemory/long_term/graph_based/node.rb', line 6 def name @name end |
#properties ⇒ Object
Returns the value of attribute properties
6 7 8 |
# File 'lib/llmemory/long_term/graph_based/node.rb', line 6 def properties @properties end |
#updated_at ⇒ Object
Returns the value of attribute updated_at
6 7 8 |
# File 'lib/llmemory/long_term/graph_based/node.rb', line 6 def updated_at @updated_at end |
#user_id ⇒ Object
Returns the value of attribute user_id
6 7 8 |
# File 'lib/llmemory/long_term/graph_based/node.rb', line 6 def user_id @user_id end |
Class Method Details
.from_h(hash) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/llmemory/long_term/graph_based/node.rb', line 16 def self.from_h(hash) new( id: hash[:id] || hash["id"], user_id: hash[:user_id] || hash["user_id"], entity_type: (hash[:entity_type] || hash["entity_type"]).to_s, name: (hash[:name] || hash["name"]).to_s, properties: hash[:properties] || hash["properties"] || {}, created_at: hash[:created_at] || hash["created_at"], updated_at: hash[:updated_at] || hash["updated_at"] ) end |
Instance Method Details
#provenance ⇒ Object
Lineage of this node, stored within properties so it round-trips through every backend without a schema change. See Llmemory::Provenance.
30 31 32 33 |
# File 'lib/llmemory/long_term/graph_based/node.rb', line 30 def provenance props = properties || {} props[:provenance] || props["provenance"] end |
#to_h ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/llmemory/long_term/graph_based/node.rb', line 35 def to_h { id: id, user_id: user_id, entity_type: entity_type, name: name, properties: properties || {}, created_at: created_at, updated_at: updated_at } end |