Check my levelCoursesProgramsFor teamsPricing
UKSign inSign up
Check my levelCoursesProgramsFor teamsPricingClaude quizPromptsBlogFAQSearchSign upUK
AcademlCoursesOpenAI RAG & Production PatternsQ&A via Search API and HyDE Re-ranking
Parsing a PDF page: heading, table and chart detectedA workflow map: a Telegram message branches into command, voice and text and reaches the agentA form request lands in a spreadsheet row labelled “Complaint”
Course

OpenAI RAG & Production Patterns

Module 1 · RAG: Data Ingestion and Retrieval
01Parsing PDFs for RAG: Vision Models + Embeddings02Q&A via Search API and HyDE Re-ranking
Module 2 · Production Optimization
03Prompt Caching: up to 95% off repeated prefixes04Rate Limits: exponential backoff and batch throughput05Summarizing long documents with controllable detail06Entity extraction from long documents
OpenAI RAG & Production Patterns · Lesson 2

Q&A via Search API and HyDE Re-ranking

Build RAG on top of an external Search API (NewsAPI): model-generated query variants via Structured Outputs, article retrieval, HyDE (Hypothetical Document Embeddings) re-ranking, streamed answer with source citations. Plus a comparison with the built-in web_search and file_search tools in the Responses API.

25 min readUpdated Nov 23, 20263 questions in quizReady prompt included

Architecture: Search → Re-rank → Answer

Instead of a vector database, we use an external Search API. The pipeline has three steps:

  1. Search — the model generates multiple query variants
  2. Re-rank — filter by semantic similarity using HyDE
  3. Answer — generate a response with source links

The code below uses the Responses API, which OpenAI recommends for new projects; Chat Completions is still supported. gpt-6-luna is the most cost-efficient model in OpenAI's current lineup ($0.10 per 1M input tokens). For harder questions, swap in gpt-6.2-sol.

The rest of this lesson opens after a free sign-up

Sign up with email or Google: the first two lessons of every course stay open for good, and the whole catalog is open for 7 days. No card needed.

Sign up freeOr a trial lesson, no sign-up →
In this lesson
Architecture: Search → Re-rank → AnswerStep 1: Query ExpansionStep 2: HyDE Re-rankingStep 3: Generate the AnswerBuilt-in websearch: when you can skip your own pipelinePracticeReady promptQuiz
CoursesLLM coursesFor teamsPricingFAQBlogAboutPrivacy
© 2026 AcademlDevelopment & promotion —MMIX — Marketing Mix
Get started free