Add graphrag-neo4j module: structured-output entity and relation extraction into a typed Neo4j graph with a vector index, multi-hop retrieval by span linking and variable-length Cypher paths, compared with plain vector RAG over the same 35 chunks and 9 questions (complete evidence 7/9 vs 5/9 at k=8); Testcontainers on neo4j:2026.10.1 and 5.26. The extraction step is a rule-based stand-in, not a language model.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CifR2BE7PBvRy5hT8TS9oz
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
# Building the graph in Neo4j; names that are the same thing (STUB extraction)
|
||||
|
||||
image : neo4j:2026.10.1-community
|
||||
server : Neo4j Kernel 2026.10.1 community
|
||||
|
||||
--- vector indexes (one from Neo4jVectorStore for chunks, one of ours for entity names) ---
|
||||
chunk_embedding on (:Chunk).embedding ONLINE
|
||||
entity_name_embedding on (:Entity).embedding ONLINE
|
||||
|
||||
--- A. exact-name matching only (no alias table, similarity merge off) ---
|
||||
entities: 28
|
||||
Payments Gateway : -[DEPENDS_ON]-> Ledger Service; -[HOSTED_ON]-> Arcadia Cloud; -[OWNED_BY]-> Payments Team; <-[DEPENDS_ON]- Checkout Service
|
||||
Card Gateway : <-[AFFECTED]- INC-2060
|
||||
|
||||
--- same-type name pairs by cosine of their embeddings, top 8 of 72 ---
|
||||
0.806 INCIDENT INC-2057 <-> INC-2060
|
||||
0.797 INCIDENT INC-2041 <-> INC-2057
|
||||
0.758 INCIDENT INC-2041 <-> INC-2060
|
||||
0.681 SYSTEM Card Gateway <-> Payments Gateway
|
||||
0.540 SYSTEM Ledger Service <-> Inventory Service
|
||||
0.535 TEAM Storefront Team <-> Platform Team
|
||||
0.530 TEAM Core Data Team <-> Platform Team
|
||||
0.519 SYSTEM Inventory Service <-> Checkout Service
|
||||
-- Card Gateway <-> Payments Gateway: cosine 0.681, rank 4
|
||||
|
||||
--- what a similarity-only merge would do at each threshold ---
|
||||
threshold 0.90 -> 0 merges:
|
||||
threshold 0.80 -> 1 merges: INC-2057 + INC-2060
|
||||
threshold 0.70 -> 3 merges: INC-2057 + INC-2060; INC-2041 + INC-2057; INC-2041 + INC-2060
|
||||
threshold 0.60 -> 4 merges: INC-2057 + INC-2060; INC-2041 + INC-2057; INC-2041 + INC-2060; Card Gateway + Payments Gateway
|
||||
|
||||
--- B. plus a one-line alias table (Card Gateway = Payments Gateway) ---
|
||||
entities: 27
|
||||
Payments Gateway : -[DEPENDS_ON]-> Ledger Service; -[HOSTED_ON]-> Arcadia Cloud; -[OWNED_BY]-> Payments Team; <-[AFFECTED]- INC-2060; <-[DEPENDS_ON]- Checkout Service
|
||||
chunks: 35, MENTIONS edges: 54, dropped relations: 0
|
||||
|
||||
--- relationships by type ---
|
||||
DEPENDS_ON 6
|
||||
OWNED_BY 6
|
||||
HOSTED_ON 5
|
||||
LED_BY 5
|
||||
REPORTS_TO 4
|
||||
AFFECTED 3
|
||||
CAUSED_BY 2
|
||||
LOCATED_IN 2
|
||||
Reference in New Issue
Block a user