mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Refa: improve lightrag (#9690)
### What problem does this PR solve? Improve lightrag. #9647 ### Type of change - [x] Refactoring
This commit is contained in:
@ -130,7 +130,36 @@ Output:
|
|||||||
|
|
||||||
PROMPTS[
|
PROMPTS[
|
||||||
"entiti_continue_extraction"
|
"entiti_continue_extraction"
|
||||||
] = """MANY entities were missed in the last extraction. Add them below using the same format:
|
] = """
|
||||||
|
MANY entities and relationships were missed in the last extraction. Please find only the missing entities and relationships from previous text.
|
||||||
|
|
||||||
|
---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_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}<entity_name>{tuple_delimiter}<entity_type>{tuple_delimiter}<entity_description>)
|
||||||
|
|
||||||
|
2. From the entities identified in step 1, identify all pairs of (source_entity, target_entity) that are *clearly related* to each other.
|
||||||
|
For each pair of related entities, extract the following information:
|
||||||
|
- source_entity: name of the source entity, as identified in step 1
|
||||||
|
- target_entity: name of the target entity, as identified in step 1
|
||||||
|
- relationship_description: explanation as to why you think the source entity and the target entity are related to each other
|
||||||
|
- relationship_strength: a numeric score indicating strength of the relationship between the source entity and target entity
|
||||||
|
- relationship_keywords: one or more high-level key words that summarize the overarching nature of the relationship, focusing on concepts or themes rather than specific details
|
||||||
|
Format each relationship as ("relationship"{tuple_delimiter}<source_entity>{tuple_delimiter}<target_entity>{tuple_delimiter}<relationship_description>{tuple_delimiter}<relationship_keywords>{tuple_delimiter}<relationship_strength>)
|
||||||
|
|
||||||
|
3. Identify high-level key words that summarize the main concepts, themes, or topics of the entire text. These should capture the overarching ideas present in the document.
|
||||||
|
Format the content-level key words as ("content_keywords"{tuple_delimiter}<high_level_keywords>)
|
||||||
|
|
||||||
|
4. Return output in {language} as a single list of all the entities and relationships identified in steps 1 and 2. Use **{record_delimiter}** as the list delimiter.
|
||||||
|
|
||||||
|
5. When finished, output {completion_delimiter}
|
||||||
|
|
||||||
|
---Output---
|
||||||
|
|
||||||
|
Add new entities and relations below using the same format, and do not include entities and relations that have been previously extracted. :
|
||||||
"""
|
"""
|
||||||
|
|
||||||
PROMPTS[
|
PROMPTS[
|
||||||
|
|||||||
Reference in New Issue
Block a user