From 9c4e98ec3b7a006ae72d5fd20f1d581de279cd9a Mon Sep 17 00:00:00 2001 From: yangdx Date: Sun, 27 Jul 2025 23:06:55 +0800 Subject: [PATCH] Unify entity extraction prompt between passes - Disallow hallucinated info in descriptions - Align reminder steps with main extraction --- lightrag/prompt.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lightrag/prompt.py b/lightrag/prompt.py index 8b1112f5..17947038 100644 --- a/lightrag/prompt.py +++ b/lightrag/prompt.py @@ -19,7 +19,7 @@ Use {language} as output language. ---Steps--- 1. Identify all entities. For each identified entity, extract the following information: -- entity_name: Name of the entity, use same language as input text. If English, capitalized the name. +- entity_name: Name of the entity, use same language as input text. If English, capitalized the name - entity_type: One of the following types: [{entity_types}] - entity_description: Provide a comprehensive description of the entity's attributes and activities *based solely on the information present in the input text*. **Do not infer or hallucinate information not explicitly stated.** If the text provides insufficient information to create a comprehensive description, state "Description not available in text." Format each entity as ("entity"{tuple_delimiter}{tuple_delimiter}{tuple_delimiter}) @@ -156,9 +156,9 @@ MANY entities and relationships were missed in the last extraction. Please find ---Remember Steps--- 1. Identify all entities. For each identified entity, extract the following information: -- entity_name: Name of the entity, use same language as input text. If English, capitalized the name. +- entity_name: Name of the entity, use same language as input text. If English, capitalized the name - entity_type: One of the following types: [{entity_types}] -- entity_description: Comprehensive description of the entity's attributes and activities +- entity_description: Provide a comprehensive description of the entity's attributes and activities *based solely on the information present in the input text*. **Do not infer or hallucinate information not explicitly stated.** If the text provides insufficient information to create a comprehensive description, state "Description not available in text." Format each entity as ("entity"{tuple_delimiter}{tuple_delimiter}{tuple_delimiter}) 2. From the entities identified in step 1, identify all pairs of (source_entity, target_entity) that are *clearly related* to each other.