diff --git a/graphiti_core/models/edges/edge_db_queries.py b/graphiti_core/models/edges/edge_db_queries.py index a1cf547f..f3cda2f2 100644 --- a/graphiti_core/models/edges/edge_db_queries.py +++ b/graphiti_core/models/edges/edge_db_queries.py @@ -35,7 +35,7 @@ ENTITY_EDGE_SAVE = """ MATCH (target:Entity {uuid: $target_uuid}) MERGE (source)-[r:RELATES_TO {uuid: $uuid}]->(target) 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""" ENTITY_EDGE_SAVE_BULK = """ diff --git a/graphiti_core/prompts/dedupe_nodes.py b/graphiti_core/prompts/dedupe_nodes.py index a14c0461..9e06a2a7 100644 --- a/graphiti_core/prompts/dedupe_nodes.py +++ b/graphiti_core/prompts/dedupe_nodes.py @@ -30,7 +30,7 @@ class NodeDuplicate(BaseModel): ) 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( ..., @@ -84,19 +84,19 @@ def node(context: dict[str, Any]) -> list[Message]: 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*. + 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: - They are related but distinct. - They have similar names or purposes but refer to separate instances or concepts. - Task: - If the NEW ENTITY represents a duplicate entity of any entity in EXISTING ENTITIES, set duplicate_entity_id to the - id of the EXISTING ENTITY that is the duplicate. + TASK: + 1. Compare `new_entity` against each item in `existing_entities`. + 2. If it refers to the same real‐world 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, - 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 + Also return the full name of 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). """, ), diff --git a/graphiti_core/prompts/extract_edges.py b/graphiti_core/prompts/extract_edges.py index c7626e28..50e039a4 100644 --- a/graphiti_core/prompts/extract_edges.py +++ b/graphiti_core/prompts/extract_edges.py @@ -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 are not an exhaustive list, extract all facts from the message even if they do not fit into one 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. - A Type of Entity in the signature represents any extracted entity (it is a generic universal type for all entities). +- The FACT TYPES each contain their fact_type_signature which represents the source and target entity types. You may use information from the PREVIOUS MESSAGES only to disambiguate references or support continuity. diff --git a/graphiti_core/utils/maintenance/node_operations.py b/graphiti_core/utils/maintenance/node_operations.py index df466a56..de5a1fa0 100644 --- a/graphiti_core/utils/maintenance/node_operations.py +++ b/graphiti_core/utils/maintenance/node_operations.py @@ -310,7 +310,7 @@ async def resolve_extracted_nodes( else extracted_node ) - resolved_node.name = resolution.get('name') + # resolved_node.name = resolution.get('name') resolved_nodes.append(resolved_node) uuid_map[extracted_node.uuid] = resolved_node.uuid diff --git a/pyproject.toml b/pyproject.toml index 8eff6371..d4f07793 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "graphiti-core" description = "A temporal graph building library" -version = "0.12.4" +version = "0.13.0" authors = [ { "name" = "Paul Paliychuk", "email" = "paul@getzep.com" }, { "name" = "Preston Rasmussen", "email" = "preston@getzep.com" },