From b1d23ab3eb73c61bceb51916a2be6fc478825fbf Mon Sep 17 00:00:00 2001 From: droideronline Date: Sun, 27 Apr 2025 01:14:34 +0530 Subject: [PATCH] Fix: Replace manual placeholders in COMMUNITY_REPORT_PROMPT to avoid .format() issues --- .../summarize_communities/community_reports_extractor.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/graphrag/index/operations/summarize_communities/community_reports_extractor.py b/graphrag/index/operations/summarize_communities/community_reports_extractor.py index 73ac0ec9e2..4b420ca522 100644 --- a/graphrag/index/operations/summarize_communities/community_reports_extractor.py +++ b/graphrag/index/operations/summarize_communities/community_reports_extractor.py @@ -73,10 +73,11 @@ async def __call__(self, input_text: str): """Call method definition.""" output = None try: - prompt = self._extraction_prompt.format(**{ - INPUT_TEXT_KEY: input_text, - MAX_LENGTH_KEY: str(self._max_report_length), - }) + prompt = self._extraction_prompt.replace( + "{" + INPUT_TEXT_KEY + "}", input_text + ).replace( + "{" + MAX_LENGTH_KEY + "}", str(self._max_report_length) + ) response = await self._model.achat( prompt, json=True, # Leaving this as True to avoid creating new cache entries