Blokk Logo
Login

RAG Explained: How to Build AI Assistants That Actually Know Your Business

by Blokk

RAG Explained: How to Build AI Assistants That Actually Know Your Business
·6 min read

The problem with generic AI

You've probably tried asking ChatGPT a question about your company. The answer was either wrong, generic, or a polite version of "I don't know."

That's because large language models are trained on public internet data. They know about Shakespeare, Python syntax, and the capital of Mongolia. They know nothing about your internal processes, product catalog, or customer history.

RAG solves this. It's the bridge between powerful AI models and your actual business data.

What is RAG?

RAG stands for Retrieval-Augmented Generation. The name sounds complex, but the concept is straightforward:

  1. User asks a question
  2. The system retrieves relevant information from your documents
  3. That information is passed to the AI model as context
  4. The model generates an answer based on your actual data

Instead of relying on what the model "memorized" during training, RAG gives it the right information at the right time.

Think of it like this: instead of hiring someone who memorized an encyclopedia, you hire someone smart and give them access to your company's filing cabinet. They read the relevant documents before answering.

How RAG works (step by step)

Step 1: Prepare your knowledge base

Your documents, SOPs, product manuals, FAQs, emails, Notion pages — whatever contains the information your AI assistant needs to know.

These documents are split into smaller chunks (typically 500-1000 tokens each). Why? Because AI models have limited context windows, and smaller chunks allow for more precise retrieval.

Step 2: Create embeddings

Each chunk is converted into a vector embedding — a numerical representation that captures the meaning of the text. Similar content produces similar vectors.

This is done using embedding models like OpenAI's text-embedding-3-small or open-source alternatives like bge-large.

Step 3: Store in a vector database

The embeddings are stored in a specialized database designed for similarity search:

  • Pinecone — fully managed, scales easily
  • pgvector — PostgreSQL extension, great if you're already on Postgres
  • Weaviate — open-source, feature-rich
  • Supabase — comes with pgvector built-in

Step 4: Query and retrieve

When a user asks a question, their query is also converted to an embedding. The vector database finds the chunks most similar to the query — these are your "relevant documents."

Step 5: Generate with context

The retrieved chunks are injected into the prompt alongside the user's question. The AI model now has the context it needs to give an accurate, grounded answer.

System: You are a helpful assistant. Answer based on the following context.

Context:
[Retrieved chunk 1: Product return policy...]
[Retrieved chunk 2: Shipping times for international orders...]

User: What's the return window for international orders?

The model responds with information from YOUR documents, not from its training data.

Where RAG makes the biggest impact

Internal knowledge assistants

Every company has institutional knowledge trapped in documents, wikis, and people's heads. A RAG-powered assistant can:

  • Answer HR questions using your actual employee handbook
  • Help engineers find relevant documentation instantly
  • Let sales teams query product specs without waiting for someone to respond

The ROI here is time saved. If 50 employees each save 30 minutes a day not searching for information, that's over 500 hours per month.

Customer-facing support

Instead of a generic chatbot that frustrates customers, RAG enables assistants that:

  • Answer product questions using your actual documentation
  • Reference specific policies (shipping, returns, warranties)
  • Provide accurate pricing and availability
  • Escalate with full context when human help is needed

Compliance and legal

Legal teams spend enormous time searching through contracts, regulations, and precedents. A RAG system can:

  • Find relevant clauses across hundreds of contracts
  • Compare terms between different vendor agreements
  • Surface regulatory requirements that apply to specific situations

Common pitfalls (and how to avoid them)

Pitfall 1: Garbage in, garbage out

If your documents are outdated, contradictory, or poorly written, your AI assistant will confidently give wrong answers. Clean your data first.

Pitfall 2: Chunk size matters

Too large and you include irrelevant information. Too small and you lose context. There's no universal answer — it depends on your content type. Start with 500-800 tokens and experiment.

Pitfall 3: Ignoring evaluation

You need to systematically test your RAG system. Create a set of questions with known correct answers and measure:

  • Retrieval accuracy: did the system find the right documents?
  • Answer accuracy: did the model generate the correct response?
  • Hallucination rate: how often does it make things up?

Pitfall 4: Not handling "I don't know"

A well-built RAG system should know when it doesn't have enough information to answer. The model should say "I don't have information about this" rather than guessing. This requires careful prompt engineering.

Pitfall 5: Skipping the hybrid approach

Pure vector search isn't always enough. Combining it with traditional keyword search (BM25) often produces better results. Most production RAG systems use hybrid search.

RAG vs Fine-tuning: when to use which

This is one of the most common questions we get.

Use RAG when:

  • Your data changes frequently
  • You need citations and traceability
  • You want to keep the base model unchanged
  • Privacy matters (data stays in your system)

Use Fine-tuning when:

  • You need the model to adopt a specific tone or style
  • The task is highly specialized and consistent
  • You have thousands of examples to train on
  • Speed matters more than flexibility

Most real-world projects use RAG, not fine-tuning. Fine-tuning is harder to maintain, more expensive, and less flexible.

The tech stack we recommend

For most business applications, here's what works:

  • Embedding model: OpenAI text-embedding-3-small (cost-effective) or text-embedding-3-large (higher accuracy)
  • Vector database: Supabase with pgvector (if you're already on Supabase) or Pinecone (if you want fully managed)
  • LLM: Claude or GPT-4 for complex reasoning, GPT-4o-mini for simpler queries
  • Orchestration: LangChain or LlamaIndex for the retrieval pipeline
  • Monitoring: Track retrieval accuracy, response times, and user satisfaction

Conclusion

RAG isn't a silver bullet, but it's the most practical way to make AI actually useful for your business. The gap between "AI is interesting" and "AI is making us money" is almost always a data problem — and RAG is how you solve it.

The companies getting real value from AI aren't the ones with the fanciest models. They're the ones who connected the right data to the right interface at the right time.


Ready to build an AI assistant that actually knows your business? Book a demo and we'll show you how RAG works with your data.

Ready to
integrate AI?

Book a free demo and discover how we can help.