agrag.ingestion.resolve.candidate_source.build_relation_neighbors
build_relation_neighbors(entities:list[ExtractedEntity], relations:Sequence[ExtractedRelation], *, max_neighbors:int = MAX_NEIGHBORS_PER_ENTITY) -> dict[int, list[str]]
Build LLMVerify neighbor context from one batch's extracted relations.
Parameters:
- entities (
list[ExtractedEntity]) – The batch's mentions, indexed asrelationsreferences them. - relations (
Sequence[ExtractedRelation]) – Relation mentions from the same extraction batch. - max_neighbors (
int) – Maximum neighbor strings kept per entity index.
Returns:
dict[int, list[str]]– Entity index to a list of"{relation_label} {other_entity_text}"dict[int, list[str]]– strings, each direction of a relation contributing one entry todict[int, list[str]]– both endpoints, capped atmax_neighborsper index. An index with nodict[int, list[str]]– relation names has no key at all.