trustgraph/trustgraph-base/trustgraph/messaging/translators
cybermaggedon 35128ff019
Add unified explainability support and librarian storage for (#693)
Add unified explainability support and librarian storage for all retrieval engines

Implements consistent explainability/provenance tracking
across GraphRAG, DocumentRAG, and Agent retrieval
engines. All large content (answers, thoughts, observations)
is now stored in librarian rather than as inline literals in
the knowledge graph.

Explainability API:
- New explainability.py module with entity classes (Question,
  Exploration, Focus, Synthesis, Analysis, Conclusion) and
  ExplainabilityClient
- Quiescence-based eventual consistency handling for trace
  fetching
- Content fetching from librarian with retry logic

CLI updates:
- tg-invoke-graph-rag -x/--explainable flag returns
  explain_id
- tg-invoke-document-rag -x/--explainable flag returns
  explain_id
- tg-invoke-agent -x/--explainable flag returns explain_id
- tg-list-explain-traces uses new explainability API
- tg-show-explain-trace handles all three trace types

Agent provenance:
- Records session, iterations (think/act/observe), and conclusion
- Stores thoughts and observations in librarian with document
  references
- New predicates: tg:thoughtDocument, tg:observationDocument

DocumentRAG provenance:
- Records question, exploration (chunk retrieval), and synthesis
- Stores answers in librarian with document references

Schema changes:
- AgentResponse: added explain_id, explain_graph fields
- RetrievalResponse: added explain_id, explain_graph fields
- agent_iteration_triples: supports thought_document_id,
  observation_document_id

Update tests.
2026-03-12 21:40:09 +00:00
..
__init__.py Row embeddings APIs exposed (#646) 2026-02-23 21:52:56 +00:00
agent.py Add unified explainability support and librarian storage for (#693) 2026-03-12 21:40:09 +00:00
base.py Feature/translator classes (#414) 2025-06-20 16:59:55 +01:00
collection.py Fix/queue configurations (#585) 2025-12-06 14:54:47 +00:00
config.py Empty configuration is returned as empty list, previously was not in response (#436) 2025-07-15 14:30:37 +01:00
diagnosis.py Fix tests (#593) 2025-12-19 08:53:21 +00:00
document_loading.py The id field in pipeline Metadata was being overwritten at each processing (#686) 2026-03-11 12:16:39 +00:00
embeddings.py Batch embeddings (#668) 2026-03-08 18:36:54 +00:00
embeddings_query.py Embeddings API scores (#671) 2026-03-09 10:53:44 +00:00
flow.py Fix config inconsistency (#609) 2026-01-14 12:31:40 +00:00
knowledge.py The id field in pipeline Metadata was being overwritten at each processing (#686) 2026-03-11 12:16:39 +00:00
library.py Fix/librarian broken (#674) 2026-03-09 13:36:24 +00:00
metadata.py Incremental / large document loading (#659) 2026-03-04 16:57:58 +00:00
nlp_query.py Structured query support (#492) 2025-09-04 16:06:18 +01:00
primitives.py Fix/extraction prov (#662) 2026-03-06 12:23:58 +00:00
prompt.py Fix streaming API niggles (#599) 2026-01-06 16:41:35 +00:00
retrieval.py Add unified explainability support and librarian storage for (#693) 2026-03-12 21:40:09 +00:00
rows_query.py Structured data 2 (#645) 2026-02-23 15:56:29 +00:00
structured_query.py Extend use of user + collection fields (#503) 2025-09-08 18:28:38 +01:00
text_completion.py Update to add streaming tests (#600) 2026-01-06 21:48:05 +00:00
tool.py MCP client support (#427) 2025-07-07 23:52:23 +01:00
triples.py Feature/streaming triples (#676) 2026-03-09 15:46:33 +00:00