How vidhvath28/nixos-docs-copilot works
NixOS Docs Copilot ingests the NixOS manual into a persistent vector index, then serves cited answers through a corrective-RAG workflow. The graph separates retrieval, relevance grading, query rewriting, and answer generation; the API exposes that workflow and a small web UI. The README also documents an evaluation harness, included as a separate capability. Edges reflect the sampled source and README; the UI’s browser-to-API behavior is not shown, so that link is marked unverified.
Main entry points: main.py FastAPI endpoints · llm.py Vector store access · graph.py RAG state machine · ingest.py Fetch and chunk
Components 18
Manual ingestion
- Fetch and chunk
app/ingest.py
Answer service
- FastAPI endpoints
app/main.py - Web UI
app/static/index.html
Corrective RAG
- Similarity search
app/graph.py - RAG state machine
app/graph.py - Retrieve passages
app/graph.py - Grade relevance
app/graph.py - Rewrite query
app/graph.py - Generate citations
app/graph.py
Runtime services
- Settings
app/config.py - Local embeddings
app/embeddings.py - Chroma index
app/ingest.py - Vector store access
app/llm.py - Chat model factory
app/llm.py
Evaluation
- Eval harness
evals/run_evals.py
Other components
- Questioner
- NixOS manual
- LLM provider
Connections 26
- Questioner → FastAPI endpoints: asks
README.md - FastAPI endpoints → RAG state machine: invokes
app/main.py - FastAPI endpoints → Web UI: serves
app/main.py - Web UI → FastAPI endpoints: submits questions
- Settings → Fetch and chunk: configures
app/ingest.py - Fetch and chunk → NixOS manual: fetches
app/ingest.py - Fetch and chunk → Local embeddings: embeds chunks
app/ingest.py - Fetch and chunk → Chroma index: writes chunks
app/ingest.py - Settings → Vector store access: configures
app/llm.py - Vector store access → Local embeddings: embeds queries
app/llm.py - Vector store access → Chroma index: opens
app/llm.py - FastAPI endpoints → Vector store access: opens
app/main.py - FastAPI endpoints → Similarity search: builds search
app/main.py - Similarity search → Vector store access: searches
app/graph.py - RAG state machine → Retrieve passages: starts
app/graph.py - Retrieve passages → Similarity search: queries
app/graph.py - Retrieve passages → Grade relevance: passes passages
app/graph.py - Grade relevance → Rewrite query: routes if empty
app/graph.py - Grade relevance → Generate citations: routes if relevant
app/graph.py - Rewrite query → Retrieve passages: retries query
app/graph.py - Generate citations → RAG state machine: returns answer
app/graph.py - RAG state machine → Chat model factory: uses model
app/main.py - Chat model factory → LLM provider: calls
README.md - Eval harness → Vector store access: measures retrieval
evals/run_evals.py - Eval harness → RAG state machine: runs modes
evals/run_evals.py - Eval harness → Chat model factory: judges answers
evals/run_evals.py