19 November 2026 · Practical AI builds
How do I build a chatbot that answers from my own files?
By the end of this you will have a small chatbot that reads your own documents, such as price lists, policies, manuals and FAQs, and answers questions from them. It also tells you which file each answer came from. It suits a small business, a freelancer or a small team that answers the same questions every week and wants the answers to match what is already written down.
I learn my automation tips in the AI Profit Boardroom. Have a look here. Affiliate link.
What you need
- Your documents in a readable format: plain text, Word files, PDFs with real text in them (not scans), or spreadsheets saved as CSV.
- An account with an AI model provider. Using a model inside your own app usually goes through the provider's API, which is billed separately from any chat subscription and charged by use.
- For the quick route: a chat assistant that lets you upload files to a project or notebook. Several mainstream assistants do this. How many files and how much text you can add depends on the tool and the plan.
- For the self-built route: some basic Python, an embedding model (good open-source ones run on an ordinary server), and somewhere to store and search the results, such as Chroma or Postgres with the pgvector extension.
- Somewhere to run it if you build it yourself, such as your own computer or a small VPS.
Step by step
- Write down 20 real questions that customers or colleagues ask, with the correct answer to each. These are your test, and you will use them all the way through.
- Gather the files and tidy them up. Remove old versions, drafts and anything private. The bot can only be as accurate as the files you give it.
- Try the quick route first. Upload the files to a project-style feature in an assistant you already use, tell it to answer only from those files, and ask your 20 questions. If it is only for you, this may be all you need.
- If other people need to use it, or it has to sit on your website, build it yourself. The usual method is called retrieval-augmented generation (RAG): find the passages that matter first, then give only those to the model.
- Turn each file into plain text and split it into chunks of a few hundred words. Keep the file name and the nearest heading with each chunk so the bot can say where an answer came from.
- Run each chunk through the embedding model. This turns the text into a list of numbers that captures its meaning. Save those in your vector store, and do it again whenever a file changes.
- When a question comes in, embed it the same way, pull back the five or so closest chunks, and send them to the model along with the question and a strict instruction.
- The instruction matters most. Tell the model to use only the passages, to say when it cannot find an answer, and to name its sources. A simple version is below.
- Ask your 20 test questions again and compare the answers with yours. If answers are weak, change the chunk size or the number of chunks, or fix the files themselves.
- Put it behind a simple web page and keep it private at first, either behind a login or on your own machine. Log every question and answer so you can check them.
You answer questions for sitename using only the passages below.
If the passages do not contain the answer, reply:
I could not find that in our documents. Please contact user@example.com.
Do not guess and do not use outside knowledge.
At the end of each answer, list the file names you used.
Passages:
{passages}
Question:
{question}What good looks like
It gets most of your 20 test questions right and names the right file for each. When you ask something your documents do not cover, it says it could not find the answer instead of making one up. When you update a file and rebuild the store, the answers change to match. Your question log shows people getting answers without a follow-up message to you.
Watch out for
Accuracy. A strict prompt cuts down on made-up answers but does not stop them completely. Old or conflicting files also lead to confident wrong answers. Have a person check anything to do with prices, refunds, legal or health matters before anyone relies on it, and say clearly on the page that answers come from an AI.
Privacy. Whatever you put in, and every question people ask, is sent to the model provider unless you run the model yourself. Read the provider's data terms, and keep personal customer details out unless you are allowed to share them. A public chatbot can sometimes be talked into repeating anything in its files, so only include what you would be happy to publish.
Questions people ask
Do I need to train my own AI model?
No. With retrieval the model stays the same and reads the right passages fresh each time, so keeping it up to date just means replacing a file and rebuilding the store.
Can it read scanned PDFs or photos of documents?
Only after the text has been pulled out with OCR (optical character recognition). Check that text before you add it, because a misread number becomes a wrong answer.
To sum up: tidy your files, test with real questions, find the relevant passages and hand only those to the model with a strict instruction. Keep it private and checked by a person until the answers are reliable.
Want more automation tips? The AI Profit Boardroom on Skool is where I get mine. Have a look here. Affiliate link.