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.
ENМатеріали курсів поки англійською. Інтерфейс, ШІ-наставник і перевірка завдань — українською.
Architecture: Search → Re-rank → Answer
Instead of a vector database, we use an external Search API. The pipeline has three steps:
- Search — the model generates multiple query variants
- Re-rank — filter by semantic similarity using HyDE
- 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.
Далі урок відкривається після безкоштовної реєстрації
Реєстрація через email або Google відкриває перші два уроки кожного курсу назавжди і 7 днів повного доступу до всього каталогу. Картка не потрібна.


