Skip to content

Commit 0420350

Browse files
authored
fix bug with updating node type attributes (#305)
fix bug with saving new properties
1 parent 4307274 commit 0420350

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

graphiti_core/prompts/summarize_nodes.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@ def summarize_context(context: dict[str, Any]) -> list[Message]:
8585
provided ENTITY. Summaries must be under 500 words.
8686
8787
In addition, extract any values for the provided entity properties based on their descriptions.
88-
If the value of the entity property cannot be found in the current context, set the value of the property to None.
89-
Do not hallucinate entity property values if they cannot be found in the current context.
88+
If the value of the entity property cannot be found in the current context, set the value of the property to the Python value None.
89+
90+
Guidelines:
91+
1. Do not hallucinate entity property values if they cannot be found in the current context.
9092
9193
<ENTITY>
9294
{context['node_name']}

graphiti_core/utils/maintenance/node_operations.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,11 @@ async def resolve_extracted_node(
364364
)
365365

366366
extracted_node.summary = node_attributes_response.get('summary', '')
367-
extracted_node.attributes.update(node_attributes_response)
367+
node_attributes = {
368+
key: value if value != 'None' else None for key, value in node_attributes_response.items()
369+
}
370+
371+
extracted_node.attributes.update(node_attributes)
368372

369373
is_duplicate: bool = llm_response.get('is_duplicate', False)
370374
uuid: str | None = llm_response.get('uuid', None)
@@ -386,11 +390,12 @@ async def resolve_extracted_node(
386390
node.name = name
387391
node.summary = summary_response.get('summary', '')
388392

389-
new_attributes = existing_node.attributes
393+
new_attributes = extracted_node.attributes
390394
existing_attributes = existing_node.attributes
391395
for attribute_name, attribute_value in existing_attributes.items():
392396
if new_attributes.get(attribute_name) is None:
393397
new_attributes[attribute_name] = attribute_value
398+
node.attributes = new_attributes
394399

395400
uuid_map[extracted_node.uuid] = existing_node.uuid
396401

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "graphiti-core"
3-
version = "0.8.2"
3+
version = "0.8.3"
44
description = "A temporal graph building library"
55
authors = [
66
"Paul Paliychuk <paul@getzep.com>",

0 commit comments

Comments
 (0)