Skip to main content
Retrieval-augmented generation (RAG) is the most common production use case for Reader. You scrape a corpus of documents, chunk the text, embed the chunks, and store them in a vector database. At query time you retrieve the most relevant chunks and feed them to an LLM with the user’s question. Reader handles the scrape-to-markdown half. This guide shows how to connect it to the rest.

The pipeline

Step 1: scrape a corpus

Use batch mode to fetch many URLs in one call:
For very large corpora (thousands of URLs), use a webhook instead of polling so your worker isn’t stuck waiting. See Reliable batch processing.

Step 2: chunk the markdown

Break each document into chunks small enough to fit in your embedding model’s context window. A reasonable default is ~500 tokens per chunk with 50-token overlap.
For production, use a real tokenizer (e.g., tiktoken) instead of character-count estimates.

Step 3: embed and store

Step 4: retrieve at query time

Refreshing the index

Reader’s 24h cache means re-running your ingestion pipeline daily is cheap: anything that hasn’t changed returns from cache (0 credits). Only the genuinely new and updated pages cost credits. For sites that update frequently, run a daily crawl or re-scrape. For stable docs, once a week or on-demand is enough.

Cost considerations

Per URL in the ingestion pipeline: 1 credit (standard mode) to 3 credits (premium). Most corpus URLs (docs, blogs, news) work fine at standard. Use premium only for known-hostile sites. See Cost estimation to pilot first.

Next