Skip to main content

Open for sponsorship and ad space.

Search everything

Find AI tools, reviews, prompts, and more

Quick links

AI Development

How to Build an AI Knowledge Assistant Using RAG: Platforms, Vector Databases and Costs

Priced a full RAG stack end to end on 16 October 2026: a 12,000-document corpus at 20,000 questions a month runs between roughly $62 and $319 a month on managed infrastructure, with vector storage contributing cents and generation tokens contributing most of the bill.

Article

29 min

6,405 words

Read the article

AIUnpacker Editorial

29 min read
What verified means

Share

29 min

The short version

Priced a full RAG stack end to end on 16 October 2026: a 12,000-document corpus at 20,000 questions a month runs between roughly $62 and $319 a month on managed infrastructure, with vector storage contributing cents and generation tokens contributing most of the bill.

Summarize with AI

Editorial Disclosure & Affiliate Notice

This content is published for informational and educational purposes only. It is not intended as a substitute for professional, legal, financial, or medical advice. AIUnpacker is funded through clearly labeled sponsored articles and reviews, relevant paid link placements, and affiliate commissions where disclosed. Commercial partnerships help fund the free editorial library. Sponsored work is labeled, and a payment does not change the verdict.

  • For educational purposes only. Nothing here should be taken as a guarantee, recommendation, or professional recommendation.
  • AI-assisted editing. Drafts are produced with AI assistance and get a human pass before they go up.
  • Opinions are our own. Also, we are not affiliated with most tools we cover unless explicitly stated.
  • Information may be outdated. Verify pricing, features, and policies directly with the vendor.
  • Last reviewed: . Published .

Read more on our About page, Terms and Editorial Policy.

Most guides take you from “here is a PDF” to “here is a chatbot” in fifteen minutes, then stop. You get something that works on the demo questions and fails on Tuesday. This one goes past the demo: every component, published prices, a monthly cost model with the arithmetic shown, and an eval plan you can run on Monday.

Short answer: to build an AI knowledge assistant using RAG you need nine components working in sequence: ingest, chunk on structure, embed, retrieve with BM25 and dense vectors together, filter by metadata, rerank, assemble context, generate, cite. Hybrid retrieval plus reranking is the configuration that survives contact with real users. And the bill is dominated by generation tokens, not storage.

I costed one scenario end to end: 12,000 documents, roughly 14.4 million tokens, about 32,000 chunks, 20,000 questions a month. Managed infrastructure lands between $62 and $319 a month depending on stack. Vector storage for the whole corpus is about six cents a month. Nobody budgets the retrieval half properly, so they get surprised by generation.

How to build an AI knowledge assistant using RAG in 2026

RAG (short for retrieval-augmented generation) is the pattern of fetching relevant passages from your own data at query time and putting them in the model’s context window, so answers are grounded in sources you control rather than frozen in model weights. The term comes from Lewis et al., “Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks” (arXiv:2005.11401), first submitted 22 May 2020 and accepted at NeurIPS 2020. Over six years old, still the canonical citation.

What changed since 2020 is the plumbing. Current LangChain retrieval documentation describes three architectures worth choosing between deliberately:

  • Two-step RAG: retrieval always runs before generation. Predictable, low latency, right for FAQs and documentation bots.
  • Agentic RAG: an LLM decides when and how to retrieve during reasoning. Flexible, variable latency, right for research assistants with multiple tools.
  • Hybrid RAG: query preprocessing, retrieval validation, post-generation checks. Medium on both counts.

Start with two-step. Move to agentic only when an eval set shows failures that fixed retrieval causes, because agentic RAG multiplies latency and eval cost.

Sources for the architecture and cost model

Pricing reflects vendor pages and Microsoft’s Retail Prices API checked on 16 October 2026. Package versions come from PyPI, npm and GitHub releases. Research results are attributed to the cited papers.

The cost model calculates from published unit prices. It does not represent a deployed system’s invoice, and no retrieval or latency benchmarks were run for this guide. Cohere’s pay-as-you-go Embed and Rerank rates remain unconfirmed here.

The pipeline, honestly: nine stages

  1. Ingestion: pull documents from their sources, parse them, and keep a stable document ID and source URL per chunk. Without that you cannot produce a working citation later.
  2. Chunking: split documents into retrievable units. See the next section; this is where most tutorials mislead you.
  3. Embedding: turn each chunk into a dense vector. text-embedding-3-small returns 1,536 dimensions and text-embedding-3-large returns 3,072 by default, both capped at 8,192 tokens of input, per OpenAI’s embeddings documentation.
  4. Hybrid retrieval: run BM25 keyword search and dense vector search, then fuse the two ranked lists.
  5. Metadata filtering: restrict the candidate pool by tenant, permission, date or document type before ranking.
  6. Reranking: pass the top 50 candidates through a cross-encoder and keep the best 5 to 10.
  7. Context assembly: pack the surviving chunks, ordered so the strongest evidence is not buried.
  8. Generation: send the assembled context with a grounded system prompt.
  9. Citation: return source links and quote spans alongside the answer, not as an afterthought.

Why fixed-size chunking is the wrong default

A chunk is the unit of retrieval, so anything that makes a chunk unanswerable on its own is a bug, not a trade-off. Most tutorials open with a fixed splitter (512 tokens, 64 overlap) and never revisit it.

The failure is concrete. Chunk a quarterly report and you get “Revenue grew by 3% over the previous quarter.” Which company? Which quarter? That chunk is unretrievable: a dense embedding of it is nearly meaningless, and BM25 cannot match words that are not in the chunk.

Four fixes, in rough order of effort-to-payoff:

  • Chunk on document structure. Headings, table rows, FAQ pairs, numbered clauses. Free, and usually the biggest single win.
  • Prepend context per chunk. Anthropic’s Contextual Retrieval prepends a short generated description of where the chunk sits before embedding and indexing. Vendor-reported, from August 2024: using 1 − recall@20 as the metric, with Gemini Text 004 embeddings and Cohere reranking: contextualised embeddings alone cut top-20 retrieval failure from 5.7% to 3.7%, and adding contextual BM25 cut it to 2.9%. Anthropic reports a one-time cost of $1.02 per million document tokens to generate that context, using prompt caching.
  • Late chunking. Günther et al., “Late Chunking” (arXiv:2409.04701, submitted 7 September 2024) embeds the whole document first, then pools token vectors into chunk vectors, so each chunk embedding carries full-document context.
  • Summarised parents. Retrieve small leaf chunks, hand the model the parent section. RAPTOR (arXiv:2401.18059, 31 January 2024) builds a recursive tree of summaries for this.

Use them together if your evaluation says so. Not because a blog said so.

Why hybrid retrieval usually beats dense-only

BM25 is a lexical ranking function scoring documents by term frequency, inverse document frequency and a length-normalising saturation; it matches exact strings that dense vectors blur. Ask it for “error code TS-999” and it finds TS-999. Ask an embedding model and you get documents about error codes.

The gap is structural, not incidental. Dense retrieval compresses meaning into a fixed-length vector; lexical retrieval preserves surface form. Neither dominates:

  • BM25 catches: product codes, SKUs, error strings, statute numbers, people’s names, exact phrases, rare proper nouns.
  • Dense catches: paraphrases, cross-language queries, conceptual matches, questions phrased nothing like the document.

Fuse them with reciprocal Rank Fusion, which merges ranked lists by summing 1/(k + rank). No score normalisation required: the practical reason it dominates weighted score blending. Recommended by Elastic, implemented in Qdrant’s Query API as rrf and dbsf, and described in Pinecone’s hybrid search guide as one of three ways to combine a keyword signal with a dense signal.

The broader evidence is consistent but mostly vendor-run. BEIR (arXiv:2104.08663, 17 April 2021) showed zero-shot retrieval is far harder than benchmarks suggested and that BM25 is a genuinely strong baseline. That paper is over five years old. Treat “hybrid beats dense” as a well-supported default you should still verify, not a law.

What is established versus what is hype

Four claims circulate constantly. Here is what the primary literature actually supports.

Agentic RAG: established, and harder than it looks. Letting a model decide when to retrieve is a documented architecture with a documented trade-off, not a buzzword. LangChain’s current docs price it explicitly: low control, high flexibility, variable latency. Self-RAG (arXiv:2310.11511, 17 October 2023) and CRAG (arXiv:2401.15884, 29 January 2024) both showed real gains, and both predate current models. Ship two-step first.

Late-interaction retrieval (ColBERT-style): effective, usually not worth it here. ColBERT (arXiv:2004.12832, SIGIR 2020) encodes query and document separately into many token-level vectors and matches them late, keeping BERT-level effectiveness at two orders of magnitude less latency per query. It needs an index sized for multi-vector storage though, and for a 32,000-chunk corpus a cross-encoder gets most of the benefit for a fraction of the complexity.

GraphRAG: real, and scoped to one question type. Microsoft’s GraphRAG (arXiv:2404.16130, submitted 24 April 2024) builds an entity graph plus community summaries to answer global questions (“what are the main themes across these 10,000 documents”) where conventional RAG fails because the task is query-focused summarisation, not lookup. The paper’s own claim is narrow: gains over a conventional RAG baseline on comprehensiveness and diversity for global sensemaking questions over roughly one-million-token datasets. If your user asks “what does our refund policy say”, GraphRAG is the wrong tool.

Long context versus RAG: settled enough to act on. Longer context windows do not remove the need for retrieval above a few hundred thousand tokens; they shift the break-even point. Retrieval meets Long Context LLMs (arXiv:2310.03025, 4 October 2023) framed it as a trade-off and Lost in the Middle (arXiv:2307.03172, 6 July 2023) showed position-dependent degradation. Both predate current architectures: re-test the threshold with your own tokens.

Choosing a vector database: the comparison

Every option below can answer a knowledge-base query. They differ on who runs it, what it costs at rest, and whether hybrid search and reranking are built in or something you assemble.

OptionFree tier / floorStorage and query price (16 Oct 2026)Hybrid searchReranking includedLicence / hosting
PineconeStarter $0 (2 GB, 1M read + 1M write units/mo); Builder $20/mo; Standard $50/mo minimumStorage $0.33/GB/mo; read units $16–$18 per million; write units $4–$4.50 per millionDense, sparse and full-text in one index; RRF or filter-then-rankYes: bge-reranker-v2-m3, pinecone-rerank-v0, cohere-rerank-4-fast at $2 per 1,000 requestsManaged
QdrantFree forever: single node, 0.5 vCPU / 1 GB RAM / 4 GB diskUsage-based hourly on vCPU, RAM, storage and backups; Qdrant publishes no flat per-GB rateSparse + dense, fused with rrf or dbsfCloud Inference free tier; paid models carry free tokensApache-2.0 OSS or managed
WeaviateFree forever: 100,000 objects, 1 GB RAM, 10 GB disk, 1 collectionFlex from $45/mo; vector dimensions from $0.00465 per 1M; storage from $0.12/GiB; backups from $0.03036/GiBHybrid on all paid plansNo: use its Query Agent or an external rerankerManaged (open-source core)
Zilliz Cloud / MilvusFree: 5 GB storage, 2.5M vCU/mo, up to 5 collectionsDedicated clusters from $63 / $16 / $5 per million vectors/mo by tier; rates assume 768-dim vectorsVia sparse + dense indexesNoMilvus is Apache-2.0 OSS; Zilliz is managed
ChromaStarter $0/mo + $5 credits; 10 databases$0.33/GiB/mo storage; $2.50/GiB written; $0.0075 per TiB queriedVector, full-text and metadata search; scale plan $250/moNoApache-2.0 OSS or cloud
pgvectorFree (it is a Postgres extensionPostgres instance cost onlyYes) combine with Postgres full-text search, RRF or a cross-encoderNoPostgreSQL licence
LanceDBOSS is freeOSS free; managed pricing needs a live calculatorUnified vector, full-text and hybrid with SQL filtersNoApache-2.0 OSS
FAISSFreeLibrary only: you own the serving layerNoNoC++/Python library from Meta FAIR
Elasticsearch / OpenSearchFree self-hosted; hosted tiers varyElastic Cloud is feature-gated by tier; OpenSearch bills per instance-hour (r6g.xlarge.search at $0.418/hr in AWS’s own worked example)First-class hybrid with RRF recommended by ElasticElastic has a semantic ranker tier; OpenSearch has neural pluginsCommercial / Apache-2.0
VespaFree to self-hostSelf-host free; Vespa Cloud commercial, on requestnearestNeighbor composes with BM25 in one YQL queryCustom ranking profilesApache-2.0
Vectara30-day trial onlySaaS from $100,000/year; VPC from $250,000/year; on-prem from $500,000/yearBuilt inBuilt inManaged

Three things this table tells you that marketing pages do not. The free tiers are genuinely usable: a 32,000-chunk corpus is a rounding error against Weaviate’s 100,000-object free tier, Zilliz’s 5 GB free tier or Pinecone’s 2 GB Starter allowance. The managed floors dominate your bill early: Pinecone’s $50 minimum and Weaviate’s $45 exceed everything else combined at small scale. And Vectara has left the self-serve market, with its cheapest SaaS tier starting at six figures a year.

One caveat on Pinecone: its pricing page illustrates throughput with worked examples (roughly 15,000 searches a day for a 30,000-document knowledge base with 1024-dimension embeddings on Starter) with an explicit disclaimer that these are illustrative only and subject to change. Sanity check, not quote.

Frameworks and managed platforms: own one layer, not five

The frameworks are free and mostly interchangeable. What you are really choosing is who owns the ingestion logic and the citation contract.

ToolCurrent version (16 Oct 2026)LicenceWhat it is actually good for
LlamaIndex0.14.25 (PyPI, 21 Sep 2026)MITData connectors and ingestion; IngestionPipeline caches per-node transformations
LangChain1.4.6 (PyPI, 14 Oct 2026)MITRetrieval abstractions and broad provider coverage
LangGraph1.2.15 (PyPI, 12 Oct 2026)MITStateful multi-step agentic RAG with cycles and persistence
Haystack3.4.0 (PyPI, 15 Oct 2026)Apache-2.0Pipelines you can inspect and unit-test
DSPy3.4.1 (PyPI, 12 Oct 2026)MITOptimising prompts and retrieval programs from a labelled set
RAGFlowv1.0.0-rc2 (GitHub, 16 Oct 2026)Apache-2.0Document-heavy ingestion with layout-aware parsing
DifyActive, 158,658 GitHub starsMixedLow-code app builder; self-hosting needs 2 CPU cores and 4 GiB RAM
Flowise3.1.4 (GitHub, 29 Jul 2026)MixedVisual drag-and-drop RAG builder
Langflowv1.12.6 (GitHub, 13 Oct 2026)MITVisual builder with a large component ecosystem
Open WebUI0.12.3 (PyPI and GitHub, 16 Oct 2026)MixedSelf-hosted chat UI with built-in document RAG

If a managed RAG service already covers your compliance boundary, use it. The economics:

Managed RAG servicePrice (16 Oct 2026)What it includes
AWS Bedrock Managed Knowledge BaseIndex storage $5.00 per GB of raw data/month; standard Retrieve API $1.00 per 1,000 calls; managed parsing, embeddings and reranking $0; agentic retrieval $4.00 per 1,000 agentic calls plus $1.00 per 1,000 underlying Retrieve callsIngestion, multimodal parsing, vector storage, hybrid retrieval, managed reranker
Google Vertex AI: grounding on your data$2.50 per 1,000 promptsGrounded generation over your own corpus; you supply and pay for the model
Azure AI SearchFree tier with 1,000 queries a month; Basic S1 $0.336/hour; Standard S2 $1.344/hour; Standard S3 $2.688/hour; semantic ranker $1.00 per 1,000 queries; serverless tier at $0.24/hour compute plus $0.20/GB/month storage, effective 1 September 2026Search engine with hybrid retrieval and semantic rank
Snowflake Cortex SearchServing billed per GB/month of indexed data; embedding via EMBED_TEXT_768 or EMBED_TEXT_1024 at a per-token credit cost; virtual warehouse refresh credits on topSearch service over Snowflake tables

Azure figures come from Microsoft’s official Retail Prices API, filtered to productName eq 'Azure AI Search' and armRegionName eq 'eastus'. Many meters carry 2025 effective dates: that is the API reporting last-change dates, not new pricing.

Embeddings and rerankers: current options and unit prices

An embedding model converts text into a fixed-length vector so you can measure semantic similarity with cosine distance; a reranker is a slower, more accurate model that scores query-document pairs directly. Both now have serious open-weight options.

Provider / modelPrice (16 Oct 2026)Notes
OpenAI text-embedding-3-small$0.02 per 1M tokens1,536 dims, 8,192 token max input, 62.3% on OpenAI’s cited MTEB figure
OpenAI text-embedding-3-large$0.13 per 1M tokens3,072 dims, 64.6% MTEB; dimensions parameter for Matryoshka truncation
Voyage voyage-4-lite$0.02 per 1M tokensFirst 200 million tokens free per account
Voyage voyage-4 / -4-large / -context-4$0.06 / $0.12 / $0.12 per 1MSame 200M free-token allowance
Voyage rerank-3$0.05 per 1M processed tokensFirst 200M tokens free; Voyage estimates $0.0025 per request at 100 documents of ~500 tokens
Voyage rerank-3-lite$0.02 per 1MSame free allowance
Cohere Embed 5 (embed-v5.0-pro / -fast)Per-token billing; rate not readable from the public page128k context; output dimensions 256–2048
Cohere Rerank 4 (rerank-v4.0-pro / -fast)Priced per search, not per token; rate not readable from the public pageModel Vault dedicated: Rerank 4 Pro Medium $5.00/hour or $3,250/month
Pinecone Inferencellama-text-embed-v2 $0.16/M tokens; multilingual-e5-large $0.08/M5M tokens/mo included on Starter, 10M on Builder
Jina AI jina-embeddings-v5-text-small / -nanoPricing page renders client-side; free tier available1024-dim and 768-dim, 32K and 8K context
BAAI/bge-m3Free, open weightsDense + multi-vector + sparse in one model, 100+ languages
Qwen/Qwen3-Embedding-8BFree, open weightsPer arXiv:2506.05176 (5 June 2025)

Two notes. OpenAI’s embeddings page states both v3 models have no knowledge of events after September 2021: fine for retrieval, but do not expect them to know anything current. And Hugging Face’s Inference Providers route through many vendors with no markup, showing $2.00 monthly credits for PRO users and $2.00 per seat for Team and Enterprise.

Evaluation: the section most guides skip

You cannot improve a RAG system you cannot measure, and you cannot debug one whose retrieval and generation scores are fused into a single number.

Split the metrics in two

Retrieval metrics need labelled relevant passages per query. Three matter:

  • Recall@k: of the passages that genuinely answer the question, what fraction appear in the top k returned? This tells you whether the right chunk is even reachable. If recall@20 is 0.6, reranking cannot save you; retrieval is the problem.
  • MRR (mean reciprocal rank): average of 1/rank of the first correct hit. Sensitive to ordering, which recall@k is not. Reranking moves MRR a lot and recall@k barely, which is how you prove the reranker worked.
  • nDCG@k: normalised discounted cumulative gain. Rewards putting the best passage at rank one rather than rank four. Use it when queries have several valid answers of differing quality.

Generation metrics need an LLM judge and can be reference-free:

  • Faithfulness / groundedness: does every claim trace back to a retrieved passage? The hallucination detector.
  • Answer relevancy: does the answer address the question asked?

RAGAS’s metrics catalogue lists these under its RAG section (Context Precision, Context Recall, Context Entities Recall, Noise Sensitivity, Response Relevancy, Faithfulness, plus multimodal variants) all reference-free, per the RAGAS paper (arXiv:2309.15217, submitted 26 September 2023).

The frameworks, as installed on 16 October 2026

FrameworkVersionLicenceBest for
RAGAS0.4.3 (13 Jan 2026)Apache-2.0Reference-free RAG metrics in Python; broadest metric catalogue
TruLens2.15.0 (5 Oct 2026)See PyPIApp tracing plus RAG triad scoring (context relevance, groundedness, answer relevance)
DeepEval4.3.0 (15 Oct 2026)Apache-2.0Pytest-style assertions; works like a test suite for prompts
promptfoo0.124.1 (npm, 8 Oct 2026)MITDeclarative YAML configs, red-teaming, CI diffing across prompt versions
ARESPaper, NAACL 2024 (submitted 16 Nov 2023)Research codeThe academic option: trains lightweight judges on synthetic data and needs only a few hundred human labels, using prediction-powered inference for calibration

Promptfoo is npm while the others are Python: that is a real operational difference. If your team is Node-first, promptfoo is the path of least resistance.

A worked evaluation set for a business

Build this before you build the chatbot.

  1. Sample 200 real questions. Pull from support tickets, sales call notes or search logs. Include 20% you know the current system cannot answer: those are where faithfulness fails.
  2. Label the gold passages. Mark which chunks answer each question. Two analysts on the first 50, reconcile disagreements, then use that as a quality bar for the rest. Budget roughly a day per 100 questions.
  3. Measure retrieval cold. Record recall@5, recall@20 and MRR@10 for the current configuration before changing anything. This baseline beats any vendor benchmark.
  4. Measure generation. Run faithfulness and answer relevancy with RAGAS or DeepEval. Cheap judge model routinely, expensive one only when validating a release.
  5. Change one thing. Chunk size, embedding model, top-k, reranker: one at a time. Two changes and you have learned nothing.
  6. Re-run and diff. Track metrics against the config hash. promptfoo does this natively.
  7. Gate CI. Fail the build when faithfulness drops past a set threshold. The step teams skip and regret.

Keep this set forever. It is the highest-leverage asset in a RAG project: every future model or configuration decision becomes an A/B test rather than an argument.

What a RAG assistant costs per month: the worked model

Assume:

  • Corpus: 12,000 documents at 1,200 tokens each = 14,400,000 tokens
  • Chunking: 512-token windows, 64-token overlap → 448-token stride → 14,400,000 ÷ 448 = 32,142 chunks
  • Embedding: each chunk embedded once = 32,142 × 512 = 16,456,704 tokens
  • Vectors: text-embedding-3-small, 1,536 dims, float32 = 6,144 bytes each → 197 MB ≈ 0.20 GB
  • Volume: 20,000 questions a month; top-50 candidates → hybrid fusion → rerank → top-8 to the model
  • Per query: 4,100 uncached input tokens + 600 cacheable tokens, 350 output tokens
  • Rerank per query: 50 documents × 512 tokens, plus query tokens counted per document (50 × 20) = 26,600 processed tokens

One-time ingestion cost

ModelRate16,456,704 tokensCost
text-embedding-3-small$0.02 / 1M16.46M$0.33
text-embedding-3-large$0.13 / 1M16.46M$2.14

Vector storage for 32,142 chunks of a 12,000-document corpus is about $0.06 a month on Pinecone Standard ($0.33/GB) and $0.23 a month on Weaviate Flex ($0.00465 per million vector dimensions, 49.4M dimensions). Generation tokens are where the money actually is: plan your budget around the model, not the database.

Recurring monthly cost, per line item (20,000 questions)

Line itemCalculationCost
Query embeddings20,000 × 20 tokens = 0.4M × $0.02/M$0.01
Retrieval: Pinecone StandardWithin the $50/mo minimum$50.00
Retrieval: Bedrock Managed KB20 × $1.00 per 1,000 calls$20.00
Retrieval: Vertex grounding20 × $2.50 per 1,000 prompts$50.00
Rerank: Voyage rerank-3532.0M tokens × $0.05/M$26.60
Rerank: Pinecone-hosted20 × $2.00 per 1,000 requests$40.00
Rerank: Bedrock managed reranker$0$0.00
Generation: gpt-5-mini82M × $0.25 + 12M × $0.025 + 7M × $2.00$34.80
Generation: gpt-6-luna82M × $0.10 + 12M × $0.01 + 7M × $0.20$9.72
Generation: gpt-6.1-sol82M × $2.00 + 12M × $0.10 + 7M × $10.00$235.20
Evaluation: 200 Q × 4 configs × 4 runsanswers $6.05 + judges $1.15$7.20

The five stacks, totalled

StackComponentsMonthly total
1. Cheapest managedPinecone Standard + Voyage rerank-3 + gpt-5-mini + eval$118.60
2. Frontier generationPinecone Standard + Voyage rerank-3 + gpt-6.1-sol + eval$319.00
3. Managed RAG serviceBedrock Managed Knowledge Base + gpt-5-mini + eval$62.29
4. Self-hostedpgvector on a $24/mo DigitalOcean Basic Droplet (4 GiB, 2 vCPU) + local bge-m3 embeddings + local bge-reranker-v2-m3 + gpt-5-mini + eval$66.00
5. Batch-optimised evalsStack 1, eval on the OpenAI Batch API (50% of standard pricing)$114.76

Read those numbers again. Switching from gpt-5-mini to gpt-6.1-sol costs $200 a month more than your entire vector database. Conversely, swapping Pinecone for Bedrock Knowledge Bases saves $30: real, but an order of magnitude less than the generation decision.

One correction to a common intuition: going cheaper on generation is not automatically the answer. gpt-6-luna at $9.72 a month is a third the cost of gpt-5-mini, and if it also answers more questions correctly you save on support deflection. Cost per correct answer is the metric, which is why the eval set comes before the cost model.

The free tier path, stated exactly

You can build and demo this for $0 to $20 a month:

  • Vector store: Chroma Cloud Starter ($0 + $5 credits), Zilliz Cloud Free (5 GB, 2.5M vCU/mo), Pinecone Starter ($0, 2 GB), Weaviate Free (100,000 objects, 10 GB disk) or Qdrant Cloud Free (1 GB RAM, 4 GB disk)
  • Embeddings: Voyage’s first 200M tokens free per account, or open weights like bge-m3
  • Orchestration: Dify, Flowise or Langflow self-hosted; Dify’s documented floor is 2 CPU cores and 4 GiB RAM
  • Generation: whatever you already pay OpenAI for, or a local model

The part that isn’t a dollar figure: engineering time

Estimate the schedule from the work your data and integrations need. Budget for these workstreams:

  1. Source connectors and parser hardening (the long pole: PDFs are never clean)
  2. Chunking strategy per document type
  3. Hybrid retrieval plus fusion implementation
  4. Reranker integration and latency budget
  5. Permission-aware metadata filtering
  6. The 200-question labelled eval set
  7. Citation rendering in your UI
  8. CI gates, monitoring and a re-indexing runbook
  9. Rate limiting, caching and cost alerting

Multiply that by your blended engineering day rate. That is your real number, and it will exceed the infrastructure bill in year one.

Build it: the nine-step implementation plan

  1. Stand up the eval set first. 200 labelled questions. Nothing else matters until this exists.
  2. Ingest with provenance. Every chunk gets a document ID, source URL, title and section path. You cannot cite what you cannot locate.
  3. Chunk on structure, with 512/64 as the fallback for unstructured prose. Record chunk size in your config hash.
  4. Embed once with a cheap model. text-embedding-3-small at $0.33 for this corpus is a rounding error.
  5. Implement hybrid retrieval. BM25 plus dense, fused with RRF. Return 50 candidates.
  6. Add metadata filters (tenant, permission, date) applied before ranking.
  7. Rerank to 8. Voyage rerank-3-lite or a local bge-reranker-v2-m3. Re-measure MRR to prove it worked.
  8. Generate with citations enforced in the prompt, then verify every returned citation resolves.
  9. Wire the CI gate and re-run the eval set on every prompt, model or chunk-size change.

What breaks: failure modes and gotchas

  • Approximate nearest-neighbour recall silently degrades. With pgvector, hnsw.ef_search defaults to 40 and results are limited by it; ivfflat.probes defaults to 1. Filtering after an approximate index scan is worse: if a filter matches 10% of rows you get roughly 4 matches out of 40 candidates. pgvector 0.8.0 added iterative index scans for this; turn them on.
  • Changing embedding model requires a full re-index. Vectors from one model are meaningless to an index built with another. Cheap here ($0.33) but a migration, not a config flip.
  • Fixed chunks break tables and code. A chunked table row loses its header; a chunked function loses its docstring.
  • Context stuffing hurts. More chunks raise the odds of including the answer and of distracting the model. Anthropic’s guidance, vendor-reported from August 2024, was that top-20 beat top-10 and top-5: one team’s result on their data.
  • Reranking is a latency and cost tax. 150 chunks per query costs far more than 20. Measure the curve on your own questions.
  • “Lost in the Middle” still bites. Long-context models degrade when relevant information sits mid-context. That evidence is over three years old, but put your strongest evidence at the top and the end rather than trusting uniform ordering.
  • Permission filtering is the security bug. Filtering after retrieval, or on a field that is not indexed, leaks documents across tenants. Filter at the query.
  • Eval drift. A judge model upgrade can move your faithfulness scores with no change to your system. Pin judge snapshots: OpenAI recommends pinning production snapshots such as gpt-5.5-2026-04-23 and building eval suites alongside.

Not legal advice (get counsel for your situation) but three things are load-bearing.

EU AI Act transparency. Article 50 came into force on 2 August 2026 under Article 113. It requires providers to ensure AI systems intended to interact directly with natural persons are designed so those people are informed they are interacting with an AI system, unless it is obvious to a reasonably well-informed person. A customer-facing knowledge assistant almost certainly triggers this. A one-line disclosure in the chat header satisfies the letter of it.

Data protection. Everything you index is data you process. Under UK and EU GDPR that needs a lawful basis, and personal data in the corpus needs one too.

Provider terms. OpenAI’s embeddings documentation states that customers own their input and output including for embeddings, and are responsible for ensuring content complies with applicable law. Read the same clause at your provider, then check whether regulated data touches the pipeline: most knowledge-base corpora contain more than people expect.

The bottom line

Build an AI knowledge assistant using RAG with hybrid retrieval, structure-aware chunking, and a reranker between retrieval and generation. Those three choices account for most of the difference between a demo and something people rely on.

Budget $62 to $319 a month for 20,000 questions a month on managed infrastructure, and expect engineering time to dwarf that in year one. Vector storage is pennies. Generation tokens are the line item. If your bill feels wrong, the fix is almost never a different database.

Build the 200-question eval set before you write the retriever. Everything else here is reversible; that set is the asset that compounds.

FAQ

What is the cheapest way to build a RAG knowledge assistant?

The cheapest real path is a free vector tier plus a database you already pay for. Chroma Cloud Starter is $0 a month with $5 of credits, Zilliz Cloud Free includes 5 GB of storage and 2.5 million vCU a month, Pinecone Starter is free with 2 GB of storage and 1 million read units a month, and Weaviate’s free tier holds 100,000 objects. Running pgvector inside existing Postgres drops the vector line to zero. You still pay for generation tokens and, if you rerank, rerank calls. Budget $0 to $20 a month for a working prototype.

How much does it cost to run a RAG assistant per month?

For the scenario modelled here (12,000 documents, roughly 32,000 chunks, 20,000 questions a month) managed options run from about $62 a month on AWS Bedrock Managed Knowledge Base with a small OpenAI model, to about $119 a month on Pinecone Standard, to about $319 a month on Pinecone Standard with a frontier-class generation model. A self-hosted pgvector setup on a $24 a month DigitalOcean droplet plus a small hosted model comes to roughly $66 a month. All figures exclude engineering time.

For knowledge bases, usually yes, and the mechanism is simple. BM25 matches exact strings (error codes, SKU numbers, statute numbers, product names) that dense embeddings blur. Vendor benchmarking supports the direction: Anthropic reported in August 2024 that adding BM25 to dense retrieval cut its top-20 retrieval failure rate from 5.7% to 4.2%, with larger gains on exact-match-heavy corpora. Treat that as a vendor benchmark from about 24 months ago, not settled science, and measure it on your own data.

What chunk size should I use for RAG?

Do not start from a number. Chunk along the structure your documents already have (headings, table rows, question-and-answer pairs) and then measure whether a retrieved chunk can answer a question on its own. A defensible starting configuration is 512 tokens with 64 tokens of overlap, which this article uses throughout the cost model. If you need the parent document’s heading to make a chunk make sense, the chunk is too decontextualised. Late chunking and contextual retrieval are the two well-documented fixes when structure alone is not enough.

For anything user-facing, yes. Retrieval must cast a wide net to avoid missing the right passage, but you only want a narrow set in the prompt. A cross-encoder reranker sits between the two and is the cheapest quality win available. Anthropic reported that adding reranking on top of contextualised embeddings plus BM25 took top-20 retrieval failure from 5.7% to 1.9%: again a vendor benchmark from August 2024. Confirm the latency and cost trade-off on your own candidate-set sizes.

How do I evaluate whether my RAG system is good?

Measure retrieval and generation separately. Retrieval metrics (recall@k, mean reciprocal rank, nDCG@k) require labelled relevant passages per query. Generation metrics (faithfulness, answer relevancy) need an LLM judge and can run reference-free. RAGAS 0.4.3, TruLens 2.15.0, DeepEval 4.3.0 and promptfoo 0.124.1 implement these. ARES (arXiv:2311.09476, NAACL 2024) is the research-backed option that needs only a few hundred human labels via prediction-powered inference.

Is RAG still worth it with long-context models?

Usually yes for corpora above a few hundred thousand tokens, because long context does not fix retrieval precision and scales poorly on cost. But it is not automatic. Anthropic’s own guidance, published in August 2024, was that under roughly 200,000 tokens (about 500 pages) you can skip retrieval entirely and place the whole corpus in the prompt with prompt caching. Above that, retrieval wins on cost and latency. Verify against your own token bill rather than assuming.

Which vector database should I pick?

Pick by constraint, not by benchmark. Already on Postgres means pgvector at v0.8.7 is usually right and costs nothing incremental. Pure managed with no ops burden points to Pinecone Standard at a $50 monthly minimum or Weaviate Flex at $45. Self-hosted control with good hybrid-query ergonomics points to Qdrant under Apache-2.0. Enterprise search you already own points to Elasticsearch or OpenSearch hybrid search with reciprocal rank fusion. Vectara’s SaaS now starts at $100,000 a year, which excludes it for most teams.

Can I switch embedding models later?

Yes, but treat it as a migration rather than a config change. Changing the embedding model changes the vector space, so the entire corpus must be re-embedded and the index rebuilt. You cannot query an index built with one model using vectors from another. At this scale the embedding cost is trivial (32,142 chunks with text-embedding-3-small is about 33 cents) so schedule the downtime, re-run the eval set, and compare before and after recall@k.

Three at minimum. EU AI Act Article 50 has been in force since 2 August 2026 and requires providers of AI systems intended to interact directly with natural persons to tell those people they are interacting with an AI system unless it is obvious. You also need a lawful basis for any personal data you index under UK and EU GDPR. And your model provider’s terms govern what you may send: OpenAI states customers own input and output but are responsible for complying with applicable law. Get qualified counsel for regulated use cases.


Sources

Weekly digest

Get our weekly AI digest

The latest AI tools, prompts, and insights — short, useful, every week.

No spam. Unsubscribe anytime.

AIUnpacker Editorial

Articles are written for a specific question. Sponsored work is labeled.