Use DeepDoc
Chatbot
An optional Q&A layer over your docs and source, answering with citations.
The chatbot is off by default. Turned on, it adds an /ask page to your
docs site backed by a small Python service that answers questions about your
codebase — with file-and-line citations rather than assertions.
Enable it
deepdoc init --provider anthropic --with-chatbot
export ANTHROPIC_API_KEY=sk-ant-...
deepdoc generate
deepdoc servedeepdoc config set chatbot.enabled true
deepdoc generate
deepdoc serveserve starts the backend alongside the site. Nothing else to run.
Three surfaces, three models
Independent on purpose, so you can pair an expensive writer with a cheap responder:
| Surface | Config | Used for |
|---|---|---|
| Documentation | llm.* | Writing your docs |
| Answers | chatbot.answer.* | Replying in the chatbot |
| Embeddings | chatbot.embeddings.* | Indexing and retrieval |
Leave chatbot.answer.* empty and it inherits llm.*.
chatbot:
enabled: true
answer:
provider: openai
model: gpt-4o-mini
api_key_env: OPENAI_API_KEY
Query modes
Single-pass retrieval, then one answer. Good for “where is X handled?” — the common case, and the cheaper one.
An agentic loop that searches, reads files and greps until it can answer. Slower and costs more, for questions spanning several parts of the codebase.
Readers pick per question in the UI.
Evidence, not assertions
Answers cite the source they came from — file path and line range — so a claim can be checked rather than trusted. Where the chatbot cannot find support, it says so instead of filling the gap.
The API
The backend is a small FastAPI service with six endpoints:
| Endpoint | |
|---|---|
GET /health | Liveness |
POST /query | Fast answer |
POST /deep | Agentic answer |
POST /query/stream | Fast, streamed |
POST /deep/stream | Agentic, streamed |
POST /query-context | Retrieval only, no answer — useful for debugging what it found |
Deploying it
The docs site is static and can go anywhere. The chatbot is a Python service and needs somewhere to run.
chatbot_backend/ to an internal Python host.chatbot.backend.base_url at it.chatbot.backend.allowed_origins.chatbot:
backend:
base_url: "https://docs-chat.internal.acme.com"
allowed_origins:
- "https://docs.acme.com"
Turning it off
deepdoc config set chatbot.enabled false
deepdoc generate
The /ask route and chatbot components are not scaffolded at all when it is
disabled. deepdoc clean preserves chatbot_backend/, since it may contain
your changes — delete it by hand if you want it gone.