Skip to content

Commit

Permalink
Allow \n in description
Browse files Browse the repository at this point in the history
  • Loading branch information
liukidar committed Dec 5, 2024
1 parent f6304d8 commit 29171c3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions fast_graphrag/_policies/_graph_upsert.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ async def _upsert_node(node_id: TId, nodes: List[TEntity]) -> Optional[Tuple[TIn
nodes.append(existing_node)

# Resolve descriptions
node_description = " ".join((node.description for node in nodes))
node_description = "\n".join((node.description for node in nodes))

if len(node_description) > self.config.max_node_description_size:
node_description = await summarize_entity_description(
Expand All @@ -133,7 +133,6 @@ async def _upsert_node(node_id: TId, nodes: List[TEntity]) -> Optional[Tuple[TIn
# / TOKEN_TO_CHAR_RATIO
# ),
)
node_description = node_description.replace("\n", " ")

# Resolve types (pick most frequent)
node_type = Counter((node.type for node in nodes)).most_common(1)[0][0]
Expand Down Expand Up @@ -294,7 +293,7 @@ async def _merge_similar_edges(

first_index = relation_indices[0]
edge, index = map_incremental_to_edge[first_index]
edge.description = edges_group.description.replace("\n", " ")
edge.description = edges_group.description
visited_edges[first_index] = None # None means it was visited but not marked for deletion.
if edge.chunks:
chunks.update(edge.chunks)
Expand Down

0 comments on commit 29171c3

Please sign in to comment.