Skip to content

Commit 572e99a

Browse files
committed
Fix type mismatch in DynamicCommunitySelection children lookup
1 parent fdb7e38 commit 572e99a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "patch",
3+
"description": "Fix type mismatch in DynamicCommunitySelection when checking children communities. Convert child IDs to string to match self.reports key type (fixes #2004)"
4+
}

graphrag/query/context_builder/dynamic_community_selection.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,10 @@ async def select(self, query: str) -> tuple[list[CommunityReport], dict[str, Any
123123
# TODO check why some sub_communities are NOT in report_df
124124
if community in self.communities:
125125
for child in self.communities[community].children:
126-
if child in self.reports:
127-
communities_to_rate.append(child)
126+
# Convert child to string to match self.reports key type
127+
child_str = str(child)
128+
if child_str in self.reports:
129+
communities_to_rate.append(child_str)
128130
else:
129131
logger.debug(
130132
"dynamic community selection: cannot find community %s in reports",

0 commit comments

Comments
 (0)