From 1922f5fde751cd517971f4470175f542b1a4e9cc Mon Sep 17 00:00:00 2001 From: Gaudy Blanco Date: Tue, 30 Dec 2025 13:00:51 -0600 Subject: [PATCH 1/2] fix issue #860 for mismatch in prompts and input --- .../prompt_tune/template/community_report_summarization.py | 4 ++-- packages/graphrag/graphrag/prompts/index/community_report.py | 4 ++-- tests/fixtures/text/prompts/community_report.txt | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/graphrag/graphrag/prompt_tune/template/community_report_summarization.py b/packages/graphrag/graphrag/prompt_tune/template/community_report_summarization.py index b0d037ab6b..32888fb137 100644 --- a/packages/graphrag/graphrag/prompt_tune/template/community_report_summarization.py +++ b/packages/graphrag/graphrag/prompt_tune/template/community_report_summarization.py @@ -56,13 +56,13 @@ Entities -id,entity,description +human_readable_id,title,description 5,VERDANT OASIS PLAZA,Verdant Oasis Plaza is the location of the Unity March 6,HARMONY ASSEMBLY,Harmony Assembly is an organization that is holding a march at Verdant Oasis Plaza Relationships -id,source,target,description +human_readable_id,source,target,description 37,VERDANT OASIS PLAZA,UNITY MARCH,Verdant Oasis Plaza is the location of the Unity March 38,VERDANT OASIS PLAZA,HARMONY ASSEMBLY,Harmony Assembly is holding a march at Verdant Oasis Plaza 39,VERDANT OASIS PLAZA,UNITY MARCH,The Unity March is taking place at Verdant Oasis Plaza diff --git a/packages/graphrag/graphrag/prompts/index/community_report.py b/packages/graphrag/graphrag/prompts/index/community_report.py index c3a7702ba0..b1f0f8abe2 100644 --- a/packages/graphrag/graphrag/prompts/index/community_report.py +++ b/packages/graphrag/graphrag/prompts/index/community_report.py @@ -59,13 +59,13 @@ Entities -id,entity,description +human_readable_id,title,description 5,VERDANT OASIS PLAZA,Verdant Oasis Plaza is the location of the Unity March 6,HARMONY ASSEMBLY,Harmony Assembly is an organization that is holding a march at Verdant Oasis Plaza Relationships -id,source,target,description +human_readable_id,source,target,description 37,VERDANT OASIS PLAZA,UNITY MARCH,Verdant Oasis Plaza is the location of the Unity March 38,VERDANT OASIS PLAZA,HARMONY ASSEMBLY,Harmony Assembly is holding a march at Verdant Oasis Plaza 39,VERDANT OASIS PLAZA,UNITY MARCH,The Unity March is taking place at Verdant Oasis Plaza diff --git a/tests/fixtures/text/prompts/community_report.txt b/tests/fixtures/text/prompts/community_report.txt index f939001c5b..4d78837774 100644 --- a/tests/fixtures/text/prompts/community_report.txt +++ b/tests/fixtures/text/prompts/community_report.txt @@ -35,12 +35,12 @@ Text: Entities -id,entity,description +human_readable_id,title,description 5,ABILA CITY PARK,Abila City Park is the location of the POK rally Relationships -id,source,target,description +human_readable_id,source,target,description 37,ABILA CITY PARK,POK RALLY,Abila City Park is the location of the POK rally 38,ABILA CITY PARK,POK,POK is holding a rally in Abila City Park 39,ABILA CITY PARK,POKRALLY,The POKRally is taking place at Abila City Park From 391858d4d9994f1d705d59e861326c7c8365f6eb Mon Sep 17 00:00:00 2001 From: Gaudy Blanco Date: Tue, 30 Dec 2025 13:02:20 -0600 Subject: [PATCH 2/2] fix format --- docs/examples_notebooks/api_overview.ipynb | 5 +++-- docs/examples_notebooks/input_documents.ipynb | 5 +++-- tests/verbs/test_create_community_reports.py | 9 +++++---- unified-search-app/app/app_logic.py | 3 ++- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/examples_notebooks/api_overview.ipynb b/docs/examples_notebooks/api_overview.ipynb index 2a0c0f15de..abcd7832fc 100644 --- a/docs/examples_notebooks/api_overview.ipynb +++ b/docs/examples_notebooks/api_overview.ipynb @@ -28,10 +28,11 @@ "from pathlib import Path\n", "from pprint import pprint\n", "\n", - "import graphrag.api as api\n", "import pandas as pd\n", "from graphrag.config.load_config import load_config\n", - "from graphrag.index.typing.pipeline_run_result import PipelineRunResult" + "from graphrag.index.typing.pipeline_run_result import PipelineRunResult\n", + "\n", + "import graphrag.api as api" ] }, { diff --git a/docs/examples_notebooks/input_documents.ipynb b/docs/examples_notebooks/input_documents.ipynb index 5657770eaf..505c0fe1f3 100644 --- a/docs/examples_notebooks/input_documents.ipynb +++ b/docs/examples_notebooks/input_documents.ipynb @@ -30,10 +30,11 @@ "from pathlib import Path\n", "from pprint import pprint\n", "\n", - "import graphrag.api as api\n", "import pandas as pd\n", "from graphrag.config.load_config import load_config\n", - "from graphrag.index.typing.pipeline_run_result import PipelineRunResult" + "from graphrag.index.typing.pipeline_run_result import PipelineRunResult\n", + "\n", + "import graphrag.api as api" ] }, { diff --git a/tests/verbs/test_create_community_reports.py b/tests/verbs/test_create_community_reports.py index d479120ce2..561f54108b 100644 --- a/tests/verbs/test_create_community_reports.py +++ b/tests/verbs/test_create_community_reports.py @@ -4,15 +4,16 @@ from graphrag.config.models.graph_rag_config import GraphRagConfig from graphrag.data_model.schemas import COMMUNITY_REPORTS_FINAL_COLUMNS -from graphrag.index.operations.summarize_communities.community_reports_extractor import ( - CommunityReportResponse, - FindingModel, -) from graphrag.index.workflows.create_community_reports import ( run_workflow, ) from graphrag.utils.storage import load_table_from_storage +from graphrag.index.operations.summarize_communities.community_reports_extractor import ( + CommunityReportResponse, + FindingModel, +) + from .util import ( DEFAULT_MODEL_CONFIG, compare_outputs, diff --git a/unified-search-app/app/app_logic.py b/unified-search-app/app/app_logic.py index dc64e0e77c..a573b9daa5 100644 --- a/unified-search-app/app/app_logic.py +++ b/unified-search-app/app/app_logic.py @@ -7,7 +7,6 @@ import logging from typing import TYPE_CHECKING -import graphrag.api as api import streamlit as st from knowledge_loader.data_sources.loader import ( create_datasource, @@ -18,6 +17,8 @@ from state.session_variables import SessionVariables from ui.search import display_search_result +import graphrag.api as api + if TYPE_CHECKING: import pandas as pd