Trace is a local-first RAG knowledge base with evaluation. It ingests PDFs, Markdown, and text files, chunks them, embeds them, stores them in Qdrant, answers questions with citations, and measures whether retrieval and generation are improving.
- Document ingestion for PDF, Markdown, and text.
- Configurable chunking strategies: fixed token windows, Markdown heading-aware chunks, and sentence windows with overlap.
- OpenAI-compatible provider adapter with Ollama defaults and optional cloud providers.
- Citation-first question answering with retrieved evidence and latency breakdowns.
- Evaluation dashboard for retrieval precision, hallucination rate, faithfulness, latency, and chunking strategy comparison.
flowchart LR
U["User"] --> W["Next.js workbench"]
W --> A["Go REST API"]
A --> S[("SQLite metadata")]
A --> F["Local uploads"]
A --> O["OpenAI-compatible model provider"]
A --> Q["Qdrant vector database"]
A --> E["Evaluation engine"]
E --> S
E --> O
E --> Q
- Install Go, Node.js, pnpm, Docker, and Ollama.
- Copy
.env.exampleto.env. - Start Qdrant:
docker compose up -d qdrant- Pull local models:
ollama pull llama3.1:8b
ollama pull nomic-embed-text- Install dependencies and run the app:
pnpm install
pnpm devThe API runs on http://localhost:8080, the web app runs on http://localhost:3000.
POST /api/documentsuploads a PDF, Markdown, or text file.GET /api/documentslists documents and ingestion state.GET /api/documents/{id}returns document detail and chunks.DELETE /api/documents/{id}removes metadata and local upload records.POST /api/questionsanswers with citations and latency metrics.POST /api/evals/datasetscreates an evaluation dataset.POST /api/evals/runsruns evaluation cases.GET /api/evals/runslists evaluation runs.GET /api/evals/runs/{id}returns run metrics and case results.
- Retrieval precision@k: how many expected documents or chunks appear in top-k retrieval.
- Hallucination rate: share of answers judged unsupported by retrieved context.
- Faithfulness: support score from evidence-grounded grading.
- Latency: retrieval, generation, and end-to-end timings.
- Chunking strategy comparison: aggregate quality and speed grouped by strategy.
Trace supports selectable-text PDFs. OCR for scanned documents is intentionally out of scope.
MIT