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.

15 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

Claude16 min read

Chat With Any YouTube Channel in Claude (Cited, No Code)

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

Ask Claude to pull every transcript from a channel with the YouTube Transcript Scraper Pro Actor. Have it split the transcripts into labelled passages of up to 512 tokens with the Markdown RAG Chunker, then add the result to a Claude Project or a Cowork folder. Each passage begins with its video title and a timestamp link, so every answer can cite the exact moment in the video. It needs no code, and 50 captioned videos cost well under $1 in Apify usage.

Some creators have hundreds of hours of useful video and no searchable record of what they said. "What did they say about pricing?" usually means scrubbing through ten videos. This guide turns a channel into a knowledge base you can question in plain language, where every answer names the video and the minute it came from.

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.

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.

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.

Comparison13 min read

Firecrawl vs Jina Reader 2026: LLM Web Crawling Compared

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

Short answer: Jina Reader turns one URL into Markdown with a single GET request (https://r.jina.ai/<url>) and works without an API key at 20 requests a minute. Firecrawl is a credit-billed API, with an AGPL-3.0 engine you can self-host, that adds site crawling, URL mapping and schema-based JSON extraction; its cloud also allows keyless single-page scrapes under a daily per-IP cap, but crawling needs a key. Use Jina Reader to drop a page into a prompt; use Firecrawl to turn a whole site into a RAG index.

Prices, rate limits, headers and API versions on this page were checked against jina.ai and firecrawl.dev on 25 November 2026. Jina Reader's keyless behaviour and headers were tested the same day; the Firecrawl samples are quoted from its docs.

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.

Claude13 min read

Scrape Docs to Markdown for Claude RAG (2026)

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

To give Claude reliable answers about a product's documentation, crawl the docs to clean Markdown, split the Markdown on its headings into chunks of a few hundred tokens, embed the chunks in a vector database, and pass only the matching chunks to Claude. This guide does each step with current code: Firecrawl or Apify's Website Content Crawler for the crawl, Markdown RAG Chunker for header-aware chunks, Chroma for storage and the Claude API for answers.

Firecrawl12 min read

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

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

To build a RAG knowledge base from a website with Firecrawl, you run six steps: map the site's URLs, crawl the pages to Markdown, split the Markdown into chunks, embed each chunk, store the vectors with their source URL, and retrieve the closest chunks for each question. Firecrawl handles the first two steps. Chunking is the step that most affects answer quality, and it is the one Firecrawl leaves to you.

This guide gives you a tested Python pipeline for all six steps with the current Firecrawl SDK, plus two ways to chunk: a free local splitter and a header-aware chunker that adds section paths and stable IDs.

AI agents20 min read

Firecrawl Review 2026: Free Tier, Real Costs, Worth It?

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

Firecrawl is a web scraping and crawling API that turns a URL into clean, LLM-ready Markdown or schema-shaped JSON in one call. It is worth paying for if you feed web pages into a RAG pipeline or an AI agent and do not want to run browsers and proxies yourself. It is a weaker buy for recurring scraping of specific platforms, or for JSON extraction at volume, where each page costs 5 credits instead of 1.

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.

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.