Fill in your details optional The prompt below updates as you type. What you type stays in this browser and is never sent to us.
You are a senior AI engineer who builds retrieval-augmented generation (RAG) systems. Build an AI assistant with me, phase by phase, that answers questions only from our documents and shows where each answer came from.
## The assistant
- Who will ask questions: [EMPLOYEES / CUSTOMERS]
- Documents it learns from: [e.g. PDFs, Word files, help-centre pages, Google Drive, Notion]
- Number and size of documents: [ROUGH NUMBERS]
- LLM provider: [e.g. Anthropic Claude, OpenAI, a local model]
- Where it runs: [web app / chat widget on our site / Slack / Teams]
- Tech stack I prefer: [e.g. Python + FastAPI + PostgreSQL with pgvector, or "you choose"]
## Features
1. Ingestion: upload or connect sources, extract text (including tables and PDFs with scanned pages via OCR), clean it, split into chunks with overlap, store metadata (title, URL, page, date, access group).
2. Embeddings and a vector index, with hybrid search (keyword + vector) and re-ranking.
3. Answering: retrieve the best chunks, build a prompt that tells the model to answer only from them, show citations with links to the exact source, and say "I don't know" when the sources do not cover it.
4. Conversation memory within a chat, with follow-up questions rewritten into stand-alone queries.
5. Access control: users only get answers from documents they are allowed to see.
6. Re-sync: detect changed or deleted documents and update the index.
7. Admin: sources, sync status, conversations, thumbs up or down feedback, questions it could not answer.
8. Evaluation: a test set of 30+ questions with expected answers, and a script that scores answer accuracy and citation correctness after every change.
9. A chat widget that can be embedded on a website with one script tag.
## AI rules
- Defend against prompt injection inside documents: treat document text as data, never as instructions.
- Never send restricted documents to users without access, even inside citations.
- Log token usage and cost per conversation; cache embeddings; stream answers.
## Quality rules (apply to every phase)
- Security: prepared statements or an ORM for every query, output escaping, CSRF tokens on every form, passwords hashed with bcrypt or Argon2, rate-limited login, role checks on the server for every admin route, file uploads checked by type and size and stored outside the web root or with random names, secrets only in an .env file.
- Validation: validate every input on the server (and also in the browser for speed). Show clear error messages next to the field that is wrong, and keep what the user already typed.
- Performance: pagination on every list, database indexes on every column used for search, filter or join, lazy-loaded and resized images (WebP), caching for pages that rarely change, no N+1 queries.
- Responsive and accessible: mobile first, works from 360px to wide desktop, proper labels on every form field, keyboard navigation, visible focus, colour contrast of at least 4.5:1, alt text on images.
- SEO: clean URLs, a unique title and meta description per page, canonical tags, Open Graph tags, schema.org JSON-LD where it applies, an XML sitemap and robots.txt.
- Code: small functions with clear names, one responsibility per file, comments only where the reason is not obvious, consistent formatting, no dead code.
- Errors: friendly error pages (404, 500), server errors written to a log, never shown to visitors.
- Deliver with: a README (install steps, .env example, how to create the first admin), database migrations and seed data with realistic sample content, and a deployment checklist.
## How to work with me
Do not write code yet. First reply with:
1. A short summary of what you understood, and anything in the brief that is unclear or contradictory (ask me, do not guess).
2. The final tech stack, with a one-line reason for each choice.
3. The folder and file structure.
4. The full database schema: every table, column, type, index and relation.
5. Every page or screen, and every API endpoint (method, path, who can call it, what it returns).
6. The build plan as numbered phases, each one small enough to finish and test on its own.
Wait for me to reply "go". Then build one phase at a time:
- For every file, give the full path and the complete code. Never write "...", "rest of the code stays the same" or TODO.
- After each phase, tell me how to run it, what to click to test it, and what is still missing. Then wait for me to reply "next".
- If you change a file you already gave me, give the whole updated file again.
How to use this prompt
- Copy the prompt. Press Copy prompt and the full text goes to your clipboard.
- Fill the brackets. Use the form above, or replace [EMPLOYEES / CUSTOMERS], [e.g. PDFs, Word files, help-centre pages, Google Drive, Notion], [ROUGH NUMBERS], [e.g. Anthropic Claude, OpenAI, a local model], [web app / chat widget on our site / Slack / Teams], [e.g. Python + FastAPI + PostgreSQL with pgvector, or "you choose"] with your own details.
- Paste and send. Paste it into ChatGPT, Claude, Gemini and DeepSeek and send. Ask follow-up questions to refine the answer.
Why this prompt works
The “Build an AI chatbot that answers from your own documents (RAG)” prompt describes the whole app before any code is written: 9 features, starting with ingestion; embeddings and a vector index, with hybrid search; and answering. It then has the assistant build it in 9 stages, so you can test each part before the next one starts. Quality rules apply to every stage, so the result is code you can run rather than a sketch.
How to get the best answer
- Fill every bracket with real detail: [EMPLOYEES / CUSTOMERS], [e.g. PDFs, Word files, help-centre pages, Google Drive, Notion], [ROUGH NUMBERS] and the rest should hold real names, numbers and dates, not placeholders.
- Paste real material: where the prompt asks for notes, data or text, paste the actual content rather than a summary.
- Refine in the same chat: ask "make it shorter", "turn it into a table" or "add more detail on step 2".
- Check the result: test what it builds or writes before you rely on it.
FAQ
Frequently asked questions
Which AI assistant works best with the “Build an AI chatbot that answers from your own documents (RAG)” prompt?
The “Build an AI chatbot that answers from your own documents (RAG)” prompt works in any chat assistant and suits ChatGPT, Claude, Gemini and DeepSeek best. Paste it in, send it, and ask follow-up questions in the same chat to refine the answer.
What do I fill in before sending the “Build an AI chatbot that answers from your own documents (RAG)” prompt?
Replace the 6 highlighted brackets – [EMPLOYEES / CUSTOMERS], [e.g. PDFs, Word files, help-centre pages, Google Drive, Notion], [ROUGH NUMBERS], [e.g. Anthropic Claude, OpenAI, a local model], [web app / chat widget on our site / Slack / Teams], [e.g. Python + FastAPI + PostgreSQL with pgvector, or "you choose"] – with your own details. The more specific you are, the better the answer.
Who is the “Build an AI chatbot that answers from your own documents (RAG)” prompt for?
Anyone who wants a complete, working result from an AI assistant. Replace the brackets with your own project details.
Is the “Build an AI chatbot that answers from your own documents (RAG)” prompt free to use?
Yes. First AI Prompt prompts are free to copy and use in personal and business work, with no sign-up, no account and no daily limit.
Can I trust the answer the “Build an AI chatbot that answers from your own documents (RAG)” prompt gives?
Treat it as a strong first draft: the prompt tells the assistant not to invent facts and to mark its assumptions, but check figures yourself, especially anything with legal, financial or safety consequences.
Keep exploring