fix bug with updating node type attributes (#305)

fix bug with saving new properties
This commit is contained in:
Preston Rasmussen 2025-03-26 12:37:48 -04:00 committed by GitHub
parent 4307274967
commit 04203506d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 5 deletions

View file

@ -85,8 +85,10 @@ def summarize_context(context: dict[str, Any]) -> list[Message]:
provided ENTITY. Summaries must be under 500 words.
In addition, extract any values for the provided entity properties based on their descriptions.
If the value of the entity property cannot be found in the current context, set the value of the property to None.
Do not hallucinate entity property values if they cannot be found in the current context.
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.
Guidelines:
1. Do not hallucinate entity property values if they cannot be found in the current context.
<ENTITY>
{context['node_name']}

View file

@ -364,7 +364,11 @@ async def resolve_extracted_node(
)
extracted_node.summary = node_attributes_response.get('summary', '')
extracted_node.attributes.update(node_attributes_response)
node_attributes = {
key: value if value != 'None' else None for key, value in node_attributes_response.items()
}
extracted_node.attributes.update(node_attributes)
is_duplicate: bool = llm_response.get('is_duplicate', False)
uuid: str | None = llm_response.get('uuid', None)
@ -386,11 +390,12 @@ async def resolve_extracted_node(
node.name = name
node.summary = summary_response.get('summary', '')
new_attributes = existing_node.attributes
new_attributes = extracted_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
node.attributes = new_attributes
uuid_map[extracted_node.uuid] = existing_node.uuid

View file

@ -1,6 +1,6 @@
[tool.poetry]
name = "graphiti-core"
version = "0.8.2"
version = "0.8.3"
description = "A temporal graph building library"
authors = [
"Paul Paliychuk <paul@getzep.com>",