Gareth B. Davies
All articles
Build itAI & RAG

How to build a knowledge base an AI can actually answer from

A knowledge base that reads fine to a human can still make an AI hallucinate, because the two are searching it in completely different ways.

Most people building an AI agent's knowledge base start from the wrong assumption: that if the information is written down somewhere, the AI can find it. A human skimming a folder of PDFs uses context you never write down, like knowing the March pricing sheet supersedes January's, or that the FAQ document contradicts the onboarding email because the onboarding email is outdated. An AI doing retrieval doesn't have that judgment. It pulls the chunk that scores highest on similarity, not the chunk that's actually correct, and it will answer confidently from a stale document exactly as fast as it answers from a current one.

This is why the first real decision isn't which vector database to use, it's whether you need one at all. A coach working with several builders kept steering them away from vector search the moment the underlying data was structured, like patient appointments, vehicle records, or lender guidelines. If the question is "does this record exist" or "what is the status of this claim," that's a database query against Postgres or Airtable, not a semantic search.

Vector databases earn their keep on unstructured content: long PDFs, policy documents, freeform notes, things where the question and the answer might use completely different words. Reach for embeddings only when the data is genuinely unstructured, and reach for a structured store when it isn't. Blending the two without noticing which is which is where most of these projects start to wobble.

The chunking problem nobody budgets for

Even when unstructured search is the right call, the failures rarely show up in the retrieval logic. They show up in how the source material was cut apart before it ever reached the database. One builder was working on a pipeline meant to answer questions from long insurance quotes, sometimes two or three hundred pages. Tested against a much shorter sample document with a single embedding batch size, it looked solid. But a batch size and chunk boundary tuned for a 35-page file behaves very differently against a 300-page one, where a clause on page 40 references a definition on page 4 that never makes it into the same chunk. The system wasn't broken. It had simply never been tested at the scale it was built for.

That gap between demo-scale and real-scale is the single most common reason a knowledge base looks finished and then fails in front of a client. It's worth naming directly.

A knowledge base that passes on your test document is not the same claim as a knowledge base that passes on your client's documents.

Run it against the ugliest, longest, most inconsistent file the client actually has before anyone calls it done.

Where the data actually lives matters more than the search layer

A second failure mode sits even earlier than chunking: how the source material gets into the system in the first place. One team considered scraping lender websites to keep guideline data current, then backed off because scraped sites break the moment a vendor redesigns a page, turning the knowledge base into a maintenance job instead of an asset. The better fix was structural, not technical: build a small portal where lenders upload their own guidelines directly. That reframes the problem from "keep up with someone else's website" to "give the source of truth an easy way to hand you clean data," which is a completely different, much more stable job.

The same instinct applies to metadata. A builder integrating document storage kept hitting duplicate chunks and missing file references because the file ID wasn't being populated consistently at ingestion. No amount of tuning the retrieval step fixes a problem that originated on the way in. If a record's source, date, or owner isn't captured cleanly when it enters the system, every query built on top of it inherits that ambiguity, and it surfaces later as a wrong answer that looks, on the surface, like a search bug.

Test the answers, not just the pipeline

Once a knowledge base is live, the real risk shifts from "does retrieval work" to "does anyone know when it stops working." A support automation project handling queries across many client accounts ran into this directly: the hard part wasn't building the response pipeline, it was monitoring accuracy across every type of question those accounts could ask. The practical answer there was blunt but effective, logging responses to a database and manually checking a sample of them against the actual intent of each incoming message. There's no shortcut around this. Retrieval systems degrade quietly, one wrong answer at a time, and nothing catches that except someone periodically reading the actual output next to the actual question.

A date bug from an unrelated project makes the same point from another angle: a system storing timestamps without timezone handling displayed June 24th data as June 23rd. Nobody would call that an AI failure, but the AI answering from that record would confidently state the wrong day. The knowledge base is only as trustworthy as the pipeline feeding it, end to end.

The principle underneath all of this is the same one: an AI can't tell the difference between clean data and confident-sounding data, so that judgment has to be built into the system before the AI ever sees it, not patched in after it gives a wrong answer.

Airtablen8nSupabasePostgres

Want a partner working through this with you?

The AAA Accelerator is where AI agency builders get coached on exactly these calls, from first client to full pipeline.