scene_service.scene_graph.relations

Edge candidate generation and LLM-based relation inference.

Functions

compute_geometry_hint(a, b)

generate_edge_candidates(nodes, *[, ...])

Pairs that are close, overlap in XY, or nest, nearest first.

Classes

RelationInferer(llm_client)

Infer the relation between two objects via LLM.

class scene_service.scene_graph.relations.RelationInferer(llm_client: SceneGraphLLMClient)[source]

Bases: object

Infer the relation between two objects via LLM.

async infer_relation(source: SceneGraphNode, target: SceneGraphNode, hint: GeometryHint) → SceneGraphEdge[source]

Full relation; an off-vocabulary answer becomes “unknown”.

async infer_semantic_relation(source: SceneGraphNode, target: SceneGraphNode, hint: GeometryHint, known_relation: str) → SceneGraphEdge[source]

Semantic relation for a pair geometry already placed; anything spatial or off-vocabulary becomes “none”.

scene_service.scene_graph.relations.compute_geometry_hint(a: SceneGraphNode, b: SceneGraphNode) → GeometryHint[source]
scene_service.scene_graph.relations.generate_edge_candidates(nodes: list[SceneGraphNode], *, max_distance: float = 2.0, min_xy_overlap: float = 0.15, max_candidates: int = 200) → list[tuple[SceneGraphNode, SceneGraphNode, GeometryHint]][source]

Pairs that are close, overlap in XY, or nest, nearest first.