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:
2026-10-26 02:03:40 +00:00
co-authored by Claude Sonnet 5.5
parent 279be7eb9f
commit 108fc44542
66 changed files with 1997 additions and 0 deletions
+76
View File
@@ -0,0 +1,76 @@
# Entity and relation extraction through ChatClient.entity() (STUB model, not an LLM)
--- the user message the model receives for svc-checkout.txt ---
Extract the entities and relations from the document.
DOCUMENT_START
Checkout Service. The Checkout Service takes a customer's cart and turns it into an order. It depends on the Payments Gateway to take card payments and on the Inventory Service to reserve stock. The Checkout Service is owned by the Storefront Team. Its latency dashboard lives in the shared Grafana folder.
DOCUMENT_END
Your response should be in JSON format.
Do not include any explanations, only provide a RFC8259 compliant JSON response following this format without deviation.
Do not include markdown code blocks in your response.
Remove the ```json markdown from the output.
Here is the JSON Schema instance your output must adhere to:
```{
"$schema" : "https://json-schema.org/draft/2020-12/schema",
"type" : "object",
"properties" : {
"entities" : {
"type" : "array",
"items" : {
"type" : "object",
"properties" : {
"name" : {
"type" : "string"
},
"type" : {
"type" : "string",
"enum" : [ "SYSTEM", "TEAM", "PERSON", "VENDOR", "INCIDENT", "PLACE" ]
}
},
"required" : [ "name", "type" ],
"additionalProperties" : false
}
},
"relations" : {
"type" : "array",
"items" : {
"type" : "object",
"properties" : {
"source" : {
"type" : "string"
},
"target" : {
"type" : "string"
},
"type" : {
"type" : "string",
"enum" : [ "DEPENDS_ON", "OWNED_BY", "LED_BY", "HOSTED_ON", "AFFECTED", "CAUSED_BY", "REPORTS_TO", "LOCATED_IN" ]
}
},
"required" : [ "source", "target", "type" ],
"additionalProperties" : false
}
}
},
"required" : [ "entities", "relations" ],
"additionalProperties" : false
}```
--- the parsed Extraction record ---
entity SYSTEM Checkout Service
entity SYSTEM Payments Gateway
entity SYSTEM Inventory Service
entity TEAM Storefront Team
relation Checkout Service -[DEPENDS_ON]-> Payments Gateway
relation Checkout Service -[DEPENDS_ON]-> Inventory Service
relation Checkout Service -[OWNED_BY]-> Storefront Team
--- all 35 chunks ---
model calls : 35 (one per chunk)
characters sent : 72437 (about 18109 tokens at 4 characters per token, an estimate)
entity mentions (before merging): 54
relations : 33
chunks with no relation at all : 14