Class: Leash::Integration::MemoryClient
- Inherits:
-
Object
- Object
- Leash::Integration::MemoryClient
- Defined in:
- lib/leash/integration/memory.rb
Instance Method Summary collapse
-
#add_observations(observations) ⇒ Object
Add new observations to existing entities in the knowledge graph.
-
#create_entities(entities) ⇒ Object
Create multiple new entities in the knowledge graph.
-
#create_relations(relations) ⇒ Object
Create multiple new relations between entities in the knowledge graph.
-
#delete_entities(entitynames) ⇒ Object
Delete multiple entities and their associated relations from the knowledge graph.
-
#delete_observations(deletions) ⇒ Object
Delete specific observations from entities in the knowledge graph.
-
#delete_relations(relations) ⇒ Object
Delete multiple relations from the knowledge graph.
-
#initialize(leash) ⇒ MemoryClient
constructor
Create a new Memory integration client.
-
#open_nodes(names) ⇒ Object
Open specific nodes in the knowledge graph by their names.
-
#read_graph ⇒ Object
Read the entire knowledge graph.
-
#search_nodes(query) ⇒ Object
Search for nodes in the knowledge graph based on a query.
Constructor Details
#initialize(leash) ⇒ MemoryClient
Create a new Memory integration client.
11 12 13 |
# File 'lib/leash/integration/memory.rb', line 11 def initialize(leash) @leash = leash end |
Instance Method Details
#add_observations(observations) ⇒ Object
Add new observations to existing entities in the knowledge graph
41 42 43 44 45 46 |
# File 'lib/leash/integration/memory.rb', line 41 def add_observations(observations) params = { 'observations' => observations }.compact @leash.call('memory', 'add_observations', params) end |
#create_entities(entities) ⇒ Object
Create multiple new entities in the knowledge graph
19 20 21 22 23 24 |
# File 'lib/leash/integration/memory.rb', line 19 def create_entities(entities) params = { 'entities' => entities }.compact @leash.call('memory', 'create_entities', params) end |
#create_relations(relations) ⇒ Object
Create multiple new relations between entities in the knowledge graph. Relations should be in active voice
30 31 32 33 34 35 |
# File 'lib/leash/integration/memory.rb', line 30 def create_relations(relations) params = { 'relations' => relations }.compact @leash.call('memory', 'create_relations', params) end |
#delete_entities(entitynames) ⇒ Object
Delete multiple entities and their associated relations from the knowledge graph
52 53 54 55 56 57 |
# File 'lib/leash/integration/memory.rb', line 52 def delete_entities(entitynames) params = { 'entityNames' => entitynames }.compact @leash.call('memory', 'delete_entities', params) end |
#delete_observations(deletions) ⇒ Object
Delete specific observations from entities in the knowledge graph
63 64 65 66 67 68 |
# File 'lib/leash/integration/memory.rb', line 63 def delete_observations(deletions) params = { 'deletions' => deletions }.compact @leash.call('memory', 'delete_observations', params) end |
#delete_relations(relations) ⇒ Object
Delete multiple relations from the knowledge graph
74 75 76 77 78 79 |
# File 'lib/leash/integration/memory.rb', line 74 def delete_relations(relations) params = { 'relations' => relations }.compact @leash.call('memory', 'delete_relations', params) end |
#open_nodes(names) ⇒ Object
Open specific nodes in the knowledge graph by their names
104 105 106 107 108 109 |
# File 'lib/leash/integration/memory.rb', line 104 def open_nodes(names) params = { 'names' => names }.compact @leash.call('memory', 'open_nodes', params) end |
#read_graph ⇒ Object
Read the entire knowledge graph
84 85 86 87 |
# File 'lib/leash/integration/memory.rb', line 84 def read_graph params = {} @leash.call('memory', 'read_graph', params) end |
#search_nodes(query) ⇒ Object
Search for nodes in the knowledge graph based on a query
93 94 95 96 97 98 |
# File 'lib/leash/integration/memory.rb', line 93 def search_nodes(query) params = { 'query' => query }.compact @leash.call('memory', 'search_nodes', params) end |