From 313c0f0341c2c3e0a025cd9850111ec045a810a9 Mon Sep 17 00:00:00 2001 From: Aaron Nelson Date: Wed, 20 May 2026 04:06:46 +0000 Subject: [PATCH] graphiti_service.py: bridge driver._search_ops to driver.search_interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 search_interface; without this one-line bridge it falls back to interpreted-Cypher cosine math doing full table scans for every entity dedup similarity check. Combined with the vendored patches in graphiti_patches/ (restored in the previous commit d2ec20e), this activates FalkorDB's native vector index for the dedup similarity path. Empirical impact (per the original f645b74 commit message): single-episode add_episode against a ~4,277-entity graph went from indefinite hang to ~8.2 seconds. Surgical restore: cherry-picks only the bridge code from f645b74 — not the Pattern 1 async job model, not the v2.4 extraction instructions, neither of which we want. Default extraction posture (taxonomy-naïve) stays the operating mode. Rich-extraction story remains a BirdAI concern. --- scripts/graphiti_service.py | 11 +++++++++++ 1 file changed, 11 insertions(+) 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()