Skip to content

Commit 8805d92

Browse files
author
Gabriel Nieves
committed
Updated community report summarization file name and prompt template
1 parent f27479e commit 8805d92

File tree

2 files changed

+46
-37
lines changed

2 files changed

+46
-37
lines changed

graphrag/prompt_tune/generator/community_report_summarization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
COMMUNITY_REPORT_SUMMARIZATION_PROMPT,
1010
)
1111

12-
COMMUNITY_SUMMARIZATION_FILENAME = "community_report.txt"
12+
COMMUNITY_SUMMARIZATION_FILENAME = "community_report_graph.txt"
1313

1414

1515
def create_community_summarization_prompt(

graphrag/prompt_tune/template/community_report_summarization.py

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,42 @@
1212
# Report Structure
1313
The report should include the following sections:
1414
- TITLE: community's name that represents its key entities - title should be short but specific. When possible, include representative named entities in the title.
15-
- SUMMARY: An executive summary of the community's overall structure, how its entities are related to each other, and significant points associated with its entities.
15+
- SUMMARY: An executive summary of the community's overall structure, how its entities are related to each other, and significant information associated with its entities.
1616
- REPORT RATING: {report_rating_description}
1717
- RATING EXPLANATION: Give a single sentence explanation of the rating.
1818
- DETAILED FINDINGS: A list of 5-10 key insights about the community. Each insight should have a short summary followed by multiple paragraphs of explanatory text grounded according to the grounding rules below. Be comprehensive.
1919
2020
Return output as a well-formed JSON-formatted string with the following format. Don't use any unnecessary escape sequences. The output should be a single JSON object that can be parsed by json.loads.
2121
{{
22-
"title": "<report_title>",
23-
"summary": "<executive_summary>",
24-
"rating": <threat_severity_rating>,
25-
"rating_explanation": "<rating_explanation>"
26-
"findings": "[{{"summary":"<insight_1_summary>", "explanation": "<insight_1_explanation"}}, {{"summary":"<insight_2_summary>", "explanation": "<insight_2_explanation"}}]"
22+
"title": <report_title>,
23+
"summary": <executive_summary>,
24+
"rating": <impact_severity_rating>,
25+
"rating_explanation": <rating_explanation>,
26+
"findings": [
27+
{{
28+
"summary":<insight_1_summary>,
29+
"explanation": <insight_1_explanation>
30+
}},
31+
{{
32+
"summary":<insight_2_summary>,
33+
"explanation": <insight_2_explanation>
34+
}}
35+
]
2736
}}
2837
2938
# Grounding Rules
30-
After each paragraph, add data record reference if the content of the paragraph was derived from one or more data records. Reference is in the format of [records: <record_source> (<record_id_list>, ...<record_source> (<record_id_list>)]. If there are more than 10 data records, show the top 10 most relevant records.
31-
Each paragraph should contain multiple sentences of explanation and concrete examples with specific named entities. All paragraphs must have these references at the start and end. Use "NONE" if there are no related roles or records. Everything should be in {language}.
39+
Points supported by data should list their data references as follows:
3240
33-
Example paragraph with references added:
34-
This is a paragraph of the output text [records: Entities (1, 2, 3), Claims (2, 5), Relationships (10, 12)]
41+
"This is an example sentence supported by multiple data references [Data: <dataset name> (record ids); <dataset name> (record ids)]."
42+
43+
Do not list more than 5 record ids in a single reference. Instead, list the top 5 most relevant record ids and add "+more" to indicate that there are more.
44+
45+
For example:
46+
"Person X is the owner of Company Y and subject to many allegations of wrongdoing [Data: Reports (1), Entities (5, 7); Relationships (23); Claims (7, 2, 34, 64, 46, +more)]."
47+
48+
where 1, 5, 7, 23, 2, 34, 46, and 64 represent the id (not the index) of the relevant data record.
49+
50+
Do not include information where the supporting evidence for it is not provided.
3551
3652
# Example Input
3753
-----------
@@ -40,50 +56,43 @@
4056
Entities
4157
4258
id,entity,description
43-
5,ABILA CITY PARK,Abila City Park is the location of the POK rally
59+
5,VERDANT OASIS PLAZA,Verdant Oasis Plaza is the location of the Unity March
60+
6,HARMONY ASSEMBLY,Harmony Assembly is an organization that is holding a march at Verdant Oasis Plaza
4461
4562
Relationships
4663
4764
id,source,target,description
48-
37,ABILA CITY PARK,POK RALLY,Abila City Park is the location of the POK rally
49-
38,ABILA CITY PARK,POK,POK is holding a rally in Abila City Park
50-
39,ABILA CITY PARK,POKRALLY,The POKRally is taking place at Abila City Park
51-
40,ABILA CITY PARK,CENTRAL BULLETIN,Central Bulletin is reporting on the POK rally taking place in Abila City Park
65+
37,VERDANT OASIS PLAZA,UNITY MARCH,Verdant Oasis Plaza is the location of the Unity March
66+
38,VERDANT OASIS PLAZA,HARMONY ASSEMBLY,Harmony Assembly is holding a march at Verdant Oasis Plaza
67+
39,VERDANT OASIS PLAZA,UNITY MARCH,The Unity March is taking place at Verdant Oasis Plaza
68+
40,VERDANT OASIS PLAZA,TRIBUNE SPOTLIGHT,Tribune Spotlight is reporting on the Unity march taking place at Verdant Oasis Plaza
69+
41,VERDANT OASIS PLAZA,BAILEY ASADI,Bailey Asadi is speaking at Verdant Oasis Plaza about the march
70+
43,HARMONY ASSEMBLY,UNITY MARCH,Harmony Assembly is organizing the Unity March
5271
5372
Output:
5473
{{
55-
"title": "Abila City Park and POK Rally",
56-
"summary": "The community revolves around the Abila City Park, which is the location of the POK rally. The park has relationships with POK, POKRALLY, and Central Bulletin, all
57-
of which are associated with the rally event.",
74+
"title": "Verdant Oasis Plaza and Unity March",
75+
"summary": "The community revolves around the Verdant Oasis Plaza, which is the location of the Unity March. The plaza has relationships with the Harmony Assembly, Unity March, and Tribune Spotlight, all of which are associated with the march event.",
5876
"rating": 5.0,
59-
"rating_explanation": "The impact rating is moderate due to the potential for unrest or conflict during the POK rally.",
77+
"rating_explanation": "The impact severity rating is moderate due to the potential for unrest or conflict during the Unity March.",
6078
"findings": [
6179
{{
62-
"summary": "Abila City Park as the central location",
63-
"explanation": "Abila City Park is the central entity in this community, serving as the location for the POK rally. This park is the common link between all other
64-
entities, suggesting its significance in the community. The park's association with the rally could potentially lead to issues such as public disorder or conflict, depending on the
65-
nature of the rally and the reactions it provokes. [records: Entities (5), Relationships (37, 38, 39, 40)]"
80+
"summary": "Verdant Oasis Plaza as the central location",
81+
"explanation": "Verdant Oasis Plaza is the central entity in this community, serving as the location for the Unity March. This plaza is the common link between all other entities, suggesting its significance in the community. The plaza's association with the march could potentially lead to issues such as public disorder or conflict, depending on the nature of the march and the reactions it provokes. [Data: Entities (5), Relationships (37, 38, 39, 40, 41,+more)]"
6682
}},
6783
{{
68-
"summary": "POK's role in the community",
69-
"explanation": "POK is another key entity in this community, being the organizer of the rally at Abila City Park. The nature of POK and its rally could be a potential
70-
source of threat, depending on their objectives and the reactions they provoke. The relationship between POK and the park is crucial in understanding the dynamics of this community.
71-
[records: Relationships (38)]"
84+
"summary": "Harmony Assembly's role in the community",
85+
"explanation": "Harmony Assembly is another key entity in this community, being the organizer of the march at Verdant Oasis Plaza. The nature of Harmony Assembly and its march could be a potential source of threat, depending on their objectives and the reactions they provoke. The relationship between Harmony Assembly and the plaza is crucial in understanding the dynamics of this community. [Data: Entities(6), Relationships (38, 43)]"
7286
}},
7387
{{
74-
"summary": "POKRALLY as a significant event",
75-
"explanation": "The POKRALLY is a significant event taking place at Abila City Park. This event is a key factor in the community's dynamics and could be a potential
76-
source of threat, depending on the nature of the rally and the reactions it provokes. The relationship between the rally and the park is crucial in understanding the dynamics of this
77-
community. [records: Relationships (39)]"
88+
"summary": "Unity March as a significant event",
89+
"explanation": "The Unity March is a significant event taking place at Verdant Oasis Plaza. This event is a key factor in the community's dynamics and could be a potential source of threat, depending on the nature of the march and the reactions it provokes. The relationship between the march and the plaza is crucial in understanding the dynamics of this community. [Data: Relationships (39)]"
7890
}},
7991
{{
80-
"summary": "Role of Central Bulletin",
81-
"explanation": "Central Bulletin is reporting on the POK rally taking place in Abila City Park. This suggests that the event has attracted media attention, which could
82-
amplify its impact on the community. The role of Central Bulletin could be significant in shaping public perception of the event and the entities involved. [records: Relationships
83-
(40)]"
92+
"summary": "Role of Tribune Spotlight",
93+
"explanation": "Tribune Spotlight is reporting on the Unity March taking place in Verdant Oasis Plaza. This suggests that the event has attracted media attention, which could amplify its impact on the community. The role of Tribune Spotlight could be significant in shaping public perception of the event and the entities involved. [Data: Relationships (40)]"
8494
}}
8595
]
86-
8796
}}
8897
8998
# Real Data

0 commit comments

Comments
 (0)