mirror of
https://github.com/getzep/graphiti.git
synced 2025-06-27 02:00:02 +00:00
parent
dd4da318b6
commit
2b27353097
@ -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 = """
|
||||
|
@ -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).
|
||||
""",
|
||||
),
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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
|
||||
|
@ -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" },
|
||||
|
Loading…
x
Reference in New Issue
Block a user