Tutorial2 min read

How We Build a RAG Assistant on Company Docs

This is the playbook we follow for internal and customer-facing assistants that answer from company documents. Each step exists because skipping it caused a problem on an earlier project.

TrueCodeAI Engineering
Agents, Voice & ML practice
Published
RAGTutorialAI agents
Laptop showing code beside a plant and a yellow mug

The process

  1. Source audit: list every source, owner, format, update frequency and who may see it. Remove duplicates and outdated versions at the source.
  2. Eval set first: collect 100+ real questions with correct answers and the document each comes from, plus questions the assistant should refuse.
  3. Parsing: structure-aware extraction that keeps headings, tables and lists intact.
  4. Chunking: split by document structure, with headings carried into each chunk for context.
  5. Indexing: embeddings plus a keyword index, with metadata for source, date and permissions.
  6. Retrieval: hybrid search, a reranking step, and permission filters on every query.
  7. Generation: answer only from retrieved passages, cite each claim, refuse when nothing relevant is found.
  8. Evaluate and iterate until the agreed target is met on the eval set.
  9. Launch with feedback buttons and trace logging; review failures weekly.

What we measure

RAG assistant metrics we report weekly
MetricMeaning
Retrieval hit rateCorrect source appears in the top results
Answer correctnessGraded against the expected answer
Citation accuracyCited passage actually supports the claim
Correct refusalsOut-of-scope questions declined
Latency and cost per answerUser experience and budget

Timeline

A pilot on one clean source set takes two to three weeks. A production assistant with several sources, permissions and analytics takes three to five weeks.

Frequently asked questions

Which documents work best?

Well-structured text: policies, manuals, help articles. Scans and complex spreadsheets need extra parsing work.

How do you keep answers current?

Scheduled or event-driven re-indexing, with deleted documents removed from the index automatically.

Can it live in Slack or Teams?

Yes — the same assistant can serve a web widget, Slack, Teams and WhatsApp.

Tell us what you want to exist.

We reply within 24 hours at hello@truecodeai.com with how we would build it.

Get a fixed price WhatsApp