fix: Index graph edges embedding error (#750)

<!-- .github/pull_request_template.md -->

## Description
Fixes the embedding error for index graph edges

## DCO Affirmation
I affirm that all code in every commit of this pull request conforms to
the terms of the Topoteretes Developer Certificate of Origin.
This commit is contained in:
hajdul88 2025-04-17 12:48:27 +02:00 committed by GitHub
parent 0121a2b5fc
commit f13607cf18
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,7 +8,7 @@ from cognee.modules.graph.models.EdgeType import EdgeType
logger = get_logger(level=ERROR)
async def index_graph_edges():
async def index_graph_edges(batch_size: int = 1024):
"""
Indexes graph edges by creating and managing vector indexes for relationship types.
@ -66,8 +66,11 @@ async def index_graph_edges():
indexed_data_point.metadata["index_fields"] = [field_name]
index_points[index_name].append(indexed_data_point)
for index_name, indexable_points in index_points.items():
index_name, field_name = index_name.split(".")
await vector_engine.index_data_points(index_name, field_name, indexable_points)
for index_key, points in index_points.items():
index_name, field_name = index_key.split(".")
for start in range(0, len(points), batch_size):
batch = points[start : start + batch_size]
await vector_engine.index_data_points(index_name, field_name, batch)
return None