Created
February 25, 2025 10:22
-
-
Save fpaupier/4865c3e4db89e5b08354cfaef2f21a07 to your computer and use it in GitHub Desktop.
Prompts for entity extraction from MSFT GraphRAG project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GRAPH_EXTRACTION_PROMPT = """ | |
| -Goal- | |
| Given a text document that is potentially relevant to this activity and a list of entity types, identify all entities of those types from the text and all relationships among the identified entities. | |
| -Steps- | |
| 1. Identify all entities. For each identified entity, extract the following information: | |
| - entity_name: Name of the entity, capitalized | |
| - entity_type: One of the following types: [{entity_types}] | |
| - entity_description: Comprehensive description of the entity's attributes and activities | |
| 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: an integer score between 1 to 10, indicating strength of the relationship between the source entity and target entity | |
| Format each relationship as ("relationship"{{tuple_delimiter}}<source_entity>{{tuple_delimiter}}<target_entity>{{tuple_delimiter}}<relationship_description>{{tuple_delimiter}}<relationship_strength>) | |
| 3. 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. | |
| 4. If you have to translate into {language}, just translate the descriptions, nothing else! | |
| 5. When finished, output {{completion_delimiter}}. | |
| -Examples- | |
| ###################### | |
| {examples} | |
| -Real Data- | |
| ###################### | |
| entity_types: [{entity_types}] | |
| text: {{input_text}} | |
| ###################### | |
| output:""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment