use-apify.com
RAG: guides & tutorials
RAG grounds LLMs with fresh crawled chunks, not stale weights alone. Chunking, embeddings, and Apify crawlers feeding vector DBs with clean markdown.
14 articlesPage 1 of 2
View all tags
Retrieval-augmented generation grounds LLMs in fresh, crawled content instead of stale training weights. These guides cover the RAG pipeline end to end: crawling sources, chunking, embedding, and feeding vector databases with clean markdown.
Quality retrieval starts with quality ingestion, well-chunked, deduplicated, current data. Apify crawlers supply that input and keep it refreshed. Below you will find tutorials on building RAG corpora and keeping them up to date.

TL;DR
- One
docker-compose.yml: Dify (API + worker + web + sandbox) + Qdrant + Ollama + PostgreSQL + Redis + Caddy
- Measured idle RAM: ~7.4 GB (Llama 3 8B loaded, CPU inference); minimum server: 16 GB VPS
- Replaces: OpenAI Assistants API ($0.03/1k tokens) + Pinecone Starter ($70/mo) with a fully local, zero-egress alternative
- Your documents never leave the server — not during upload, not during embedding, not during inference
Retrieval-Augmented Generation (RAG) lets you ask questions against a private document corpus and get answers grounded in the actual content. The dominant hosted pattern — OpenAI Assistants + Pinecone — works, but every document chunk and every query travels to OpenAI's servers. For legal contracts, internal knowledge bases, or any non-public data, that is a compliance liability.
This guide deploys a fully self-hosted RAG stack: Dify as the orchestration and document management layer, Qdrant as the vector database, and Ollama serving both the embedding model and the chat LLM — all on a single Liquid Web VPS.

Many RAG (Retrieval-Augmented Generation) projects fail in production not because the technology doesn't work, but because teams skip the hard parts: chunking strategy, embedding model selection, retrieval quality measurement, and stale data management. Validate each step on your own corpus — field names, SDK versions, and Actor outputs change over time.
The pipeline: crawl websites → chunk intelligently → embed → store in vector DB → retrieve with reranking → generate answers with citations.
TL;DR:
| Stage | Tool | Key decisions |
|---|
| Crawl | Apify Website Content Crawler | Markdown output, max depth, content filtering |
| Chunk | LangChain RecursiveCharacterTextSplitter | ~2000 character chunks, ~200 overlap (~500 tokens/chunk at ~4 chars/token — tune for your content) |
| Embed | OpenAI text-embedding-3-small or local all-MiniLM-L6-v2 | Cost vs quality trade-off |
| Store | Qdrant or pgvector | Managed vs self-hosted |
| Retrieve | Dense vector search + Cohere rerank (sample below) | Top-k=20 candidates, rerank to top-5 — add BM25 / sparse hybrid in Qdrant if you need keyword-heavy queries |
| Generate | Claude Sonnet | With source citations |
Prerequisites:
- Python 3.10+ or Node.js 18+
- Apify account (sign up)
- Vector database (Qdrant Cloud free tier or self-hosted)
- LLM API key (Claude, GPT-4, or self-hosted Ollama)

Feeding live web pages into an LLM or a RAG index sounds simple until you look at the token math. Raw HTML for a typical docs or product page can blow past 100,000 tokens once you count inline CSS, SVG, trackers, and nested <div>s—while the sentences you actually care about might sit closer to 3,000.
Shipping that HTML straight into inference burns latency and context budget, and it tends to bury the important lines—the familiar “lost in the middle” problem.
This guide compares the old playbook (sanitize HTML yourself) with API-first Markdown extraction aimed at chunking and embeddings, without changing the underlying tradeoffs.

Generative AI work is still gated by data quality and access. Pre-training needs very large, diverse text corpora. RAG needs fresh pages and documents so answers stay grounded. Agents need live web access when the task is not fully offline.
Bright Data began as a proxy vendor and now markets heavily to AI teams: curated datasets, an official MCP (Model Context Protocol) Server, and a cloud Browser API aimed at agent-style automation.
This guide outlines how those pieces fit together and how they compare to managed extraction platforms like Apify.