Entity attributes in prompts (#284)
* add node attributes to prompts * tested * attribute update
This commit is contained in:
parent
a18dde36be
commit
7f20b21572
4 changed files with 14 additions and 4 deletions
|
|
@ -64,7 +64,7 @@ def node(context: dict[str, Any]) -> list[Message]:
|
|||
{json.dumps(context['existing_nodes'], indent=2)}
|
||||
</EXISTING NODES>
|
||||
|
||||
Given the above EXISTING NODES, MESSAGE, and PREVIOUS MESSAGES. Determine if the NEW NODE extracted from the conversation
|
||||
Given the above EXISTING NODES and their attributes, MESSAGE, and PREVIOUS MESSAGES. Determine if the NEW NODE extracted from the conversation
|
||||
is a duplicate entity of one of the EXISTING NODES.
|
||||
|
||||
<NEW NODE>
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ def node_search_filter_query_constructor(
|
|||
filter_params: dict[str, Any] = {}
|
||||
|
||||
if filters.node_labels is not None:
|
||||
node_labels = ':'.join(filters.node_labels)
|
||||
node_labels = '|'.join(filters.node_labels)
|
||||
node_label_filter = ' AND n:' + node_labels
|
||||
filter_query += node_label_filter
|
||||
|
||||
|
|
|
|||
|
|
@ -289,7 +289,10 @@ async def resolve_extracted_node(
|
|||
start = time()
|
||||
|
||||
# Prepare context for LLM
|
||||
existing_nodes_context = [{'uuid': node.uuid, 'name': node.name} for node in existing_nodes]
|
||||
existing_nodes_context = [
|
||||
{'uuid': node.uuid, 'name': node.name, 'attributes': node.attributes}
|
||||
for node in existing_nodes
|
||||
]
|
||||
|
||||
extracted_node_context = {
|
||||
'uuid': extracted_node.uuid,
|
||||
|
|
@ -366,6 +369,13 @@ async def resolve_extracted_node(
|
|||
node = existing_node
|
||||
node.name = name
|
||||
node.summary = summary_response.get('summary', '')
|
||||
|
||||
new_attributes = existing_node.attributes
|
||||
existing_attributes = existing_node.attributes
|
||||
for attribute_name, attribute_value in existing_attributes.items():
|
||||
if new_attributes.get(attribute_name) is None:
|
||||
new_attributes[attribute_name] = attribute_value
|
||||
|
||||
uuid_map[extracted_node.uuid] = existing_node.uuid
|
||||
|
||||
end = time()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "graphiti-core"
|
||||
version = "0.7.6"
|
||||
version = "0.7.7"
|
||||
description = "A temporal graph building library"
|
||||
authors = [
|
||||
"Paul Paliychuk <paul@getzep.com>",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue