diff --git a/scripts/graphiti_service.py b/scripts/graphiti_service.py index 6154eaf..317cfc4 100644 --- a/scripts/graphiti_service.py +++ b/scripts/graphiti_service.py @@ -75,6 +75,17 @@ async def lifespan(app: FastAPI): max_coroutines=2, ) await graphiti_instance.build_indices_and_constraints() + # Bridge driver._search_ops to driver.search_interface — graphiti-core 0.29.0 + # builds FalkorSearchOperations as driver._search_ops in FalkorDriver.__init__ + # but never assigns it to driver.search_interface. search_utils.py dispatches + # on driver.search_interface; without this assignment it falls back to + # interpreted-Cypher cosine math (full table scans). Together with the + # vendored patches in graphiti_patches/, this activates FalkorDB's native + # vector index for entity dedup similarity search. + if (hasattr(graphiti_instance.driver, "_search_ops") + and graphiti_instance.driver.search_interface is None): + graphiti_instance.driver.search_interface = graphiti_instance.driver._search_ops + log.info("Wired driver.search_interface = driver._search_ops (vector index path active)") log.info(f"Graphiti ready — provider: {LLM_PROVIDER}, group: {GROUP_ID}") yield await graphiti_instance.close()