Skip to main content
use-apify.com

Vector search: guides & tutorials

Semantic search over crawled content: embeddings, vector databases, and retrieval patterns that power RAG systems built on Apify-collected data.

1 articles

View all tags

AI16 min read

Production RAG Architecture: Crawl to Cited Answers (2026)

· 16 min read
Yassine El Haddad
Software Developer & Automation Specialist

A production RAG (retrieval-augmented generation) system crawls your content, splits it into section-sized chunks, embeds them in a vector database, retrieves and reranks the best matches for each question, and has an LLM answer only from those matches, with citations. Most RAG projects that disappoint in production get the model right and the plumbing wrong: chunks that cut sections in half, no reranking, and an index that silently goes stale.

This guide builds each stage with ready-to-run Python, and spends most of its time on the parts other guides skip: chunking, freshness and measurement.

StageToolKey decision
1. CrawlApify Website Content CrawlerClean Markdown per page, on a schedule
2. ChunkMarkdown RAG Chunker or LangChainOne section per chunk, ≤512 tokens, stable IDs
3. EmbedOpenAI text-embedding-3-small or local FastEmbedCost vs quality
4. StoreQdrant or pgvectorDedicated vector DB vs your existing Postgres
5. RetrieveDense search + Cohere rerank-v4.0-proTop 20 candidates, rerank to top 5
6. GenerateClaude (claude-opus-5-5)Answer only from sources, cite them
7. Stay freshStable chunk IDs + document_hash cleanupRe-embed only what changed

Install everything (latest stable versions as of October 2026; the code below targets them):

pip install apify-client==3.3.0 langchain-text-splitters==1.1.3 tiktoken==0.14.0 \
openai==3.35.1 fastembed==0.9.0 qdrant-client==1.19.1 cohere==7.2.0 anthropic==1.15.0

You need an Apify account, a Qdrant instance (docker run -p 6333:6333 qdrant/qdrant, or Qdrant Cloud's free tier), and API keys for the services you choose: OpenAI (optional), Cohere and Anthropic.