cybermaggedon
7a6197d8c3
GraphRAG Query-Time Explainability ( #677 )
...
Implements full explainability pipeline for GraphRAG queries, enabling
traceability from answers back to source documents.
Renamed throughout for clarity:
- provenance_callback → explain_callback
- provenance_id → explain_id
- provenance_collection → explain_collection
- message_type "provenance" → "explain"
- Queue name "provenance" → "explainability"
GraphRAG queries now emit explainability events as they execute:
1. Session - query text and timestamp
2. Retrieval - edges retrieved from subgraph
3. Selection - selected edges with LLM reasoning (JSONL with id +
reasoning)
4. Answer - reference to synthesized response
Events stream via explain_callback during query(), enabling
real-time UX.
- Answers stored in librarian service (not inline in graph - too large)
- Document ID as URN: urn:trustgraph:answer:{session_id}
- Graph stores tg:document reference (IRI) to librarian document
- Added librarian producer/consumer to graph-rag service
- get_labelgraph() now returns (labeled_edges, uri_map)
- uri_map maps edge_id(label_s, label_p, label_o) →
(uri_s, uri_p, uri_o)
- Explainability data stores original URIs, not labels
- Enables tracing edges back to reifying statements via tg:reifies
- Added serialize_triple() to query service (matches storage format)
- get_term_value() now handles TRIPLE type terms
- Enables querying by quoted triple in object position:
?stmt tg:reifies <<s p o>>
- Displays real-time explainability events during query
- Resolves rdfs:label for edge components (s, p, o)
- Traces source chain via prov:wasDerivedFrom to root document
- Output: "Source: Chunk 1 → Page 2 → Document Title"
- Label caching to avoid repeated queries
GraphRagResponse:
- explain_id: str | None
- explain_collection: str | None
- message_type: str ("chunk" or "explain")
- end_of_session: bool
trustgraph-base/trustgraph/provenance/:
- namespaces.py - Added TG_DOCUMENT predicate
- triples.py - answer_triples() supports document_id reference
- uris.py - Added edge_selection_uri()
trustgraph-base/trustgraph/schema/services/retrieval.py:
- GraphRagResponse with explain_id, explain_collection, end_of_session
trustgraph-flow/trustgraph/retrieval/graph_rag/:
- graph_rag.py - URI preservation, streaming answer accumulation
- rag.py - Librarian integration, real-time explain emission
trustgraph-flow/trustgraph/query/triples/cassandra/service.py:
- Quoted triple serialization for query matching
trustgraph-cli/trustgraph/cli/invoke_graph_rag.py:
- Full explainability display with label resolution and source tracing
2026-03-10 10:00:01 +00:00
cybermaggedon
f2ae0e8623
Embeddings API scores ( #671 )
...
- Put scores in all responses
- Remove unused 'middle' vector layer. Vector of texts -> vector of (vector embedding)
2026-03-09 10:53:44 +00:00
cybermaggedon
3bf8a65409
Fix tests ( #666 )
2026-03-07 23:38:09 +00:00
cybermaggedon
1809c1f56d
Structured data 2 ( #645 )
...
* Structured data refactor - multi-index tables, remove need for manual mods to the Cassandra tables
* Tech spec updated to track implementation
2026-02-23 15:56:29 +00:00
cybermaggedon
cf0daedefa
Changed schema for Value -> Term, majorly breaking change ( #622 )
...
* Changed schema for Value -> Term, majorly breaking change
* Following the schema change, Value -> Term into all processing
* Updated Cassandra for g, p, s, o index patterns (7 indexes)
* Reviewed and updated all tests
* Neo4j, Memgraph and FalkorDB remain broken, will look at once settled down
2026-01-27 13:48:08 +00:00
cybermaggedon
807f6cc4e2
Fix non streaming RAG problems ( #607 )
...
* Fix non-streaming failure in RAG services
* Fix non-streaming failure in API
* Fix agent non-streaming messaging
* Agent messaging unit & contract tests
2026-01-12 18:45:52 +00:00
cybermaggedon
5304f96fe6
Fix tests ( #593 )
...
* Fix unit/integration/contract tests which were broken by messaging fabric work
2025-12-19 08:53:21 +00:00
cybermaggedon
0b7620bc04
Object batching ( #499 )
...
* Object batching
* Update tests
2025-09-05 15:59:06 +01:00
cybermaggedon
a6d9f5e849
Structured query support ( #492 )
...
* Tweak the structured query schema
* Structure query service
* Gateway support for nlp-query and structured-query
* API support
* Added CLI
* Update tests
* More tests
2025-09-04 16:06:18 +01:00
cybermaggedon
e74eb5d1ff
Feature/tool group ( #484 )
...
* Tech spec for tool group
* Partial tool group implementation
* Tool group tests
2025-09-03 23:39:49 +01:00
cybermaggedon
672e358b2f
Feature/graphql table query ( #486 )
...
* Tech spec
* Object query service for Cassandra
* Gateway support for objects-query
* GraphQL query utility
* Filters, ordering
2025-09-03 23:39:11 +01:00
cybermaggedon
38826c7de1
trustgraph-base .chunks / .documents confusion in the API ( #481 )
...
* trustgraph-base .chunks / .documents confusion in the API
* Added tests, fixed test failures in code
* Fix file dup error
* Fix contract error
2025-09-02 17:58:53 +01:00
cybermaggedon
83f0c1e7f3
Structure data mvp ( #452 )
...
* Structured data tech spec
* Architecture principles
* New schemas
* Updated schemas and specs
* Object extractor
* Add .coveragerc
* New tests
* Cassandra object storage
* Trying to object extraction working, issues exist
2025-08-07 20:47:20 +01:00
cybermaggedon
4daa54abaf
Extending test coverage ( #434 )
...
* Contract tests
* Testing embeedings
* Agent unit tests
* Knowledge pipeline tests
* Turn on contract tests
2025-07-14 17:54:04 +01:00