Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .semversioner/next-release/patch-20250430230945680958.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "patch",
"description": "Fix Community Report prompt tuning response"
}
5 changes: 4 additions & 1 deletion graphrag/prompt_tune/generator/entity_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ async def generate_entity_types(

if json_mode:
response = await model.achat(
entity_types_prompt, history=history, json_model=EntityTypesResponse
entity_types_prompt,
history=history,
json=json_mode,
json_model=EntityTypesResponse,
)
parsed_model = response.parsed_response
return parsed_model.entity_types if parsed_model else []
Expand Down
2 changes: 1 addition & 1 deletion graphrag/prompt_tune/prompt/entity_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@
REAL DATA: The following section is the real data. You should use only this real data to prepare your answer. Generate Entity Types only.
Task: {task}
Text: {input_text}
JSON response:
JSON response format:
{{"entity_types": [<entity_types>] }}
"""
2 changes: 1 addition & 1 deletion graphrag/prompt_tune/prompt/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
DETECT_LANGUAGE_PROMPT = """
You are an intelligent assistant that helps a human to analyze the information in a text document.
Given a sample text, help the user by determining what's the primary language of the provided texts.
Examples are: "English", "Spanish", "Japanese", "Portuguese" among others.
Examples are: "English", "Spanish", "Japanese", "Portuguese" among others. Reply ONLY with the language name.

Text: {input_text}
Language:"""
33 changes: 17 additions & 16 deletions graphrag/prompt_tune/template/community_report_summarization.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@
- 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.

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.
{{
{{{{
"title": <report_title>,
"summary": <executive_summary>,
"rating": <impact_severity_rating>,
"rating_explanation": <rating_explanation>,
"findings": [
{{
{{{{
"summary":<insight_1_summary>,
"explanation": <insight_1_explanation>
}},
{{
}}}},
{{{{
"summary":<insight_2_summary>,
"explanation": <insight_2_explanation>
}}
}}}}
]
}}
}}}}

# Grounding Rules
Points supported by data should list their data references as follows:
Expand All @@ -48,6 +48,7 @@
where 1, 5, 7, 23, 2, 34, 46, and 64 represent the id (not the index) of the relevant data record.

Do not include information where the supporting evidence for it is not provided.
Your answers should be in {language}.

# Example Input
-----------
Expand All @@ -70,30 +71,30 @@
43,HARMONY ASSEMBLY,UNITY MARCH,Harmony Assembly is organizing the Unity March

Output:
{{
{{{{
"title": "Verdant Oasis Plaza and Unity March",
"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.",
"rating": 5.0,
"rating_explanation": "The impact severity rating is moderate due to the potential for unrest or conflict during the Unity March.",
"findings": [
{{
{{{{
"summary": "Verdant Oasis Plaza as the central location",
"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)]"
}},
{{
}}}},
{{{{
"summary": "Harmony Assembly's role in the community",
"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)]"
}},
{{
}}}},
{{{{
"summary": "Unity March as a significant event",
"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)]"
}},
{{
}}}},
{{{{
"summary": "Role of Tribune Spotlight",
"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)]"
}}
}}}}
]
}}
}}}}

# Real Data

Expand Down
Loading