Prompt
I need a docs search tool that can answer questions from engineering docs
Latest observation
Absolutely — here’s a practical blueprint for a docs search tool that answers questions from engineering docs.
What you want
A system where a user can ask:
- “How do I rotate API keys?”
- “What’s the deployment process for staging?”
- “Where is the retry policy defined?”
- “How do I create a new Kafka topic?”
and get:
- a direct answer
- citations to the exact doc sections
- ideally links to the source docs
Recommended approach: RAG (Retrieval-Augmented Generation)
This is the standard architecture for “answer questions from documents.”
1) Ingest docs
Collect docs from sources like:
- Markdown / Git repos
- Confluence / Notion / Google Docs
- PDFs
- internal wikis
- code comments / ADRs / runbooks / READMEs
2) Chunk the docs
Split docs into searchable chunks:
- 200–800 tokens per chunk
- keep headings, section titles, and metadata
- preserve doc hierarchy if possible
3) Embed and index
Create vector embeddings for each chunk and store them in:
- Pinecone
- Weaviate
- pgvector
- Elasticsearch/OpenSearch vector search
- FAISS for smaller/local setups
4) Query retrieval
When a question comes in:
- embed the query
- retrieve top relevant chunks
- optionally rerank them with a cross-encoder or LLM reranker
5) Answer generation
Send the retrieved chunks to an LLM with instructions like:
- answer only from the provided docs
- cite sources
- say “I don’t know” if missing
Minimal architecture
User question
↓
Query embedding
↓
Vector search / keyword search
↓
Top relevant doc chunks
↓
LLM synthesizes answer
↓
Answer + citations
Strongly recommended features
Hybrid search
Use both:
- semantic vector search
- keyword/BM25 search
Engineering docs often contain:
- exact terms
- API names
- config keys
- error codes
Hybrid search usually works much better than vector-only search.
Citations
Always return:
- doc title
- section heading
- link
- excerpt/snippet
This is crucial for trust.
Access control
If docs are permissioned, retrieval must respect:
- user identity
- doc ACLs
- team/project scopes
Freshness
Engineering docs change often, so you need:
- incremental reindexing
- webhooks or scheduled syncs
- versioning
Good stack options
Simple and fast to build
- Frontend: Next.js / React
- Backend: FastAPI / Node.js
- Index: pgvector or Pinecone
- Search: hybrid with Elasticsearch/OpenSearch or pgvector + BM25
- LLM: GPT-4.1 / Claude / Llama 3.1
- Embeddings: OpenAI text-embedding-3-large or similar
More enterprise-oriented
- Ingestion: Airflow / Temporal / custom workers
- Storage: OpenSearch + object store
- Vector DB: Weaviate / Pinecone / OpenSearch vector
- Auth: SSO + ACL filtering
- Observability: tracing + answer feedback
Example answer behavior
User asks:
How do I deploy the service to staging?
System responds:
To deploy to staging, run
make deploy-stagingfrom the repo root. It builds the container, pushes to ECR, and updates the staging ECS service. You must be on themainbranch and havedeploy:stagingpermissions.
Source: “Staging Deployment Guide” → “Deploying”
Link: https://docs.company.com/staging-deploy
Important product decisions
Should it be pure search or answer generation?
Best UX is usually:
- search results first
- answer synthesis second
- always show citations
Should it support code?
If docs include code/config snippets, make sure it can retrieve:
- YAML
- JSON
- Terraform
- shell commands
- API examples
Should it use only docs or also codebase?
If you want engineering answers, often best to index:
- docs
- runbooks
- READMEs
- ADRs
- selected code/config references
Common pitfalls
- chunking too large or too small
- no citations
- using only vector search
- indexing stale docs
- ignoring permissions
- allowing hallucinations without source grounding
If you want a fast MVP
Build this first:
- ingest Markdown/Confluence docs
- chunk by headings
- store embeddings in pgvector
- add BM25 keyword search
- retrieve top 10 chunks
- rerank top 10
- ask LLM to answer with citations
- add feedback buttons
This can be done in a couple of weeks for a small team.
I can help you with one of these next:
- design the system architecture
- pick a tech stack
- write the backend API
- build a retrieval pipeline
- create a prompt/template for grounded answers
- draft a minimal MVP plan
If you want, I can also give you a concrete implementation plan in Python/FastAPI + pgvector.