Check my levelCoursesProgramsFor teamsPricing
UKSign inSign up
Check my levelCoursesProgramsFor teamsPricingClaude quizPromptsBlogFAQSearchSign upUK
AcademlCoursesOpenAI RAG & Production Patterns
Get started free

Online course, Engineering

OpenAI RAG & Production Patterns: PDF RAG, Prompt Caching and API Limits

6 lessons of 25 minutes, 155 minutes in total: Python code, a task and a quiz in each.

Start: 7 days freePreview the first lesson, no sign-in

No card needed. The first two lessons are free after sign-up, all lessons come with Pro at $9 a month.

Parsing a PDF page: heading, table and chart detectedLesson 1, 25 minParsing PDFs for RAG: GPT-4o + embeddings
  • Intermediatelevel
  • 2 h 35 min6 lessons, 2 modules
  • At your own paceupdated Dec 2, 2026
  • Certificatewith a check code
What you will learnLessonsCertificateQuestionsStart the course

What you will learn

  • Parse PDFs two ways — as text and as model-written page descriptions — and compare search quality
  • Prepend the slide title and document name to each chunk for more accurate search
  • Expand a question into 5–10 search queries with a model and re-rank the results with HyDE
  • Put the static part of the prompt — instructions, tools, documents — first, mark an explicit cache breakpoint after it, and read cached_tokens and cache_write_tokens
  • Retry 429s with tenacity or your own backoff with jitter, fall back to another model and pace batch requests
  • Summarize a document over 10K tokens with a detail parameter from 0 to 1, and recursively
  • Extract fields from a PDF in 1,000-token chunks with a template that allows "Not specified", and measure document coverage

What the OpenAI RAG & production course covers

The course covers what a RAG system on the OpenAI API needs in production: parsing complex PDFs as text and images, answering from an external search API with HyDE re-ranking, prompt caching, retries on 429 errors, summarizing long documents with adjustable detail, and extracting fields from documents larger than the model's window. 6 lessons of 25 minutes.

Pricing and what's free →
01
Free lesson

Parsing PDFs for RAG: GPT-4o + embeddings

Parsing complex PDFs two ways: text with pdfminer and page descriptions from a vision model, page-level chunks, text-embedding-3-small embeddings and cosine-similarity search. In the task you compare text-only and description-only search on three queries. The OpenAI API now extracts both text and page images from a PDF itself, so you can replace the manual image conversion with a file input.

Open the lesson →

Lessons

RAG: data ingestion and retrieval → production optimization: caching, rate limits, summarization, extraction. The first two lessons are free.

Module 1 · 2 lessons · 50 min

RAG: Data Ingestion and Retrieval

Build a RAG pipeline from scratch: parse PDFs with GPT-4o vision, create per-page embeddings, and answer questions with HyDE re-ranking.

1Parsing PDFs for RAG: GPT-4o + embeddingsfree25 minTurn complex PDFs (slide decks, reports) into retrieval-ready content: dual parsing with pdfminer (text) and GPT-4o vision (images), per-page chunking, text-embedding-3-small embeddings, cosine similarity search.2Q&A via Search API and HyDE Re-rankingfree25 minBuild RAG on top of an external Search API (NewsAPI): model-generated query variants, article retrieval, HyDE (Hypothetical Document Embeddings) re-ranking, streamed answer with source citations.
Module 2 · 4 lessons · 1 h 45 min

Production Optimization

Prompt caching to cut costs and latency, graceful rate limit handling with exponential backoff, and structured extraction from long documents.

3Prompt Caching: -80% latency on repeated prompts30 minOpenAI automatically caches the repeated start of a prompt. Learn implicit and explicit modes, cache breakpoints and TTL on GPT-5.6 and later, write and read pricing, caching tools and images, and the cached_tokens and cache_write_tokens fields in the Responses API.4Rate Limits: exponential backoff and batch throughput25 minHandle 429 RateLimitError without crashes: tenacity and backoff decorators, manual exponential backoff with jitter, model fallback, and proactive delay for high-throughput batch jobs.

Who it is for

  • Developers taking a RAG system or assistant on the OpenAI API to production
  • Teams with knowledge bases built from PDFs, slides and reports full of tables and charts
  • Anyone hitting 429 errors and growing token bills in batch processing
  • Developers pulling dates, amounts and names out of long contracts, reports and regulations

How the lessons work

  1. A 25-minute lessonA walkthrough of an OpenAI Cookbook notebook with Python code: PDFs, embeddings, caching, retries, summarization.
  2. A hands-on task in every lessonFor example, write a batch processor for 50 texts with tenacity and pauses between requests and compare timings, or build a support assistant with 5+ functions and confirm cached_tokens is above zero from the second request. AI checks your solution and explains the result (after sign-up).
  3. Ready-made prompt and common mistakesA prompt for the lesson task and the mistakes that hurt quality and the bill: dynamic data at the start of the prompt, retries without backoff and jitter, max_tokens far above the real answer, summarizing a document in one request, extraction without a "Not specified" option.
  4. 3-question quiz and AI tutorThe quiz checks the lesson; the AI tutor answers questions on the topic.
  5. CertificateAfter all lessons you get a certificate with a unique verification code.

Certificate of completion

You get it when you finish every lesson. Each certificate has its own code, so an employer can check it on our site. You can add it to LinkedIn.

See how a certificate is checked
Sample

What changed since the lessons were written

The lessons retell six OpenAI Cookbook notebooks (MIT license): "How to parse PDF docs for RAG" (Sep 2024), "Question answering using a search API and re-ranking" (Jun 2023), "Prompt Caching 101" (Oct 2024), "How to handle rate limits" (Jan 2025), "Summarizing Long Documents" (Apr 2024) and "Long document content extraction" (Feb 2023). Academl is not affiliated with OpenAI.

Models in the lesson code: gpt-3.5-turbo and gpt-4-turbo shut down on Oct 23, 2026, and gpt-4o and gpt-4o-mini will shut down on Jan 14, 2027, with gpt-6-luna as the replacement. The prompt caching lesson has already moved to gpt-6-luna and the Responses API.

Prompt caching on GPT-5.6 and later starts at 1,024 tokens. It is controlled by prompt_cache_options: implicit mode by default, or explicit mode with prompt_cache_breakpoint markers. A 30-minute cache write costs 1.25× ordinary input and a read 0.1× (0.05× on GPT-6.1 Sol and Terra); the Responses API also offers 12 hours at 2.5×. Cached input is discounted by up to 95%. We removed the "-80% latency" from the earlier lesson title: the current OpenAI guide does not state it and does not promise lower latency on every request.

The rate-limits guide now says to honor the Retry-After header first and fall back to exponential backoff with jitter only without it. Quota and billing errors should not be retried, and the SDK's built-in retries should be turned off or counted in your own retry limit.

The Batch API costs 50% less, runs on a separate, substantially larger pool of rate limits, and returns results within 24 hours.

PDFs can be sent as files: for vision models the API extracts both text and page images. For search over your own files OpenAI offers vector stores and the file_search tool with hybrid search settings.

  • OpenAI — prompt caching: minimum, pricing, lifetime
  • OpenAI — rate limits and retries
  • OpenAI — Batch API
  • OpenAI — PDF and other file inputs
  • OpenAI — Retrieval API and vector stores
  • OpenAI — deprecations and shutdown dates

What's free and what it costs

  • The first two lessons, parsing PDFs for RAG and answering from a search API with HyDE, are free after a free sign-up.
  • After sign-up you get 7 days of full access to all 6 lessons and the whole catalog, no card needed.
  • After that, Pro costs $9 a month or $79 a year. Online card payment is not connected yet: write to info@academl.com and we open access manually.
  • OpenAI API calls from the examples run on your own key and are billed by OpenAI at its rates.

OpenAI RAG & production course: questions

How do I summarize a long document with the OpenAI API?+

The lesson, based on the "Summarizing Long Documents" Cookbook notebook, splits the document into chunks along separators, summarizes each one and joins the results. The detail parameter from 0 to 1 sets the number of chunks and so the length of the summary. summarize_recursively feeds earlier summaries into the next request: more coherent, but more expensive. At detail=1, a 100K-token document means hundreds of requests.

How does OpenAI prompt caching work?+

Caching is on by default and kicks in when the start of a prompt matches a recent request. On GPT-5.6 and later the minimum is 1,024 tokens and reads cost 0.1× ordinary input. Put static content — instructions, tools, documents — first and the user's question last, and keep the tool order fixed. You can place an explicit prompt_cache_breakpoint right after the static part. Hits show up in the cached_tokens field, writes in cache_write_tokens.

How should I handle a 429 RateLimitError?+

Retry with a pause. OpenAI's guide says to honor the Retry-After header first, and without it use exponential backoff with random jitter and a cap on attempts. The lesson shows this with tenacity and by hand, adds a fallback model and pacing between batch requests. Quota and billing errors are not worth retrying.

How do I build RAG over PDFs with slides and tables?+

The lesson processes each page twice: text with pdfminer and a page description from a vision model, then merges both into a chunk, prepends the slide title and document name, and computes embeddings. Today you can send the PDF to the API as a file: vision models receive both the text and the page images.

What is HyDE?+

Hypothetical Document Embeddings: the model writes a hypothetical answer to the question, and retrieved articles are ranked by similarity to that answer, because good answers read differently from questions. The lesson warns about the risk: HyDE can promote a source that is close in meaning but wrong on facts. Check the original source when you need exact quotes.

The course in short

level
Intermediate
For whom
For developers
Task
Search in data, RAG
Format
Lessons, quizzes and tasks checked by AI
Lesson language
English

Is this course right for you?

Check your level in 3 minutes. We will show which course to start with.

Check my level

More courses on this topic

Full catalog
Intermediate

RAG & Vector Databases

12 Python lessons on RAG: embeddings, Qdrant and pgvector, chunking, hybrid BM25 + RRF search, reranking, HyDE, RAGAS evaluation and a production pipeline.

6 h 15 min, 12 lessonsCertificate
Intermediate

OpenAI Embeddings: Complete Guide

8 lessons on OpenAI embeddings: text-embedding-3-small, semantic search, code search, reranking, classification, clustering, Q&A and recommendations.

3 h 20 min, 8 lessonsCertificate
Intermediate

RAG and working with documents

A short RAG course: when RAG beats long context, how to chunk documents, measure Recall@K, add a reranker and keep the index fresh.

1 h 10 min, 4 lessonsCertificate
Advanced

OpenAI Fine-tuning: From Data to DPO

5 Python lessons: JSONL checks and training cost, SFT, DPO, distillation and RFT with a grader. What changed in OpenAI fine-tuning in 2026 is on the page.

3 h 10 min, 5 lessonsCertificate

Keep going

Lesson: summarizing long documents, chunking and the detail parameter →OpenAI Embeddings: your first embeddings call →RAG & Vector Databases: Qdrant and pgvector →Hybrid search and vector databases: an LLM Engineer lesson →RAG over documents in one hour →OpenAI API from A to Z →OpenAI embedding models compared: size, price, dimensions →

Start with RAG over your own PDF

The first two lessons are open after a free sign-up. Sign up with email or Google to get 7 days of full access to the whole course and catalog.

Sign up
CoursesLLM coursesFor teamsPricingFAQBlogAboutPrivacy
© 2026 AcademlDevelopment & promotion —MMIX — Marketing Mix
5
Summarizing long documents with controllable detail
25 min
Summarize documents over 10k tokens with a detail parameter from 0 to 1: delimiter-based chunking, a summary of each chunk in turn, and a recursive mode where each request sees the previous summary.
6Entity extraction from long documents25 minExtract structured data (dates, amounts, names) from PDFs exceeding the context window: token-based chunking with tiktoken, a template prompt with fallback, zip-based result aggregation.
Certificate
Your name
for the course
OpenAI RAG & Production Patterns
ACADEML · VERIFIED · ACADEML · VERIFIED · SAMPLE
  • OpenAI Cookbook — Summarizing Long Documents
  • When should I use the Batch API?+

    When the answer can wait up to 24 hours: labeling, summarizing an archive, extracting fields from a batch of documents. Per OpenAI's guide, a batch costs 50% less and runs on a separate, substantially larger pool of rate limits. Interactive requests where a user is waiting stay on the regular API with retries.

    How is this different from the other RAG courses?+

    RAG and working with documents explains how RAG works in an hour without code, RAG & Vector Databases builds search on Qdrant and pgvector, and OpenAI Embeddings covers embeddings and semantic search. This course is about production techniques on the OpenAI API: complex PDFs, HyDE, caching, rate limits, summarization and extraction.

    How long is the course and what does it cost?+

    6 lessons of 25 minutes, 155 minutes in total, with a certificate with a verification code after all lessons. The first two lessons are always free, sign-up gives 7 days of full access with no card, then Pro is $9 a month or $79 a year. API calls are billed by OpenAI separately.