Node name bug fix (#622)

* fixes

* fix bugs

* change version
This commit is contained in:
Preston Rasmussen 2025-06-24 17:13:27 -04:00 committed by GitHub
parent dd4da318b6
commit 2b27353097
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 12 additions and 13 deletions

View file

@ -35,7 +35,7 @@ ENTITY_EDGE_SAVE = """
MATCH (target:Entity {uuid: $target_uuid}) MATCH (target:Entity {uuid: $target_uuid})
MERGE (source)-[r:RELATES_TO {uuid: $uuid}]->(target) MERGE (source)-[r:RELATES_TO {uuid: $uuid}]->(target)
SET r = $edge_data SET r = $edge_data
WITH r CALL db.create.setRelationshipVectorProperty(r, "fact_embedding", $fact_embedding) WITH r CALL db.create.setRelationshipVectorProperty(r, "fact_embedding", $edge_data.fact_embedding)
RETURN r.uuid AS uuid""" RETURN r.uuid AS uuid"""
ENTITY_EDGE_SAVE_BULK = """ ENTITY_EDGE_SAVE_BULK = """

View file

@ -30,7 +30,7 @@ class NodeDuplicate(BaseModel):
) )
name: str = Field( name: str = Field(
..., ...,
description='Name of the entity. Should be the most complete and descriptive name possible. Do not include any JSON formatting in the Entity name.', description='Name of the entity. Should be the most complete and descriptive name of the entity. Do not include any JSON formatting in the Entity name such as {}.',
) )
additional_duplicates: list[int] = Field( additional_duplicates: list[int] = Field(
..., ...,
@ -84,19 +84,19 @@ def node(context: dict[str, Any]) -> list[Message]:
is a duplicate entity of one of the EXISTING ENTITIES. is a duplicate entity of one of the EXISTING ENTITIES.
Entities should only be considered duplicates if they refer to the *same real-world object or concept*. Entities should only be considered duplicates if they refer to the *same real-world object or concept*.
Semantic Equivalence: if a descriptive label in existing_entities clearly refers to a named entity in context, treat them as duplicates.
Do NOT mark entities as duplicates if: Do NOT mark entities as duplicates if:
- They are related but distinct. - They are related but distinct.
- They have similar names or purposes but refer to separate instances or concepts. - They have similar names or purposes but refer to separate instances or concepts.
Task: TASK:
If the NEW ENTITY represents a duplicate entity of any entity in EXISTING ENTITIES, set duplicate_entity_id to the 1. Compare `new_entity` against each item in `existing_entities`.
id of the EXISTING ENTITY that is the duplicate. 2. If it refers to the same realworld object or concept, collect its index.
3. Let `duplicate_idx` = the *first* collected index, or 1 if none.
4. Let `additional_duplicates` = the list of *any other* collected indices (empty list if none).
If the NEW ENTITY is not a duplicate of any of the EXISTING ENTITIES, Also return the full name of the NEW ENTITY (whether it is the name of the NEW ENTITY, a node it
duplicate_entity_id should be set to -1.
Also return the name that best describes the NEW ENTITY (whether it is the name of the NEW ENTITY, a node it
is a duplicate of, or a combination of the two). is a duplicate of, or a combination of the two).
""", """,
), ),

View file

@ -97,8 +97,7 @@ Only extract facts that:
- The FACT TYPES provide a list of the most important types of facts, make sure to extract facts of these types - The FACT TYPES provide a list of the most important types of facts, make sure to extract facts of these types
- The FACT TYPES are not an exhaustive list, extract all facts from the message even if they do not fit into one - The FACT TYPES are not an exhaustive list, extract all facts from the message even if they do not fit into one
of the FACT TYPES of the FACT TYPES
- The FACT TYPES each contain their fact_type_signature which represents the entity types which that fact_type is defined for. - The FACT TYPES each contain their fact_type_signature which represents the source and target entity types.
A Type of Entity in the signature represents any extracted entity (it is a generic universal type for all entities).
You may use information from the PREVIOUS MESSAGES only to disambiguate references or support continuity. You may use information from the PREVIOUS MESSAGES only to disambiguate references or support continuity.

View file

@ -310,7 +310,7 @@ async def resolve_extracted_nodes(
else extracted_node else extracted_node
) )
resolved_node.name = resolution.get('name') # resolved_node.name = resolution.get('name')
resolved_nodes.append(resolved_node) resolved_nodes.append(resolved_node)
uuid_map[extracted_node.uuid] = resolved_node.uuid uuid_map[extracted_node.uuid] = resolved_node.uuid

View file

@ -1,7 +1,7 @@
[project] [project]
name = "graphiti-core" name = "graphiti-core"
description = "A temporal graph building library" description = "A temporal graph building library"
version = "0.12.4" version = "0.13.0"
authors = [ authors = [
{ "name" = "Paul Paliychuk", "email" = "paul@getzep.com" }, { "name" = "Paul Paliychuk", "email" = "paul@getzep.com" },
{ "name" = "Preston Rasmussen", "email" = "preston@getzep.com" }, { "name" = "Preston Rasmussen", "email" = "preston@getzep.com" },