agrag.ingestion.resolve.candidate_source.fetch_persisted_neighbors
fetch_persisted_neighbors(entity_ids:Sequence[UUID], *, graph_store:GraphStore, exclude_relation_types:Sequence[str], max_neighbors:int = MAX_NEIGHBORS_PER_ENTITY) -> dict[UUID, list[str]]
Fetch a bounded neighbor-relationship sample for persisted entities.
Parameters:
- entity_ids (
Sequence[UUID]) – Persisted entity ids to fetch neighbors for. - graph_store (
GraphStore) – Store to read from. - exclude_relation_types (
Sequence[str]) – Relation types to omit, such as resolution's own system relation types (MATCHES,RESOLVED_AS, etc.) — passed by the caller rather than imported here, since importingSYSTEM_RELATION_TYPESfromagrag.ingestion.resolve.resolutioninto this module would create an import cycle (that module already imports from this one). - max_neighbors (
int) – Maximum neighbor strings kept per entity id.
Returns:
dict[UUID, list[str]]– Entity id to a list of"{rel_type} {neighbor_name}"strings. Andict[UUID, list[str]]– id with no matching relations, and a malformed row, contributedict[UUID, list[str]]– nothing, so that id is simply absent from the map — every callerdict[UUID, list[str]]– reads through.get(id, []).