Added Explainable AI agent demo in Typescript (#770)

(Not functional code)
This commit is contained in:
cybermaggedon 2026-04-08 14:16:14 +01:00 committed by GitHub
parent e81418c58f
commit aff96e57cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 594 additions and 0 deletions

View file

@ -0,0 +1,29 @@
# Explainable AI Demo
Demonstrates the TrustGraph streaming agent API with inline explainability
events. Sends an agent query, receives streaming thinking/observation/answer
chunks alongside RDF provenance events, then resolves the full provenance
chain from answer back to source documents.
## What it shows
- Streaming agent responses (thinking, observation, answer)
- Inline explainability events with RDF triples (W3C PROV + TrustGraph namespace)
- Label resolution for entity and predicate URIs
- Provenance chain traversal: subgraph → chunk → page → document
- Source text retrieval from the librarian using chunk IDs
## Prerequisites
A running TrustGraph instance with at least one loaded document and a
running flow. The default configuration connects to `ws://localhost:8088`.
## Usage
```bash
npm install
node index.js
```
Edit the `QUESTION` and `SOCKET_URL` constants at the top of `index.js`
to change the query or target instance.