Book a demo
Skip to main content
Guide

How to prepare documents for an AI chatbot: 7 steps

How to prepare documents for an AI chatbot in 7 steps: drop old versions, split by topic, make sections self-contained, define terms, test with real questions.

The Harnix team · · 7 min read
Cách chuẩn bị tài liệu cho chatbot AI: 7 việc cần làm
UpdatesGuide

How to prepare documents for an AI chatbot: 7 steps

How to prepare documents for an AI chatbot in 7 steps: drop old versions, split by topic, make sections self-contained, define terms, test with real questions.

The Harnix team · 7 min read
Cách chuẩn bị tài liệu cho chatbot AI: 7 việc cần làm

Preparing documents for an AI chatbot means picking the right documents, removing old and duplicate versions, splitting them into small sections with clear headings, writing each section so it makes sense on its own, and then testing with real questions. A chatbot that answers from your documents (RAG) only reads a few short passages retrieved for each question, so messy documents produce messy answers, however good the model is. This guide walks through seven concrete steps, with a checklist you can use right away.

Why your documents decide answer quality

When a customer asks a question, a RAG chatbot does not reread your whole knowledge base. The system retrieves the few most relevant passages, adds them to the prompt, and the model writes an answer from those passages. If this mechanism is new to you, What is RAG? How chatbots answer from your business documents explains it step by step.

The consequence is that answer quality depends on whether the retrieved passages are correct, complete and understandable on their own. AWS's guidance on writing for RAG applications puts it plainly: because the response depends on the retrieved context, optimizing the source content is the most direct way to improve results.

AWS also lists common problems in source documents: missing headings and structure, undefined abbreviations, repeated or contradictory content across documents, ambiguous terms, screenshots and links that take up space in retrieved excerpts, and documents written for human readers that are hard for retrieval to use. Most internal documents at small and mid-sized businesses have at least a few of these issues, because they were written for staff, not for a chatbot.

7 steps to prepare documents for an AI chatbot

1. Pick the right documents and remove old and duplicate versions

Don't upload the whole shared drive. Start with the questions customers ask most (shipping fees, returns, warranty, opening hours, how to use the product) and include only the documents that answer them.

The most important part of this step is removing outdated versions. If your knowledge base holds both "Return policy 2025" and "Return policy 2026", the chatbot may retrieve the old one and give a wrong answer with full confidence. AWS lists redundant content and contradictory documents among the problems that make answers less relevant. Each topic should have exactly one source of truth.

2. Split large documents into smaller ones, one topic each

An 80-page "Customer handbook" covering pricing, shipping, warranty and technical questions is harder to search than several small files with one topic each. AWS recommends splitting documents with many subtopics into smaller, self-contained documents with clear titles for better indexing and tagging.

A simple rule: each file answers one group of questions, and the file name says what is inside, such as "Shipping fees and delivery times" rather than "Document v3 final".

3. Use clear headings and make every section stand on its own

Retrieval systems cut documents into small chunks, and a chunk separated from the text above it can lose its context entirely. Anthropic gives the example of a chunk that reads "The company's revenue grew by 3% over the previous quarter": on its own, it doesn't say which company or which quarter. In their tests, adding context to each chunk before indexing cut the retrieval failure rate by 35%. That is a system-side technique, but the lesson for whoever writes the documents is the same: every passage should say what it is about.

In practice:

  • Use real heading levels (H1, H2, H3 in Word or Markdown), not just bold, large text.
  • Avoid "as mentioned above" or "see section 3". Repeat the product or policy name in the passage when needed.
  • Keep conditions next to the rule they affect. "Returns within 7 days" and "not valid for sale items" belong in the same paragraph.
  • Number steps sequentially without skipping. AWS also suggests transitions between steps, such as "After completing step 2, ...".

4. Write the way customers ask

Customers don't ask about "Section 4.2 Shipping policy"; they ask "how long does delivery to Da Nang take". AWS suggests two ways to help passages match questions:

  • An opening sentence for common tasks, such as "If you want to exchange a product for a different size, follow these steps."
  • A one-sentence summary right under each heading, saying what the section answers. It improves matching in search and also helps human readers skim.

If you already have a list of frequent questions from chat apps, email or your call center, use the customers' own wording as section headings.

5. Define abbreviations and internal terms

The model doesn't know what "SP2 plan", "COD-X order" or "tier B VIP customer" means at your company. AWS notes that LLMs usually lack knowledge of internal enterprise terminology, and recommends defining abbreviations and explaining company-specific terms to improve accuracy and reduce hallucinations.

A quick fix: create a short "Glossary" document, and spell out each abbreviation the first time it appears in every document. If a term means two different things inside your company, pick one meaning or rename one of them.

6. Turn images, diagrams and complex tables into text

Information that lives in screenshots, diagrams or price lists saved as images often isn't read as text. AWS recommends describing graphical content in text, removing redundant images, and replacing complex tables with multi-level lists, because multi-dimensional tables are easily misread once converted to plain text.

For example, instead of a 5-column by 8-row price table, write "Basic plan: 200,000 VND per month, up to 3 users" for each plan. A simple table with a few rows is fine, but don't let key information exist only inside an image.

A note on file formats: a PDF exported from Word usually has a text layer the system can read. A scanned PDF (a photo of paper) does not, or the extracted text comes out garbled. If you have the original Word, Markdown or plain-text file, use that.

7. Test with real questions, fix the documents, and keep them current

Your documents are only "done" when the chatbot answers correctly. After uploading, ask 20–30 questions customers commonly ask and check which sources each answer cites. Wrong answers usually come from one of three causes: the information is missing, the wrong passage was retrieved, or an outdated document is still there. Each is fixed in the documents, not in the prompt. How to test an AI chatbot before launch includes a sample question set, and Chatbot giving wrong answers: how to find and fix weak spots goes deeper into diagnosis.

Once the chatbot is live, tie document updates to processes you already have: whenever a price or policy changes, the owner updates the chatbot's documents at the same time as the website.

Quick checklist before you upload

Problem Sign Fix
Old or duplicate versions Two files on the same topic from different years Keep one correct version, delete or archive the other
Oversized, multi-topic files One file for everything Split by question group, use clear file names
Passages that don't stand alone "As above", "this section", no product name Repeat the subject in the passage
Internal jargon Plan codes, undefined abbreviations Spell out on first use, add a glossary
Information inside images Price lists or diagrams as images Convert to text or lists
Scanned PDFs You can't select the text Use the original Word, Markdown or text file

Frequently asked questions

Which file format works best for a chatbot? Clearly structured text: Word, Markdown or plain text, or PDFs exported from those. Avoid scanned PDFs and information that only exists in images.

Do I need to rewrite all my documents? No. Start with the documents that answer your most frequent questions, fix them using the checklist above, and expand gradually based on questions the chatbot still answers poorly.

Do long documents make the chatbot slower or more expensive? The system only adds a few relevant passages to each answer, so the size of the knowledge base is not the main issue. What matters is whether the retrieved passages are correct and concise. What is context engineering? covers giving agents the right context in more depth.

How often should I review the documents? Whenever prices, policies or products change, and regularly based on questions the chatbot gets wrong or that customers rate as not helpful.

Where to start

In Harnix, the knowledge base accepts PDF, DOCX, TXT and Markdown files, answers come with source citations so you can see which passages the bot relied on, and you can download the original file of each document to edit it and upload a new version. Learn more in the Harnix docs, or get in touch with us at harnix.vn.

  • Guide
  • Vận hành AI
  • RAG
  • Chatbot
See a real RunWatch a Run work on your own documentsA 30-minute demo, built around your business's problem. The Harnix team calls you back within 1 business day.Read the docs →
See a real RunWatch a Run work on your own documents
A 30-minute demo, built around your business's problem. The Harnix team calls you back within 1 business day.

Read next: related features

The posts below cover other parts of Harnix.

All updates →