Fix: Flatten results from update_community calls
- Fixed ValueError when update_communities=True
- semaphore_gather returns a list of tuples, not a single tuple
- Added proper unpacking and flattening logic
- Bug was introduced in commit dcc9da3
Resolves issue where update_communities parameter would fail with:
'ValueError: not enough values to unpack (expected 2, got 1)'
This commit is contained in:
parent
3ce3962e4b
commit
100a43b214
1 changed files with 5 additions and 1 deletions
|
|
@ -778,13 +778,17 @@ class Graphiti:
|
||||||
communities = []
|
communities = []
|
||||||
community_edges = []
|
community_edges = []
|
||||||
if update_communities:
|
if update_communities:
|
||||||
communities, community_edges = await semaphore_gather(
|
results = await semaphore_gather(
|
||||||
*[
|
*[
|
||||||
update_community(self.driver, self.llm_client, self.embedder, node)
|
update_community(self.driver, self.llm_client, self.embedder, node)
|
||||||
for node in nodes
|
for node in nodes
|
||||||
],
|
],
|
||||||
max_coroutines=self.max_coroutines,
|
max_coroutines=self.max_coroutines,
|
||||||
)
|
)
|
||||||
|
# Flatten results from multiple update_community calls
|
||||||
|
for community_list, edge_list in results:
|
||||||
|
communities.extend(community_list)
|
||||||
|
community_edges.extend(edge_list)
|
||||||
|
|
||||||
end = time()
|
end = time()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue