OpenAI: Embeddings & Retrieval Systems (RAG)
Build production RAG pipelines with OpenAI embeddings, pgvector, hybrid BM25+vector search, and the native File Search API.
View badge details
About This Course
Course Curriculum
10 Lessons
Text Embeddings & Semantic Similarity
Learn what embeddings are and how they represent meaning as vectors. Covers text-embedding-3-small vs text-embedding-3-large, the dimensions parameter for cost optimization, cosine similarity computation, and when semantic search outperforms keyword search.
Semantic Similarity Search Engine - Lab Exercises
Build a semantic search engine over a 20-product catalog. Implement get_embedding() with text-embedding-3-small, cosine_similarity() with numpy, build_product_index() to embed all products, and semantic_search() to return the top-k most similar products for any natural language query.
Vector Storage with pgvector
Learn to set up pgvector in Python with psycopg2, create embeddings tables with vector columns, index vectors with HNSW and IVFFlat, and run nearest-neighbor queries using the cosine distance operator.
Persistent Embedding Store - Lab Exercises
Build a persistent embedding store using pgvector. Set up the database schema with HNSW index, chunk and embed a documentation corpus, store embeddings with psycopg2, and query with the cosine distance operator to retrieve semantically similar chunks.
Hybrid Search & Re-Ranking
Learn why vector search alone misses exact keyword matches, how to combine BM25 with vector search using Reciprocal Rank Fusion, cross-encoder re-ranking, retrieval compression, and how to measure retrieval quality with precision@k, recall@k, and MRR.
Hybrid Search Pipeline - Lab Exercises
Build a hybrid search pipeline combining BM25 keyword search with vector similarity search, fused using Reciprocal Rank Fusion. Implement bm25_search(), vector_search(), reciprocal_rank_fusion(), and the full hybrid_search() pipeline.
OpenAI File Search & Vector Stores API
Learn OpenAI's native Vector Stores API — when to use it vs self-hosted pgvector, how to create vector stores, upload files with automatic chunking, query using the Responses API file_search tool, manage vector store lifecycle, and understand the cost model.
File Search Integration - Lab Exercises
Build a document Q&A assistant using the OpenAI Responses API file_search tool. Create a vector store, upload technical documents, and query them using the built-in file_search tool — no external vector database required.
Capstone Briefing: Enterprise RAG Assistant
Reviews all Course 202 concepts: embeddings, pgvector, hybrid search, re-ranking, and file search. Previews the capstone architecture — a hybrid RAG assistant with source attribution, hallucination detection, and retrieval quality evaluation.
Capstone Project: Enterprise RAG Assistant - Lab Exercises
Build a complete enterprise RAG assistant with hybrid BM25+vector retrieval using RRF, grounded answer generation with source attribution, a hallucination detection guard using a second LLM call, and precision@3 evaluation across test queries.