graphiti_service.py: 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 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 commitd2ec20e), this activates FalkorDB's native vector index for the dedup similarity path. Empirical impact (per the originalf645b74commit 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 fromf645b74— 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.
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user