add get_by_entity_node_uuid (#357)
* add get_by_entity_node_uuid * Update graphiti_core/nodes.py Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
This commit is contained in:
parent
11e19a35b7
commit
c19f9d09d3
1 changed files with 25 additions and 0 deletions
|
|
@ -251,6 +251,31 @@ class EpisodicNode(Node):
|
||||||
|
|
||||||
return episodes
|
return episodes
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
async def get_by_entity_node_uuid(cls, driver: AsyncDriver, entity_node_uuid: str):
|
||||||
|
records, _, _ = await driver.execute_query(
|
||||||
|
"""
|
||||||
|
MATCH (e:Episodic)-[r:MENTIONS]->(n:Entity {uuid: $entity_node_uuid})
|
||||||
|
RETURN DISTINCT
|
||||||
|
e.content AS content,
|
||||||
|
e.created_at AS created_at,
|
||||||
|
e.valid_at AS valid_at,
|
||||||
|
e.uuid AS uuid,
|
||||||
|
e.name AS name,
|
||||||
|
e.group_id AS group_id,
|
||||||
|
e.source_description AS source_description,
|
||||||
|
e.source AS source,
|
||||||
|
e.entity_edges AS entity_edges
|
||||||
|
""",
|
||||||
|
entity_node_uuid=entity_node_uuid,
|
||||||
|
database_=DEFAULT_DATABASE,
|
||||||
|
routing_='r',
|
||||||
|
)
|
||||||
|
|
||||||
|
episodes = [get_episodic_node_from_record(record) for record in records]
|
||||||
|
|
||||||
|
return episodes
|
||||||
|
|
||||||
|
|
||||||
class EntityNode(Node):
|
class EntityNode(Node):
|
||||||
name_embedding: list[float] | None = Field(default=None, description='embedding of the name')
|
name_embedding: list[float] | None = Field(default=None, description='embedding of the name')
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue