Skip to main content
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.

Related topics

Self-hosting16 min read

Self-Hosted RAG Pipeline: Dify + Qdrant + Ollama on Liquid Web (2026)

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

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.

AI11 min read

RAG in Production: From Website Crawl to Vector Search That Actually Works (2026)

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

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:

StageToolKey decisions
CrawlApify Website Content CrawlerMarkdown output, max depth, content filtering
ChunkLangChain RecursiveCharacterTextSplitter~2000 character chunks, ~200 overlap (~500 tokens/chunk at ~4 chars/token — tune for your content)
EmbedOpenAI text-embedding-3-small or local all-MiniLM-L6-v2Cost vs quality trade-off
StoreQdrant or pgvectorManaged vs self-hosted
RetrieveDense 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
GenerateClaude SonnetWith 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)
Claude7 min read

Building a Custom RAG MCP Server for Claude with Firecrawl (2026)

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

A custom RAG MCP server gives Claude access to a private knowledge base built from your crawled web content. Firecrawl crawls URLs → markdown → chunk → embed → store in ChromaDB or pgvector. Your MCP server exposes a tool that queries the vector store and returns relevant chunks. Claude uses them to answer questions with your data. Start with Firecrawl.

Comparison3 min read

Firecrawl vs Jina Reader 2026: LLM Web Crawling Compared

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

Both Firecrawl and Jina Reader convert URLs to clean Markdown for LLMs — but their scope, pricing, and capabilities differ significantly.

TL;DR: Jina Reader is free and instant for single-URL lookups. Firecrawl is the production choice for full-site crawls, structured extraction, and RAG pipelines.

Ollama8 min read

Build a Local RAG Chatbot with Ollama and ChromaDB: No Cloud Required (2026)

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

Retrieval Augmented Generation (RAG) lets your chatbot answer from your own documents instead of relying solely on the model's training data. This guide shows you how to build a fully local RAG pipeline: documents → embeddings → ChromaDB vector store → retrieval → Ollama LLM → answers. No cloud APIs. No per-token billing. Everything runs on your machine or a Liquid Web GPU VPS for heavier workloads.

Firecrawl3 min read

Firecrawl for RAG: Build a Knowledge Base from Any Website 2026

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

Use Firecrawl to crawl a site, extract markdown, chunk it, embed, and store in a vector database. Then retrieve relevant chunks for RAG. Pipeline: map → crawl → chunk → embed → vector DB → retriever. Firecrawl gives clean markdown; LangChain or LlamaIndex handle the rest.

Start Firecrawl RAG →

AI agents12 min read

Firecrawl Review 2026: 1,000 Free Credits, Worth $16/mo?

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

Firecrawl is a web scraping and crawling API that converts any website into clean, LLM-ready Markdown or structured JSON with a single API call. If you're building RAG pipelines, AI agents, or any application that needs web content without the headache of proxy management and JavaScript rendering, this review covers everything you need to decide whether Firecrawl is the right tool for your stack in 2026.

AI5 min read

Data Pipelines for RAG: Extracting Web Data for LLMs

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

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.

AI5 min read

Bright Data for AI: Web Data for Training, RAG, and LLM Grounding

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

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.

Guides on this site

Frequently asked questions

Frequently Asked Questions

RAG (Retrieval-Augmented Generation) is the technique of giving an LLM access to a searchable knowledge base before it generates answers. This eliminates hallucinations on factual queries and lets you build AI assistants that know about your products, documentation, or industry without fine-tuning a model. The knowledge base needs fresh data — which means regularly scraping and indexing the sources you care about.

Fetch pages with Apify on a schedule, clean the HTML to plain text (Firecrawl does this well), split into overlapping chunks of 500–1000 tokens, embed with OpenAI's text-embedding-3-small, and upsert to a vector database (Pinecone, Qdrant, or pgvector). Set up a diff check to only re-embed pages that actually changed since the last crawl — this keeps costs down at scale.

Documentation sites, help centers, product catalogs, news archives, and long-form editorial content with stable structure index well and retrieve accurately. Avoid highly dynamic pages (live scores, stock prices) where freshness requirements exceed practical re-crawl frequency, and avoid paywalled or login-protected content. Plain, well-structured text chunks outperform dense tables or code-heavy pages in vector search.

Typical costs at moderate scale: Apify scraping at $0.005–$0.02 per page, OpenAI embeddings at roughly $0.00002 per 1,000 tokens (about $0.0001 per page), and vector database storage (Pinecone Starter is free up to 100k vectors). A knowledge base of 10,000 pages refreshed monthly costs roughly $20–$50/month in total infrastructure. Scale and frequency drive cost; most teams start on free tiers and upgrade as usage grows.