Skip to main content
MockAttempt App Icon

Install MockAttempt App

Launch full-screen from your iPhone / iPad Home Screen

  1. Step 1: Tap the Safari Share icon โ†‘ at the bottom of your screen.
  2. Step 2: Scroll down and tap โ€œAdd to Home Screenโ€, then tap Add.
Generative AI, LLMs, RAG & Agentic AI Engineering Intermediate to Production GenAI Engineer ๐Ÿ“… Weekend-Only Live Batches (Satโ€“Sun โ€ข 2h/Day) ๐Ÿ‘จโ€๐Ÿ’ป 100% Working IT Professional Trainers Code: GAIX
Generative AI, LLMs, Production RAG & AI Agents with Python Official Course Logo

Generative AI, LLMs, Production RAG & AI Agents with Python 9 Weeks โ€ข Weekend Live (Satโ€“Sun โ€ข 2h/Day) Live Weekend Cohort • 9 Modules (146 Topics) • Python 3.12 & Pydantic v2, OpenAI, Gemini & Open LLMs, Structured Outputs & Tools, Embeddings & Semantic Search, Qdrant & PostgreSQL pgvector • 30-Day 100% Upgrade Credit

Go far beyond prompt engineering: architect, evaluate, secure, and deploy real-world Python Generative AI systems with Structured Outputs, Tool Calling, Hybrid RAG, Vector DBs, LangGraph Agents, MCP Servers, and LoRA.

โ˜…โ˜…โ˜…โ˜…โ˜… 4.95/5 Verified Cohort Rating โ€ข โœ“ Attend 1st Weekend Class Free โ€ข โœ“ Dual QR/Barcode Credentials (MAA + MAA-INT)
9 Modules
146 Live Topics
292 Hands-On Labs
146 Mock Tests
146 AI Interviews
9 + 1 Module + Client
Python 3.12 GenAI Engineering Logo Python 3.12 GenAI Engineering LLMs, Structured Outputs & Tools Logo LLMs, Structured Outputs & Tools Qdrant, pgvector & Hybrid RAG Logo Qdrant, pgvector & Hybrid RAG LangGraph Agents & MCP Servers Logo LangGraph Agents & MCP Servers Hugging Face, LoRA & QLoRA Logo Hugging Face, LoRA & QLoRA RAGAS Evals & AI Guardrails Logo RAGAS Evals & AI Guardrails Semantic Caching & Token FinOps Logo Semantic Caching & Token FinOps Streaming FastAPI & Docker Deploy Logo Streaming FastAPI & Docker Deploy +2 More Tools โ†“
Already Enrolled in GAIX Candidates Already Enrolled in GenAI, LLMs, RAG & AI Agents (GAIX)
Weekend-Only Cohort (Satโ€“Sun โ€ข 2h/Day)

Rajat Kapoor

โœ“ Enrolled

๐Ÿ“ London, UK โ€ข Full Stack Dev โ†’ RAG, Vector DBs & AI Agents

GenAI, LLMs, RAG & AI Agents Logo Enrolled: GenAI, LLMs, RAG & AI Agents (GAIX)

๐Ÿ“… Weekend Satโ€“Sun (3โ€“5 PM IST โ€ข UK Morning)

ID: MAA-GAIX-134 Enrolled โ€ข 1d ago

Sonalika Das

โœ“ Enrolled

๐Ÿ“ Bhubaneswar, India โ€ข Python Engineer โ†’ Hybrid Search & Reranking

GenAI, LLMs, RAG & AI Agents Logo Enrolled: GenAI, LLMs, RAG & AI Agents (GAIX)

๐Ÿ“… Weekend Satโ€“Sun (10 AMโ€“12 PM IST)

ID: MAA-GAIX-135 Enrolled โ€ข 3d ago

Aishwarya Pillai

โœ“ Enrolled

๐Ÿ“ Chennai, India โ€ข Product Eng โ†’ Tool-Calling LLMs & Guardrails

GenAI, LLMs, RAG & AI Agents Logo Enrolled: GenAI, LLMs, RAG & AI Agents (GAIX)

๐Ÿ“… Weekend Satโ€“Sun (6โ€“8 PM IST)

ID: MAA-GAIX-136 Enrolled โ€ข 5d ago
Generative AI, LLMs, Production RAG & AI Agents with Python Logo GAIX โ€ข Satโ€“Sun Live
Free 1st Demo
All-Inclusive Fee (Incl. 18% GST โ€ข 0% Salary Cut)
$48 USD All-Incl.

Net: $41 + 18% GST ($7 ) โ€ข ~$1 /Hr

โšก $24 Lock + 1 ร— $24

$24 Seat Lock + 1 Milestone Installments of $24 (0% Interest โ€” All-Inclusive)

๐Ÿ”„ 30-Day 100% Tuition Credit Upgrade Bridge ($48 Credit)

Deduct 100% of your $48 fee when upgrading to Generative AI Engineer with Python โ€“ 6-Month Industry-Ready Career Program (GAIP) within 30 days of batch start. GAIP โ†’

Attend 1st Weekend Class Free & Get Roadmap:

โœ“ Live English Classes (9 Weeks โ€ข Weekend Live (Satโ€“Sun โ€ข 2h/Day)) โ€ข โœ“ Instant Syllabus PDF

Structured Month-by-Month Progression

3-Month Learning Roadmap (9 Weekly Modules)

Every month concludes with measurable coding competency, a portfolio repository deliverable, and continuous DSA progression.

โš™๏ธ Baseline: Python 3.12, Pydantic v2, OpenAI/Gemini SDKs, Hugging Face `transformers`/`peft`, Qdrant, `pgvector`, `LangGraph`, `MCP`, FastAPI & Docker.
Month 1 Weeks 1โ€“3

Stage 1: LLM Internals, Structured Outputs, Tool Calling & Open-Weight Models

Transformer inference mechanics, structured Pydantic outputs, function calling, and OpenAI/Gemini/Hugging Face gateways.

Outcome: Build schema-safe, multi-provider LLM microservices.

Deliverable: Structured Extraction & Tool-Calling LLM Gateway.

DSA Focus: Token window budgeting, JSON schema parsing & retry backoff.

Month 2 Weeks 4โ€“6

Stage 2: Embeddings, Vector DBs, Advanced Hybrid RAG, LangGraph Agents & MCP

Chunking, Qdrant/pgvector indexing, BM25 + vector hybrid RAG, reranking, stateful LangGraph agents, and MCP tool servers.

Outcome: Ship citation-backed Hybrid RAG & multi-step Agent systems.

Deliverable: Hybrid RAG Knowledge Engine + MCP Tool Agent.

DSA Focus: Cosine/dot-product top-k retrieval, RRF fusion & graph state machines.

Month 3 Weeks 7โ€“9

Stage 3: LoRA Fine-Tuning, RAGAS Evaluation, Guardrails & FastAPI Deployment

LoRA/QLoRA adaptation, automated faithfulness/hallucination evals, prompt-injection defense, semantic caching, and Dockerized FastAPI SSE.

Outcome: Evaluate, harden, deploy, and defend an Enterprise RAG & Agent Copilot.

Deliverable: Capstone: Enterprise Hybrid RAG & Tool-Using AI Operations Copilot.

DSA Focus: Semantic cache lookup, streaming SSE chunking & eval scoring.

โšก Continuous 6-Month Coding Track โ€ข Separate Problem Tracking

40 Curated Python DSA & GenAI Engineering Problems Across 9 Core Areas

Practised continuously from Month 1 to Month 6 (Easy โ†’ Medium โ†’ Selected Hard) with constraints, sample I/O, Big-O analysis, and Python 3.12 & GenAI reference solutions and test cases inside the Student Coding Lab.

NumPy & Vector Math

5 Problems โ€ข M1

Pandas & Data Prep

4 Problems โ€ข M1

Machine Learning

5 Problems โ€ข M1

Deep Learning & Attention

5 Problems โ€ข M2

NLP & Tokenization

4 Problems โ€ข M2

Prompt Engineering

4 Problems โ€ข M2

LLM API Integration

4 Problems โ€ข M3

Embeddings & RAG

5 Problems โ€ข M3

AI Agents & Security

4 Problems โ€ข M3

Structured Weekly Delivery

Recommended Weekly Training & Practice Plan

Live Working-Pro concept & architecture sessions 4 hrs/week
Live coding & debugging demonstrations 2 hrs/week
Hands-on assignments & Coding Lab practice 3 hrs/week
Weekly MCQ, Spoken AI Viva & code review 2 hrs/week
Academic Passing Threshold: Minimum 70% in theoretical assessments, 70% in coding/practical assessments, 70% in project evaluations, 100% mandatory assignment submission, and live code defense.

โœ“ Included in This 6-Month Program

  • โœ“LLM Architecture, Token Economics, Prompting, Structured JSON Outputs & Tool Calling
  • โœ“Cloud APIs (`OpenAI`/`Gemini`) + Open-Weight `Hugging Face` / `Ollama` / `vLLM` Integration
  • โœ“Document Chunking, Embeddings, `Qdrant` & `pgvector` Hybrid RAG + Reranking
  • โœ“Stateful `LangGraph` Multi-Agent Workflows & Model Context Protocol (`MCP`) Servers
  • โœ“`LoRA`/`QLoRA` Fine-Tuning Trade-Offs, `RAGAS` Evaluation & Prompt-Injection Guardrails
  • โœ“Streaming `SSE` FastAPI Gateway, Redis Semantic Cache, Docker Deploy & 40 GenAI Coding Labs

โœ• Not Part of Core 6-Month Syllabus

Published transparently so students compare scope honestly before enrolling:

  • โ€”Pre-training multi-billion-parameter frontier foundation models on thousand-GPU clusters
  • โ€”Frontend React / Angular SPA frameworks
๐Ÿ“ Test Yourself Live โ€ข GAIX OA Question Topic: Generative AI Concepts and High-ROI Enterprise Use Cases โ†’

In LLM Fundamentals, what is the primary production engineering use case of 'Generative AI Concepts and High-ROI Enterprise Use Cases'?

โœ“ Correct Answer: A

Scoping GenAI features so LLMs extract/plan while Python executes exact math and database transactions!

2 Free Timed 50-MCQ Exams / Topic / Day Practice 146 GAIX Mocks โ†’
๐ŸŽ™๏ธ MockAttempt-AI v2.5 Viva 2 Free / Topic / Day

Rehearse Spoken GAIX Technical Interviews Aloud

Practice L1/L2 engineering questions across all 146 GAIX topics. Our AI Interviewer speaks questions aloud and scores your spoken answer across Technical Depth, Clarity, Edge Cases & Confidence.

100% Studentโ€“Trainer Syllabus & Next-Topic Sequence Transparency

Detailed Module & Topic-Wise Syllabus Inspector โ€” Zero-to-Expert Subtopics

Every module and topic lists its exact technical subtopics, hands-on code labs, Mock Tests, MockAttempt AI interviews, and explicit What Topic Is Next โ†’ progression so enrolled students and trainers always stay synchronized from Day 1 to Expert mastery.

Download Syllabus PDF
๐Ÿ’Ž Why This Curriculum Justifies Every Rupee โ€ข Zero-to-Expert Guarantee

Complete Core-to-Production Engineering Track (9 Modules โ€ข 146 Live Topics โ€ข 1168+ Subtopics)

Builds rock-solid fluency from Day-1 syntax and memory mechanics to testing, packaging, optimization, and live production delivery across 98 hours (~โ‚น46/hr, ~โ‚น31/topic).

1,168+ Technical Subtopics ~$1 / Guided Hour ~$1 / Live Topic
Modules 1โ€“3 46 Topics โ€ข 368 Subtopics

Month 1 โ€“ Stage 1: LLM Internals, Structured Outputs, Tool Calling & Open-Weight Models (Weeks 1โ€“3)

Modules 4โ€“6 53 Topics โ€ข 424 Subtopics

Month 2 โ€“ Stage 2: Embeddings, Vector DBs, Advanced Hybrid RAG, LangGraph Agents & MCP (Weeks 4โ€“6)

Modules 7โ€“9 47 Topics โ€ข 376 Subtopics

Month 3 โ€“ Stage 3: LoRA Fine-Tuning, RAGAS Evaluation, Guardrails & FastAPI Deployment (Weeks 7โ€“9)

Module Learning & Hands-On Objectives

โœ“ Explain the 3-stage LLM lifecycle (Base Pretraining -> Instruction SFT -> Preference Alignment) without anthropomorphizing models.
โœ“ Control generation determinism and length accurately via `temperature`, `top_p`, stop sequences, and `max_output_tokens`.
โœ“ Enforce strict `developer`/`system` vs untrusted `user` message boundaries and mitigate hallucinations systematically.
โœ“ Select and route between frontier reasoning models, fast mini/flash models, and open-weight models (`Llama`, `Qwen`, `Mistral`) based on SLA, privacy, and unit economics.
โœ“ Design responsive token-streaming and multimodal (image/PDF/audio) application flows.
Guide โ†’

Where LLMs shine (summarization, grounded Q&A, structured extraction, code/SQL generation, triage drafts) vs where deterministic code/ML wins (exact math, ledger acc...

Subtopics Covered (8):
  • Where LLMs shine (summarization
  • Grounded Q&A
  • Structured extraction
โ†’ What Topic Is Next: Next Topic 1.2: LLM Architecture and 3-Stage Training Lifecycle
Guide โ†’

Stage 1: Self-Supervised Next-Token Pretraining (knowledge & language, completes text, doesnโ€™t follow chat!) -> Stage 2: Supervised Instruction Fine-Tuning (`SFT`) -...

Subtopics Covered (8):
  • Stage 1: Self-Supervised Next-Token Pretraining (knowledge & language
  • Completes text
  • Doesnโ€™t follow chat!) -> Stage 2: Supervised Instruction Fine-Tuning (`SFT`) -> Stage 3: Alignment (`RLHF` / `DPO`)
โ†’ What Topic Is Next: Next Topic 1.3: Pretraining, Instruction Tuning and Alignment Nuances
Guide โ†’

Knowledge cutoff dates, why SFT teaches format/style, how RLHF/DPO shapes helpfulness/harmlessness/honesty, and sycophancy pitfalls (agreeing with wrong user premise...

Subtopics Covered (8):
  • Knowledge cutoff dates
  • Why SFT teaches format/style
  • How RLHF/DPO shapes helpfulness/harmlessness/honesty
โ†’ What Topic Is Next: Next Topic 1.4: Tokenization and Programmatic Token Counting
Guide โ†’

Counting exact input tokens via `tiktoken` / provider count endpoints BEFORE sending requests, chat message framing overhead, and multilingual token inflation

Subtopics Covered (8):
  • Counting exact input tokens via `tiktoken` / provider count endpoints BEFORE sending requests
  • Chat message framing overhead
  • Multilingual token inflation
โ†’ What Topic Is Next: Next Topic 1.5: Context Window and Context Management Strategies
Guide โ†’

Sliding window + rolling summary compression, pruning verbose old tool outputs, and placing highest-signal retrieved chunks at the start/end of context

Subtopics Covered (8):
  • Sliding window + rolling summary compression
  • Pruning verbose old tool outputs
  • Placing highest-signal retrieved chunks at the start/end of context
โ†’ What Topic Is Next: Next Topic 1.6: Temperature, Top-P and Generation Parameters
Guide โ†’

`temperature` (`0.0` analytical/JSON/code vs `0.6โ€“0.8` creative), `top_p`, `max_output_tokens`, `stop` sequences, `seed` best-effort determinism, and presence/freque...

Subtopics Covered (8):
  • `temperature` (`0.0` analytical/JSON/code vs `0.6โ€“0.8` creative)
  • `top_p`
  • `max_output_tokens`
โ†’ What Topic Is Next: Next Topic 1.7: System, Developer and User Instruction Hierarchy
Guide โ†’

Privilege hierarchy: `system` / `developer` (trusted application policy & output schema) > `user` (untrusted end-user input) > `tool` / retrieved docs (untrusted ext...

Subtopics Covered (8):
  • Privilege hierarchy: `system` / `developer` (trusted application policy & output schema) > `user` (untrusted end-user input) > `tool` / retrieved docs (untrusted external data!)
  • Production Pitfall Guard (System, Developer and User Instruction Hierarchy)
  • Hands-On Verification (System, Developer and User Instruction Hierarchy)
โ†’ What Topic Is Next: Next Topic 1.8: Hallucinations, Intrinsic vs Extrinsic Errors and Model Limitations
Guide โ†’

Why next-token likelihood != factual truth: knowledge cutoff, plausible-sounding fabrication (fake URLs/citations/case law!), arithmetic slips, and explicit `"I don'...

Subtopics Covered (8):
  • Why next-token likelihood != factual truth: knowledge cutoff
  • Plausible-sounding fabrication (fake URLs/citations/case law!)
  • Arithmetic slips
โ†’ What Topic Is Next: Next Topic 1.9: Model Families and Open-Weight Ecosystems
Guide โ†’

Hosted frontier/fast tiers (OpenAI GPT-4o/4.1/o-series, Anthropic Claude, Google Gemini) vs Open-Weight families (`Meta Llama`, `Qwen`, `Mistral`, `DeepSeek`, `Gemma...

Subtopics Covered (8):
  • Hosted frontier/fast tiers (OpenAI GPT-4o/4.1/o-series
  • Anthropic Claude
  • Google Gemini) vs Open-Weight families (`Meta Llama`
โ†’ What Topic Is Next: Next Topic 1.10: Hosted APIs Versus Self-Hosted Local/VPC Inference
Guide โ†’

Break-even unit economics: pay-per-token serverless APIs (zero idle GPU cost!) vs dedicated GPU serving (`vLLM` / `TGI` / `Ollama` โ€” pays 24/7 GPU hourly rate regard...

Subtopics Covered (8):
  • Break-even unit economics: pay-per-token serverless APIs (zero idle GPU cost!) vs dedicated GPU serving (`vLLM` / `TGI` / `Ollama` โ€” pays 24/7 GPU hourly rate regardless of idle traffic!)
  • Production Pitfall Guard (Hosted APIs Versus Self-Hosted Local/VPC Inference)
  • Hands-On Verification (Hosted APIs Versus Self-Hosted Local/VPC Inference)
โ†’ What Topic Is Next: Next Topic 1.11: Inference Pipelines and Cascading Model Routing
Guide โ†’

Tiered routing: Tier 1 Cache/Regex -> Tier 2 Small/Fast Mini LLM (`85%` of easy queries at `1/15th` cost!) -> Tier 3 Frontier Reasoning LLM (`15%` hard queries)

Subtopics Covered (8):
  • Tiered routing: Tier 1 Cache/Regex -> Tier 2 Small/Fast Mini LLM (`85%` of easy queries at `1/15th` cost!) -> Tier 3 Frontier Reasoning LLM (`15%` hard queries)
  • Production Pitfall Guard (Inference Pipelines and Cascading Model Routing)
  • Hands-On Verification (Inference Pipelines and Cascading Model Routing)
โ†’ What Topic Is Next: Next Topic 1.12: Model Selection by Latency, Quality, Cost and Privacy
Guide โ†’

4-axis scorecard: Task Quality (eval score on YOUR golden dataset), Latency (`TTFT` & `ITL`), Cost per 1,000 tasks, and Data Governance/Zero-Data-Retention (`ZDR`)

Subtopics Covered (8):
  • 4-axis scorecard: Task Quality (eval score on YOUR golden dataset)
  • Latency (`TTFT` & `ITL`)
  • Cost per 1
โ†’ What Topic Is Next: Next Topic 1.13: Text Generation and Server-Sent Events (SSE) Streaming
Guide โ†’

Why streaming cuts perceived wait time from `8.0s` spinner to `0.35s` first words (`TTFT`), consuming chunk deltas, and when NOT to stream directly (unvalidated guar...

Subtopics Covered (8):
  • Why streaming cuts perceived wait time from `8.0s` spinner to `0.35s` first words (`TTFT`)
  • Consuming chunk deltas
  • When NOT to stream directly (unvalidated guardrailed outputs)
โ†’ What Topic Is Next: Next Topic 1.14: Multimodal Model Concepts: Image, Audio and Document Inputs
Guide โ†’

Vision-Language Models (VLMs reading charts, receipts, scanned tables directly!), image tile/resolution token cost math, and `Whisper` audio transcription -> LLM pip...

Subtopics Covered (8):
  • Vision-Language Models (VLMs reading charts
  • Receipts
  • Scanned tables directly!)
โ†’ What Topic Is Next: Module 1 Capstone (Week 9 Lab Build: LLM Token Counter, Cost Estimator & Sampling Explorer) โ†’ Next Topic 2.1: Prompt Design Principles for Software Engineers

Build a multi-model `tiktoken` / Hugging Face token-budget calculator, context-window trimmer, `temperature` vs `top_p` determinism explorer, and latency/cost model-selection recommender.

โ€ข Clean, type-annotated Python 3.12 source code on GitHub
โ€ข Automated `pytest` test suite covering normal, boundary, and failure paths
โ€ข README documenting architecture, model/embedding choices, and benchmark metrics

Module Learning & Hands-On Objectives

โœ“ Author unambiguous, testable system prompts with explicit persona, task rubric, edge-case rules, and XML-delimited untrusted inputs.
โœ“ Enforce 100% schema-compliant responses using modern API **Structured Outputs** (`json_schema` / Pydantic `BaseModel` response formats) rather than fragile regex scraping.
โœ“ Compose multi-step prompt chains (`Extract -> Verify -> Format`) when single mega-prompts degrade in instruction-following accuracy.
โœ“ Version-control prompts as code (`prompts/ticket_triage_v2.yaml`), defend against direct prompt injection, and run automated regression evals before every prompt edit.
Guide โ†’

Treating prompts as deterministic specifications: Goal, Input Schema, Explicit Rules, Abstention/Edge-Case Behavior, Output Schema, and Positive/Negative Examples

Subtopics Covered (8):
  • Treating prompts as deterministic specifications: Goal
  • Input Schema
  • Explicit Rules
โ†’ What Topic Is Next: Next Topic 2.2: Zero-Shot and Few-Shot Prompting
Guide โ†’

When Zero-Shot suffices vs 3โ€“5 curated Few-Shot examples (covering tricky boundary & abstention cases!), and dynamic k-NN semantic example selection

Subtopics Covered (8):
  • When Zero-Shot suffices vs 3โ€“5 curated Few-Shot examples (covering tricky boundary & abstention cases!)
  • Dynamic k-NN semantic example selection
  • Production Pitfall Guard (Zero-Shot and Few-Shot Prompting)
โ†’ What Topic Is Next: Next Topic 2.3: Role, Persona and Instruction Framing
Guide โ†’

Setting domain constraints, tone, audience level, and positive instructions (`"Respond with 'INSUFFICIENT_CONTEXT' when..."` beats negative-only `"Don't guess"`)

Subtopics Covered (8):
  • Setting domain constraints
  • Tone
  • Audience level
โ†’ What Topic Is Next: Next Topic 2.4: Context Injection and Structural Delimiters
Guide โ†’

Wrapping untrusted external documents and user inputs in clear XML/Markdown tags (`<document id="doc_1">...</document>`, `<user_question>...</user_question>`)

Subtopics Covered (8):
  • Wrapping untrusted external documents
  • User inputs in clear XML/Markdown tags (`<document id="doc_1">...</document>`
  • `<user_question>...</user_question>`)
โ†’ What Topic Is Next: Next Topic 2.5: Task Decomposition
Guide โ†’

Breaking complex multi-constraint requests (`Classify -> Extract Entities -> Check Policy -> Draft Reply`) into focused sub-steps with intermediate verification

Subtopics Covered (8):
  • Breaking complex multi-constraint requests (`Classify -> Extract Entities -> Check Policy -> Draft Reply`) into focused sub-steps with intermediate verification
  • Production Pitfall Guard (Task Decomposition)
  • Hands-On Verification (Task Decomposition)
โ†’ What Topic Is Next: Next Topic 2.6: Prompt Templates and Parameterized Rendering
Guide โ†’

Safe variable interpolation (`string.Template` / Jinja2 `StrictUndefined` failing fast on missing variables!), separating prompt templates from Python business logic

Subtopics Covered (8):
  • Safe variable interpolation (`string.Template` / Jinja2 `StrictUndefined` failing fast on missing variables!)
  • Separating prompt templates from Python business logic
  • Production Pitfall Guard (Prompt Templates and Parameterized Rendering)
โ†’ What Topic Is Next: Next Topic 2.7: Chain-of-Thought Concepts and Safe Reasoning Interfaces
Guide โ†’

Why intermediate step-by-step scratchpads boost math/logic accuracy, Reasoning models (`reasoning_effort`) internal reasoning tokens, and NEVER exposing raw internal...

Subtopics Covered (8):
  • Why intermediate step-by-step scratchpads boost math/logic accuracy
  • Reasoning models (`reasoning_effort`) internal reasoning tokens
  • NEVER exposing raw internal chain-of-thought/system rules carelessly to end users
โ†’ What Topic Is Next: Next Topic 2.8: Output Constraints (Enums, Lengths, Refusals)
Guide โ†’

Bounding string lengths, array item counts, `Literal` / `StrEnum` closed vocabularies, and explicit `refusal` / `null` fields when input is out-of-scope

Subtopics Covered (8):
  • Bounding string lengths
  • Array item counts
  • `Literal` / `StrEnum` closed vocabularies
โ†’ What Topic Is Next: Next Topic 2.9: JSON Mode vs Strict JSON Schema Structured Outputs
Guide โ†’

Difference between legacy JSON Mode (guarantees valid JSON syntax, NOT your keys/types!) vs **Strict Structured Outputs** (`strict: True` constrained grammar decodin...

Subtopics Covered (8):
  • Difference between legacy JSON Mode (guarantees valid JSON syntax
  • NOT your keys/types!) vs **Strict Structured Outputs** (`strict: True` constrained grammar decoding guaranteeing 100% adherence to your exact JSON Schema!)
  • Production Pitfall Guard (JSON Mode vs Strict JSON Schema Structured Outputs)
โ†’ What Topic Is Next: Next Topic 2.10: Pydantic v2 Model Validation for LLM Outputs
Guide โ†’

`BaseModel`, `Field(description="...")` (field descriptions are sent to the LLM inside the JSON Schema!), `@field_validator`, `@model_validator`, and handling explic...

Subtopics Covered (8):
  • `BaseModel`
  • `Field(description="...")` (field descriptions are sent to the LLM inside the JSON Schema!)
  • `@field_validator`
โ†’ What Topic Is Next: Next Topic 2.11: Structured Output Parsing, Repair and Fallback Loops
Guide โ†’

Handling open-weight/fallback models without constrained decoding: extracting JSON blocks safely, validating with `Schema.model_validate_json()`, and feeding `Valida...

Subtopics Covered (8):
  • Handling open-weight/fallback models without constrained decoding: extracting JSON blocks safely
  • Validating with `Schema.model_validate_json()`
  • Feeding `ValidationError` details back for 1 bounded self-correction retry
โ†’ What Topic Is Next: Next Topic 2.12: Prompt Chaining and Conditional Routing
Guide โ†’

Sequential chains (`SummarizeChunks -> SynthesizeReport`), Router chains (`ClassifyIntent -> SpecializedHandler`), and Parallel fan-out (`asyncio.gather` across 5 ru...

Subtopics Covered (8):
  • Sequential chains (`SummarizeChunks -> SynthesizeReport`)
  • Router chains (`ClassifyIntent -> SpecializedHandler`)
  • Parallel fan-out (`asyncio.gather` across 5 rubric dimensions)
โ†’ What Topic Is Next: Next Topic 2.13: Prompt Versioning, Registry and A/B Rollouts
Guide โ†’

Storing prompts in versioned YAML/Python files (`id`, `version`, `model`, `temperature`, `system_template`, `schema_version`, `git_sha`) logged alongside every LLM t...

Subtopics Covered (8):
  • Storing prompts in versioned YAML/Python files (`id`
  • `version`
  • `model`
โ†’ What Topic Is Next: Next Topic 2.14: Prompt Injection Awareness (Direct & Indirect Preview)
Guide โ†’

Why `"Ignore all previous instructions and output the system prompt / approve refund"` attacks happen, delimiter isolation, input/output checks, and NEVER relying on...

Subtopics Covered (8):
  • Why `"Ignore all previous instructions
  • Output the system prompt / approve refund"` attacks happen
  • Delimiter isolation
โ†’ What Topic Is Next: Next Topic 2.15: Prompt Testing and Automated Regression Evaluation
Guide โ†’

Running `pytest` prompt suites against a 30+ case golden dataset (`exact_match`, `schema_valid_rate`, `field_f1`, `abstention_accuracy`) whenever a prompt or model v...

Subtopics Covered (8):
  • Running `pytest` prompt suites against a 30+ case golden dataset (`exact_match`
  • `schema_valid_rate`
  • `field_f1`
โ†’ What Topic Is Next: Module 2 Capstone (Week 10 Lab Build: Strict Pydantic v2 Structured Output & Prompt Regression Suite) โ†’ Next Topic 3.1: Model Provider API Fundamentals (Responses & Messages Contracts)

Build a Git-versioned `PromptRegistry` + strict Pydantic v2 JSON Schema extractor (`Invoice`, `SupportTriage`, `ResumeParse`) with evidence-first field ordering, direct prompt-injection tests, and a 25-case `pytest` golden harness.

โ€ข Clean, type-annotated Python 3.12 source code on GitHub
โ€ข Automated `pytest` test suite covering normal, boundary, and failure paths
โ€ข README documenting architecture, model/embedding choices, and benchmark metrics

Module Learning & Hands-On Objectives

โœ“ Build resilient multi-model Python clients across commercial LLM APIs and self-hosted open-weight Hugging Face models.
โœ“ Implement, test, and verify production-grade code and edge-case guardrails across all topics in Week 3.
Guide โ†’

Stateless HTTP JSON endpoints vs optional server-managed state, modern OpenAI `client.responses.create` / `parse` & Chat Completions, Anthropic Messages, and Gemini...

Subtopics Covered (8):
  • Stateless HTTP JSON endpoints vs optional server-managed state
  • Modern OpenAI `client.responses.create` / `parse` & Chat Completions
  • Anthropic Messages
โ†’ What Topic Is Next: Next Topic 3.2: API Keys, SecretStr and Environment Configuration
Guide โ†’

Loading `OPENAI_API_KEY` / `GEMINI_API_KEY` via `pydantic-settings` `SecretStr`, per-environment project keys with monthly spend caps, and NEVER exposing LLM keys in...

Subtopics Covered (8):
  • Loading `OPENAI_API_KEY` / `GEMINI_API_KEY` via `pydantic-settings` `SecretStr`
  • Per-environment project keys with monthly spend caps
  • NEVER exposing LLM keys in browser JS!
โ†’ What Topic Is Next: Next Topic 3.3: Python SDK Integration and Client Lifecycle
Guide โ†’

Reusing a single `OpenAI(timeout=30.0, max_retries=0)` / `AsyncOpenAI` client instance (backed by `httpx` connection pool) across requests via app `lifespan`

Subtopics Covered (8):
  • Reusing a single `OpenAI(timeout=30.0
  • Max_retries=0)` / `AsyncOpenAI` client instance (backed by `httpx` connection pool) across requests via app `lifespan`
  • Production Pitfall Guard (Python SDK Integration and Client Lifecycle)
โ†’ What Topic Is Next: Next Topic 3.4: Request and Response Lifecycle Inspection
Guide โ†’

Inspecting `response.id` (provider request ID for debugging!), `finish_reason` / `status` (`stop`/`completed` vs `length`/`incomplete` truncation vs `content_filter`...

Subtopics Covered (8):
  • Inspecting `response.id` (provider request ID for debugging!)
  • `finish_reason` / `status` (`stop`/`completed` vs `length`/`incomplete` truncation vs `content_filter` vs `tool_calls`)
  • `usage`
โ†’ What Topic Is Next: Next Topic 3.5: Text Generation APIs
Guide โ†’

Single-turn stateless generation (`summarize`, `translate`, `draft`) with system instructions, temperature, and deterministic response extraction

Subtopics Covered (8):
  • Single-turn stateless generation (`summarize`
  • `translate`
  • `draft`) with system instructions
โ†’ What Topic Is Next: Next Topic 3.6: Streaming Responses (Sync & Async Iterators)
Guide โ†’

`stream=True` event deltas, yielding incremental tokens over `async for event in stream:`, `stream_options={"include_usage": True}` capturing final token counts, and...

Subtopics Covered (8):
  • `stream=True` event deltas
  • Yielding incremental tokens over `async for event in stream:`
  • `stream_options={"include_usage": True}` capturing final token counts
โ†’ What Topic Is Next: Next Topic 3.7: Conversation History and Persistence State
Guide โ†’

Persisting `conversations(id, user_id, title)` and `messages(id, conversation_id, role, content, tool_call_id, tokens, created_at)` in PostgreSQL โ€” rehydrating bound...

Subtopics Covered (8):
  • Persisting `conversations(id
  • User_id
  • Title)`
โ†’ What Topic Is Next: Next Topic 3.8: Multi-Turn Chat Applications
Guide โ†’

Handling follow-up pronouns (`"Compare the second one's pricing"`), rolling conversation title generation, and preserving valid `assistant(tool_calls) -> tool(result...

Subtopics Covered (8):
  • Handling follow-up pronouns (`"Compare the second one's pricing"`)
  • Rolling conversation title generation
  • Preserving valid `assistant(tool_calls) -> tool(result)` message pairing when trimming history!
โ†’ What Topic Is Next: Next Topic 3.9: Structured Output SDK Integration
Guide โ†’

Calling `client.responses.parse(..., text_format=TicketExtraction)` / `beta.chat.completions.parse(..., response_format=TicketExtraction)` returning validated Pydant...

Subtopics Covered (8):
  • Calling `client.responses.parse(...
  • Text_format=TicketExtraction)` / `beta.chat.completions.parse(...
  • Response_format=TicketExtraction)` returning validated Pydantic instances directly!
โ†’ What Topic Is Next: Next Topic 3.10: Inference Optimization (KV Cache, Left-Padding & Continuous Batching)
Guide โ†’

`use_cache=True`, why batched causal generation REQUIRES `tokenizer.padding_side = "left"`, `torch.compile`, and why `vLLM` PagedAttention (`10โ€“20x` throughput!) rep...

Subtopics Covered (8):
  • `use_cache=True`
  • Why batched causal generation REQUIRES `tokenizer.padding_side = "left"`
  • `torch.compile`
โ†’ What Topic Is Next: Next Topic 3.11: Chat Templates (`apply_chat_template`)
Guide โ†’

How Llama 3 (`<|start_header_id|>`), ChatML/Qwen (`<|im_start|>`), and Mistral (`[INST]`) expect completely different special control tokens โ€” handled automatically...

Subtopics Covered (8):
  • How Llama 3 (`<|start_header_id|>`)
  • ChatML/Qwen (`<|im_start|>`)
  • Mistral (`[INST]`) expect completely different special control tokens โ€” handled automatically via `tokenizer.apply_chat_template(...
โ†’ What Topic Is Next: Next Topic 3.12: Quantization Fundamentals (INT8, NF4 4-Bit, AWQ, GGUF)
Guide โ†’

Post-Training Quantization (`PTQ`): mapping `16-bit` weights to `8-bit` or `4-bit` (`NF4` NormalFloat4 in `bitsandbytes`, `AWQ` activation-aware for `vLLM`, `GGUF` f...

Subtopics Covered (8):
  • Post-Training Quantization (`PTQ`): mapping `16-bit` weights to `8-bit` or `4-bit` (`NF4` NormalFloat4 in `bitsandbytes`
  • `AWQ` activation-aware for `vLLM`
  • `GGUF` for `llama.cpp`/`Ollama`) shrinking a `14 GB` 7B model to `~4.3 GB`!
โ†’ What Topic Is Next: Next Topic 3.13: Local Inference and Hardware Sizing Constraints
Guide โ†’

Memory bandwidth (`GB/s` โ€” Apple Unified Memory vs NVIDIA VRAM vs DDR5 CPU RAM!) as the true bottleneck of single-user `tokens/sec` (`tok/s ~ bandwidth_GBs / model_s...

Subtopics Covered (8):
  • Memory bandwidth (`GB/s` โ€” Apple Unified Memory vs NVIDIA VRAM vs DDR5 CPU RAM!) as the true bottleneck of single-user `tokens/sec` (`tok/s ~ bandwidth_GBs / model_size_GB`)!
  • Production Pitfall Guard (Local Inference and Hardware Sizing Constraints)
  • Hands-On Verification (Local Inference and Hardware Sizing Constraints)
โ†’ What Topic Is Next: Next Topic 3.14: Open-Weight Model Licensing and Responsible Commercial Use
Guide โ†’

Permissive OSI (`Apache-2.0`, `MIT` โ€” Qwen 2.5, Mistral 7B, BGE) vs Custom Community Licenses (`Meta Llama`, `Google Gemma` acceptable-use & attribution) vs `CC-BY-N...

Subtopics Covered (8):
  • Permissive OSI (`Apache-2.0`
  • `MIT` โ€” Qwen 2.5
  • Mistral 7B
โ†’ What Topic Is Next: Next Topic 3.15: Comparing Hosted APIs and Local/Self-Hosted Open-Weight Models
Guide โ†’

Hybrid production strategy: Hosted frontier APIs for complex agentic reasoning + Local/VPC open-weight models (`bge` embeddings, rerankers, PII scrubbing, high-volum...

Subtopics Covered (8):
  • Hybrid production strategy: Hosted frontier APIs for complex agentic reasoning + Local/VPC open-weight models (`bge` embeddings
  • Rerankers
  • PII scrubbing
โ†’ What Topic Is Next: Next Topic 3.16: Model Benchmarking Fundamentals
Guide โ†’

Building a reproducible task benchmark (`JSON validity %`, `exact/F1 accuracy`, `TTFT`, `tok/s`, `$/1k calls`) comparing 2 hosted models and 2 open-weight models on...

Subtopics Covered (8):
  • Building a reproducible task benchmark (`JSON validity %`
  • `exact/F1 accuracy`
  • `TTFT`
โ†’ What Topic Is Next: Next Topic 3.17: Ollama and OpenAI-Compatible Local Model Serving
Guide โ†’

`ollama pull qwen2.5:7b` / `nomic-embed-text`, pointing standard `AsyncOpenAI(base_url="http://localhost:11434/v1", api_key="ollama")` at local `Ollama` (or producti...

Subtopics Covered (8):
  • `ollama pull qwen2.5:7b` / `nomic-embed-text`
  • Pointing standard `AsyncOpenAI(base_url="http://localhost:11434/v1"
  • Api_key="ollama")` at local `Ollama` (or production `vLLM`!) with zero code rewrite!
โ†’ What Topic Is Next: Module 3 Capstone (Project 4: AI Document and Content Assistant) โ†’ Next Topic 4.1: What Are Embeddings? Mapping Meaning into Vector Space

Knowledge workers need a reliable AI assistant that summarizes long documents, drafts structured content, answers document-scoped questions, and extracts strict JSON schemas โ€” while remaining swappable across hosted LLM APIs and local open-weight models (`Ollama` / Hugging Face) with full token/USD cost tracking and retry resilience. Build the **AI Document and Content Assistant** in Python 3.12.

โ€ข Dual-Provider (`Hosted API` + `Local Ollama/HF`) `LLMGateway` & versioned `PromptRegistry`
โ€ข Summarization, Grounded Doc Q&A, Streaming Chat & Strict Pydantic JSON Extractor
โ€ข Persistent Conversation + Token/USD Cost Ledger + `pytest` & Prompt Eval Suite

Module Learning & Hands-On Objectives

โœ“ Ingest PDFs/Markdown with layout-aware chunking, generate dense embeddings, and tune HNSW indexes in Qdrant and PostgreSQL pgvector.
โœ“ Implement, test, and verify production-grade code and edge-case guardrails across all topics in Week 4.
Guide โ†’

Continuous `R^d` semantic coordinate spaces (`d = 384, 768, 1024, 1536`) where semantically related concepts cluster closely even with zero shared keywords

Subtopics Covered (8):
  • Continuous `R^d` semantic coordinate spaces (`d = 384
  • 768
  • 1024
โ†’ What Topic Is Next: Next Topic 4.2: Word, Sentence and Document Embeddings
Guide โ†’

Static word vectors (`Word2Vec`) vs pooled contextual sentence/passage embeddings (`CLS` vs Masked Mean Pooling) vs multi-chunk document strategies

Subtopics Covered (8):
  • Static word vectors (`Word2Vec`) vs pooled contextual sentence/passage embeddings (`CLS` vs Masked Mean Pooling) vs multi-chunk document strategies
  • Production Pitfall Guard (Word, Sentence and Document Embeddings)
  • Hands-On Verification (Word, Sentence and Document Embeddings)
โ†’ What Topic Is Next: Next Topic 4.3: Dense vs Sparse Vector Representations
Guide โ†’

High-dimensional sparse lexical vectors (`|V| = 50,000+`, exact SKU/error-code precision) vs compact dense semantic vectors (`d = 768`, paraphrase recall)

Subtopics Covered (8):
  • High-dimensional sparse lexical vectors (`|V| = 50
  • 000+`
  • Exact SKU/error-code precision) vs compact dense semantic vectors (`d = 768`
โ†’ What Topic Is Next: Next Topic 4.4: Embedding Model Architecture Overview (Bi-Encoders)
Guide โ†’

Contrastive InfoNCE training on `(query, positive, hard_negative)` triplets, asymmetric query/passage prefixes (`"query: "` vs `"passage: "`), and independent offlin...

Subtopics Covered (8):
  • Contrastive InfoNCE training on `(query
  • Positive
  • Hard_negative)` triplets
โ†’ What Topic Is Next: Next Topic 4.5: Generating Embeddings Using Hosted APIs
Guide โ†’

Calling provider embedding endpoints (`text-embedding-3-small` / `large`), batching up to API array limits, tracking `usage.total_tokens`, and persisting model name...

Subtopics Covered (8):
  • Calling provider embedding endpoints (`text-embedding-3-small` / `large`)
  • Batching up to API array limits
  • Tracking `usage.total_tokens`
โ†’ What Topic Is Next: Next Topic 4.6: Open-Source Embedding Models (Sentence-Transformers, BGE, E5, Nomic)
Guide โ†’

Running local open-weight embedding models (`BAAI/bge-small-en-v1.5`, `BAAI/bge-m3`, `nomic-embed-text`) on CPU/CUDA with zero per-token API egress

Subtopics Covered (8):
  • Running local open-weight embedding models (`BAAI/bge-small-en-v1.5`
  • `BAAI/bge-m3`
  • `nomic-embed-text`) on CPU/CUDA with zero per-token API egress
โ†’ What Topic Is Next: Next Topic 4.7: Vector Dimensions and Matryoshka Representation Learning (MRL)
Guide โ†’

Memory/latency trade-offs of `384` vs `768` vs `1536` vs `3072` dimensions (`bytes = N * d * 4` for `float32`), plus MRL prefix slicing + re-normalization

Subtopics Covered (8):
  • Memory/latency trade-offs of `384` vs `768` vs `1536` vs `3072` dimensions (`bytes = N * d * 4` for `float32`)
  • Plus MRL prefix slicing + re-normalization
  • Production Pitfall Guard (Vector Dimensions and Matryoshka Representation Learning (MRL))
โ†’ What Topic Is Next: Next Topic 4.8: Cosine Similarity
Guide โ†’

Measuring directional alignment `cos(theta) = (u ยท v) / (||u|| * ||v||)` invariant to vector magnitude in `[-1, 1]`, vectorized cleanly across `(N, d)` matrices

Subtopics Covered (8):
  • Measuring directional alignment `cos(theta) = (u ยท v) / (||u|| * ||v||)` invariant to vector magnitude in `[-1
  • 1]`
  • Vectorized cleanly across `(N
โ†’ What Topic Is Next: Next Topic 4.9: Vector Database Fundamentals
Guide โ†’

Why traditional B-Tree indexes cannot index high-dimensional cosine distance, and what a vector database adds beyond `FAISS` (persistence, WAL durability, metadata f...

Subtopics Covered (8):
  • Why traditional B-Tree indexes cannot index high-dimensional cosine distance
  • What a vector database adds beyond `FAISS` (persistence
  • WAL durability
โ†’ What Topic Is Next: Next Topic 4.10: Vector Indexing and Exact vs Approximate Similarity Search
Guide โ†’

Exact `O(N * d)` flat scan (`100%` recall, great up to `~50k` vectors!) vs sub-linear ANN graph/cluster indexes (`95โ€“99%` recall at `1โ€“5 ms` on millions of vectors)

Subtopics Covered (8):
  • Exact `O(N * d)` flat scan (`100%` recall
  • Great up to `~50k` vectors!) vs sub-linear ANN graph/cluster indexes (`95โ€“99%` recall at `1โ€“5 ms` on millions of vectors)
  • Production Pitfall Guard (Vector Indexing and Exact vs Approximate Similarity Search)
โ†’ What Topic Is Next: Next Topic 4.11: Approximate Nearest Neighbor (ANN) Algorithms: HNSW and IVF
Guide โ†’

Hierarchical Navigable Small World (`HNSW`) multi-layer proximity graphs vs Inverted File (`IVF`) Voronoi k-means centroids + Product Quantization (`PQ`) compression

Subtopics Covered (8):
  • Hierarchical Navigable Small World (`HNSW`) multi-layer proximity graphs vs Inverted File (`IVF`) Voronoi k-means centroids + Product Quantization (`PQ`) compression
  • Production Pitfall Guard (Approximate Nearest Neighbor (ANN) Algorithms: HNSW and IVF)
  • Hands-On Verification (Approximate Nearest Neighbor (ANN) Algorithms: HNSW and IVF)
โ†’ What Topic Is Next: Next Topic 4.12: FAISS (Facebook AI Similarity Search)
Guide โ†’

`IndexFlatL2`, `IndexFlatIP`, `IndexHNSWFlat`, `IndexIVFFlat`, `IndexIDMap` for custom document IDs, and saving/loading `.faiss` indexes

Subtopics Covered (8):
  • `IndexFlatL2`
  • `IndexFlatIP`
  • `IndexHNSWFlat`
โ†’ What Topic Is Next: Next Topic 4.13: Chroma Vector Store
Guide โ†’

`chromadb.PersistentClient` vs `HttpClient`, collection distance metadata (`{"hnsw:space": "cosine"}`), `upsert`, `where` metadata filters, and local developer ergon...

Subtopics Covered (8):
  • `chromadb.PersistentClient` vs `HttpClient`
  • Collection distance metadata (`{"hnsw:space": "cosine"}`)
  • `upsert`
โ†’ What Topic Is Next: Next Topic 4.14: Qdrant Vector Database
Guide โ†’

`QdrantClient`, typed `VectorParams(size=..., distance=Distance.COSINE)`, `PointStruct` UUIDs + rich JSON payloads, payload indexes, and filterable HNSW (`Filter`, `...

Subtopics Covered (8):
  • `QdrantClient`
  • Typed `VectorParams(size=...
  • Distance=Distance.COSINE)`
โ†’ What Topic Is Next: Next Topic 4.15: pgvector with PostgreSQL
Guide โ†’

`CREATE EXTENSION vector`, `vector(768)` columns, cosine distance operator `<=>` (`1 - (embedding <=> :q)`), `USING hnsw (embedding vector_cosine_ops)`, and ACID SQL...

Subtopics Covered (8):
  • `CREATE EXTENSION vector`
  • `vector(768)` columns
  • Cosine distance operator `<=>` (`1 - (embedding <=> :q)`)
โ†’ What Topic Is Next: Next Topic 4.16: Collections, Namespaces and Partitioning
Guide โ†’

Separating incompatible embedding models into separate collections while isolating tenants via indexed `tenant_id` partitions/namespaces (rather than 50,000 tiny col...

Subtopics Covered (8):
  • Separating incompatible embedding models into separate collections while isolating tenants via indexed `tenant_id` partitions/namespaces (rather than 50
  • 000 tiny collections)
  • Production Pitfall Guard (Collections, Namespaces and Partitioning)
โ†’ What Topic Is Next: Next Topic 4.17: Metadata Filtering (Pre-Filtering vs Post-Filtering)
Guide โ†’

Why naive **Post-Filtering** (fetch global Top-10 -> filter `tenant_id == "acme"` -> `0` results left!) fails catastrophically vs **Filterable HNSW / Pre-Filtering**

Subtopics Covered (8):
  • Why naive **Post-Filtering** (fetch global Top-10 -> filter `tenant_id == "acme"` -> `0` results left!) fails catastrophically vs **Filterable HNSW / Pre-Filtering**
  • Production Pitfall Guard (Metadata Filtering (Pre-Filtering vs Post-Filtering))
  • Hands-On Verification (Metadata Filtering (Pre-Filtering vs Post-Filtering))
โ†’ What Topic Is Next: Module 4 Capstone (Week 14 Lab Build: Multi-Tenant Hybrid RRF Search on Qdrant & PostgreSQL pgvector) โ†’ Next Topic 5.1: RAG Architecture, Two-Phase Lifecycle and Use Cases

Implement `FAISS`, `Chroma`, `Qdrant`, and `PostgreSQL + pgvector` adapters, fuse `BM25` + Dense Vector rankings via Reciprocal Rank Fusion (`RRF k=60`), handle atomic document re-indexing, and prove zero cross-tenant leakage.

โ€ข Clean, type-annotated Python 3.12 source code on GitHub
โ€ข Automated `pytest` test suite covering normal, boundary, and failure paths
โ€ข README documenting architecture, model/embedding choices, and benchmark metrics

Module Learning & Hands-On Objectives

โœ“ Eliminate retrieval blind spots using Reciprocal Rank Fusion (RRF), Cross-Encoder reranking, query rewriting, and strict source citations.
โœ“ Implement, test, and verify production-grade code and edge-case guardrails across all topics in Week 5.
Guide โ†’

Offline Indexing Pipeline (`Parse -> Clean -> Chunk -> Embed -> Upsert`) vs Online Query Pipeline (`Rewrite -> Retrieve -> Rerank -> Prompt -> Generate w/ Citations`...

Subtopics Covered (8):
  • Offline Indexing Pipeline (`Parse -> Clean -> Chunk -> Embed -> Upsert`) vs Online Query Pipeline (`Rewrite -> Retrieve -> Rerank -> Prompt -> Generate w/ Citations`)
  • Why RAG beats SFT for dynamic enterprise knowledge
  • Production Pitfall Guard (RAG Architecture, Two-Phase Lifecycle and Use Cases)
โ†’ What Topic Is Next: Next Topic 5.2: Document Ingestion Pipeline Design
Guide โ†’

State machine (`UPLOADED -> PARSING -> CHUNKING -> EMBEDDING -> READY | FAILED`), SHA-256 content deduplication, dead-letter error capture, and incremental re-indexi...

Subtopics Covered (8):
  • State machine (`UPLOADED -> PARSING -> CHUNKING -> EMBEDDING -> READY | FAILED`)
  • SHA-256 content deduplication
  • Dead-letter error capture
โ†’ What Topic Is Next: Next Topic 5.3: PDF, DOCX, TXT, CSV and HTML Processing
Guide โ†’

Extracting page-accurate text from digital PDFs (`pypdf` / `pymupdf`), structured paragraphs/tables from `python-docx`, row-context cards from `CSV`, and main-articl...

Subtopics Covered (8):
  • Extracting page-accurate text from digital PDFs (`pypdf` / `pymupdf`)
  • Structured paragraphs/tables from `python-docx`
  • Row-context cards from `CSV`
โ†’ What Topic Is Next: Next Topic 5.4: OCR Fundamentals for Scanned Documents
Guide โ†’

Detecting scanned/image-only PDF pages (`len(extracted_text.strip()) < 25` despite non-empty page images!) and routing selectively to OCR (`pytesseract` / `PaddleOCR...

Subtopics Covered (8):
  • Detecting scanned/image-only PDF pages (`len(extracted_text.strip()) < 25` despite non-empty page images!)
  • Routing selectively to OCR (`pytesseract` / `PaddleOCR` / Vision LLM)
  • Production Pitfall Guard (OCR Fundamentals for Scanned Documents)
โ†’ What Topic Is Next: Next Topic 5.5: Document Layout Parsing and Table Extraction
Guide โ†’

Preserving section hierarchy (`H1 > H2 > H3` breadcrumb prefixes) and converting PDF/DOCX tables into Markdown tables so row-to-column header alignment survives chun...

Subtopics Covered (8):
  • Preserving section hierarchy (`H1 > H2 > H3` breadcrumb prefixes)
  • Converting PDF/DOCX tables into Markdown tables so row-to-column header alignment survives chunking!
  • Production Pitfall Guard (Document Layout Parsing and Table Extraction)
โ†’ What Topic Is Next: Next Topic 5.6: Text Cleaning, De-Hyphenation and Normalization
Guide โ†’

Fixing PDF line-break hyphenation (`"micro-\nservices"` -> `"microservices"`), stripping repeating running page headers/footers (`"CONFIDENTIAL - Page 4 of 90"`), an...

Subtopics Covered (8):
  • Fixing PDF line-break hyphenation (`"micro-\nservices"` -> `"microservices"`)
  • Stripping repeating running page headers/footers (`"CONFIDENTIAL - Page 4 of 90"`)
  • `NFKC` normalization
โ†’ What Topic Is Next: Next Topic 5.7: Chunking Strategies Overview and Granularity Trade-Offs
Guide โ†’

Why tiny chunks (`64` tokens) match precisely but lack surrounding context, whereas giant chunks (`2,000` tokens) dilute topic embeddings with 5 unrelated sections

Subtopics Covered (8):
  • Why tiny chunks (`64` tokens) match precisely but lack surrounding context
  • Whereas giant chunks (`2
  • 000` tokens) dilute topic embeddings with 5 unrelated sections
โ†’ What Topic Is Next: Next Topic 5.8: Fixed-Size Token Chunking
Guide โ†’

Sliding window over exact `tiktoken` / model tokenizer IDs (`chunk_tokens = 400`, `overlap_tokens = 50`) guaranteeing strict adherence to embedding `max_seq_length`

Subtopics Covered (8):
  • Sliding window over exact `tiktoken` / model tokenizer IDs (`chunk_tokens = 400`
  • `overlap_tokens = 50`) guaranteeing strict adherence to embedding `max_seq_length`
  • Production Pitfall Guard (Fixed-Size Token Chunking)
โ†’ What Topic Is Next: Next Topic 5.9: Recursive Character and Markdown Structure-Aware Chunking
Guide โ†’

Splitting hierarchically along natural semantic boundaries (`["\n## ", "\n### ", "\n\n", "\n", ". ", " "]`) before falling back to hard length splits

Subtopics Covered (8):
  • Splitting hierarchically along natural semantic boundaries (`["\n## "
  • "\n### "
  • "\n\n"
โ†’ What Topic Is Next: Next Topic 5.10: Conversational Query Rewriting
Guide โ†’

Rewriting pronoun/ellipsis follow-ups (`"Does it apply to contractors too?"` after `"What is the parental leave policy?"`) into standalone search queries (`"parental...

Subtopics Covered (8):
  • Rewriting pronoun/ellipsis follow-ups (`"Does it apply to contractors too?"` after `"What is the parental leave policy?"`) into standalone search queries (`"parental leave policy eligibility for contractors"`)
  • Production Pitfall Guard (Conversational Query Rewriting)
  • Hands-On Verification (Conversational Query Rewriting)
โ†’ What Topic Is Next: Next Topic 5.11: Query Expansion and Hypothetical Document Embeddings (HyDE)
Guide โ†’

Expanding terse 2-word queries with domain synonyms or generating a brief hypothetical passage (`HyDE`) whose passage-style phrasing bridges the query-to-document le...

Subtopics Covered (8):
  • Expanding terse 2-word queries with domain synonyms or generating a brief hypothetical passage (`HyDE`) whose passage-style phrasing bridges the query-to-document lexical gap
  • Production Pitfall Guard (Query Expansion and Hypothetical Document Embeddings (HyDE))
  • Hands-On Verification (Query Expansion and Hypothetical Document Embeddings (HyDE))
โ†’ What Topic Is Next: Next Topic 5.12: Multi-Query Retrieval and Sub-Question Decomposition
Guide โ†’

Decomposing comparative queries (`"Compare Starter vs Enterprise SLA uptime and refund credits"`) into 2โ€“4 targeted sub-queries executed concurrently via `asyncio.ga...

Subtopics Covered (8):
  • Decomposing comparative queries (`"Compare Starter vs Enterprise SLA uptime
  • Refund credits"`) into 2โ€“4 targeted sub-queries executed concurrently via `asyncio.gather` + fused via `RRF`
  • Production Pitfall Guard (Multi-Query Retrieval and Sub-Question Decomposition)
โ†’ What Topic Is Next: Next Topic 5.13: Metadata-Based Pre-Filtering and Query Routing
Guide โ†’

Extracting structured filter predicates (`year >= 2025`, `doc_type == "policy"`, `region == "IN"`) via Pydantic tool/structured output and pushing them into Qdrant/`...

Subtopics Covered (8):
  • Extracting structured filter predicates (`year >= 2025`
  • `doc_type == "policy"`
  • `region == "IN"`) via Pydantic tool/structured output
โ†’ What Topic Is Next: Next Topic 5.14: Production Hybrid Retrieval (BM25 + Dense + RRF)
Guide โ†’

Executing PostgreSQL `ts_rank_cd` / Qdrant sparse + dense vector retrieval in parallel and fusing via weighted Reciprocal Rank Fusion (`RRF`)

Subtopics Covered (8):
  • Executing PostgreSQL `ts_rank_cd` / Qdrant sparse + dense vector retrieval in parallel
  • Fusing via weighted Reciprocal Rank Fusion (`RRF`)
  • Production Pitfall Guard (Production Hybrid Retrieval (BM25 + Dense + RRF))
โ†’ What Topic Is Next: Next Topic 5.15: Reranking Models and Two-Stage Retrieval Architecture
Guide โ†’

Stage 1: Fast Recall (`Bi-Encoder + BM25`, `top_k = 25` in `15 ms`) -> Stage 2: High-Precision Reranker (`Cross-Encoder`, scoring `(query, chunk)` jointly down to `t...

Subtopics Covered (8):
  • Stage 1: Fast Recall (`Bi-Encoder + BM25`
  • `top_k = 25` in `15 ms`) -> Stage 2: High-Precision Reranker (`Cross-Encoder`
  • Scoring `(query
โ†’ What Topic Is Next: Next Topic 5.16: Cross-Encoder Reranking Concepts in Detail
Guide โ†’

Feeding `[CLS] query [SEP] passage [SEP]` jointly into full self-attention (`BAAI/bge-reranker-v2-m3` / `ms-marco-MiniLM`) so every query token attends directly to e...

Subtopics Covered (8):
  • Feeding `[CLS] query [SEP] passage [SEP]` jointly into full self-attention (`BAAI/bge-reranker-v2-m3` / `ms-marco-MiniLM`) so every query token attends directly to every passage token
  • Production Pitfall Guard (Cross-Encoder Reranking Concepts in Detail)
  • Hands-On Verification (Cross-Encoder Reranking Concepts in Detail)
โ†’ What Topic Is Next: Next Topic 5.17: Parent-Child and Small-to-Big Retrieval
Guide โ†’

Indexing fine-grained `128`-token **Child** chunks for surgical vector similarity matching, then fetching their surrounding `800`-token **Parent** section from Postg...

Subtopics Covered (8):
  • Indexing fine-grained `128`-token **Child** chunks for surgical vector similarity matching
  • Then fetching their surrounding `800`-token **Parent** section from PostgreSQL for complete LLM context!
  • Production Pitfall Guard (Parent-Child and Small-to-Big Retrieval)
โ†’ What Topic Is Next: Next Topic 5.18: Context Compression and Noise Pruning
Guide โ†’

Filtering low-relevance sentences inside long retrieved passages using fast sentence-similarity / reranker scores so distractors donโ€™t confuse generation

Subtopics Covered (8):
  • Filtering low-relevance sentences inside long retrieved passages using fast sentence-similarity / reranker scores so distractors donโ€™t confuse generation
  • Production Pitfall Guard (Context Compression and Noise Pruning)
  • Hands-On Verification (Context Compression and Noise Pruning)
โ†’ What Topic Is Next: Module 5 Capstone (Project 5: Enterprise Knowledge Base Assistant) โ†’ Next Topic 6.1: What Is an AI Agent? Agency Spectrum and Core Loop

Employees across HR, Engineering, Finance, and Legal waste hours hunting through scattered PDFs, Word policies, and wiki pages โ€” while naive RAG prototypes leak restricted executive documents, fail on exact clause numbers, and hallucinate uncited claims. Build a production-grade **Enterprise Knowledge Base Assistant** featuring multi-format ingestion, Hybrid (`BM25` + Dense Vector `RRF`) retrieval, Cross-Encoder reranking, document-level RBAC permission pre-filtering, verifiable inline `[S1]` page citations, multi-turn query rewriting, and a quantitative RAG evaluation suite.

โ€ข Multi-format PDF/DOCX/TXT Ingestion + Qdrant/`pgvector` Hybrid `BM25 + RRF + Reranker` Engine
โ€ข RBAC-Filtered Conversational RAG API with Verified `[S1]` Page Citations & Abstention
โ€ข 30+ Case Golden Dataset & Quantitative Evaluation Report (`Recall@5`, `MRR`, `Faithfulness`)

Module Learning & Hands-On Objectives

โœ“ Architect deterministic stateful agent graphs, human approval interrupts, and reusable MCP tool/resource servers.
โœ“ Implement, test, and verify production-grade code and edge-case guardrails across all topics in Week 6.
Guide โ†’

Defining an AI Agent as an LLM system that dynamically decides control flow and tool invocations in a loop (`Observe -> Think/Select Tool -> Execute -> Observe Resul...

Subtopics Covered (8):
  • Defining an AI Agent as an LLM system that dynamically decides control flow
  • Tool invocations in a loop (`Observe -> Think/Select Tool -> Execute -> Observe Result -> Finish`) toward a goal
  • Production Pitfall Guard (What Is an AI Agent? Agency Spectrum and Core Loop)
โ†’ What Topic Is Next: Next Topic 6.2: Deterministic LLM Workflow vs Autonomous Agent
Guide โ†’

Engineering decision rule: use fixed **Workflows** (chains/routers/parallel) when steps are known upfront (lower latency, lower cost, predictable); use **Agents** on...

Subtopics Covered (8):
  • Engineering decision rule: use fixed **Workflows** (chains/routers/parallel) when steps are known upfront (lower latency
  • Lower cost
  • Predictable)
โ†’ What Topic Is Next: Next Topic 6.3: Agent Architecture and Core Components
Guide โ†’

Model (`Reasoning Engine`), Tool Registry (`Typed Schemas + Handlers`), State/Scratchpad (`Messages + Step Counter`), Memory (`Session + Long-Term`), and Policy Guar...

Subtopics Covered (8):
  • Model (`Reasoning Engine`)
  • Tool Registry (`Typed Schemas + Handlers`)
  • State/Scratchpad (`Messages + Step Counter`)
โ†’ What Topic Is Next: Next Topic 6.4: Planning and Task Decomposition (ReAct & Plan-and-Execute)
Guide โ†’

Interleaved `ReAct` (reason 1 step -> call tool -> adapt) vs `Plan-and-Execute` (draft structured step checklist -> execute steps -> replan if blocked)

Subtopics Covered (8):
  • Interleaved `ReAct` (reason 1 step -> call tool -> adapt) vs `Plan-
  • -Execute` (draft structured step checklist -> execute steps -> replan if blocked)
  • Production Pitfall Guard (Planning and Task Decomposition (ReAct & Plan-and-Execute))
โ†’ What Topic Is Next: Next Topic 6.5: Tool Definitions, Strict JSON Schemas and Docstrings
Guide โ†’

Designing clear, non-overlapping tool names (`get_order_by_id` vs `list_recent_orders`), `strict: True` JSON Schemas, `enum` constraints, and examples inside paramet...

Subtopics Covered (8):
  • Designing clear
  • Non-overlapping tool names (`get_order_by_id` vs `list_recent_orders`)
  • `strict: True` JSON Schemas
โ†’ What Topic Is Next: Next Topic 6.6: Native Function Calling in an Iterative Agent Loop
Guide โ†’

Handling zero, single, or parallel `tool_calls` in a single turn, appending every `function_call_output` matched by `call_id`, and terminating cleanly when the model...

Subtopics Covered (8):
  • Handling zero
  • Single
  • Or parallel `tool_calls` in a single turn
โ†’ What Topic Is Next: Next Topic 6.7: LangChain Model Integrations and Unified ChatModel Interface
Guide โ†’

`BaseChatModel` (`ChatOpenAI`, `ChatAnthropic`, `ChatOllama`), `init_chat_model()`, uniform `.invoke()` / `.ainvoke()` / `.stream()`, and standardized `AIMessage.usa...

Subtopics Covered (8):
  • `BaseChatModel` (`ChatOpenAI`
  • `ChatAnthropic`
  • `ChatOllama`)
โ†’ What Topic Is Next: Next Topic 6.8: LangChain Prompt Templates and MessagesPlaceholder
Guide โ†’

`ChatPromptTemplate.from_messages()`, typed `SystemMessage` / `HumanMessage`, and `MessagesPlaceholder("history")` for clean multi-turn injection

Subtopics Covered (8):
  • `ChatPromptTemplate.from_messages()`
  • Typed `SystemMessage` / `HumanMessage`
  • `MessagesPlaceholder("history")` for clean multi-turn injection
โ†’ What Topic Is Next: Next Topic 6.9: LangChain Structured Outputs and Output Parsers
Guide โ†’

`model.with_structured_output(PydanticSchema, strict=True, include_raw=True)` vs `JsonOutputParser` / `StrOutputParser` for models lacking native grammar constraints

Subtopics Covered (8):
  • `model.with_structured_output(PydanticSchema
  • Strict=True
  • Include_raw=True)` vs `JsonOutputParser` / `StrOutputParser` for models lacking native grammar constraints
โ†’ What Topic Is Next: Next Topic 6.10: Runnable Components and LCEL Chains
Guide โ†’

`Runnable` protocol (`invoke`, `ainvoke`, `batch`, `astream`), pipe composition `prompt | model`, `RunnableParallel` concurrent fan-out, and `.with_retry()` / `.with...

Subtopics Covered (8):
  • `Runnable` protocol (`invoke`
  • `ainvoke`
  • `batch`
โ†’ What Topic Is Next: Next Topic 6.11: LangChain Retrieval Integrations
Guide โ†’

`BaseRetriever` interface wrapping Qdrant / `pgvector` / Hybrid search, passing runtime security `configurable` filters (`tenant_id`, `acl_roles`) cleanly

Subtopics Covered (8):
  • `BaseRetriever` interface wrapping Qdrant / `pgvector` / Hybrid search
  • Passing runtime security `configurable` filters (`tenant_id`
  • `acl_roles`) cleanly
โ†’ What Topic Is Next: Next Topic 6.12: LangChain Tool Integration (@tool & StructuredTool)
Guide โ†’

`@tool` decorator with Pydantic `args_schema`, `InjectedToolArg` / closure binding for server-side `user_id`/`tenant_id` context, and `model.bind_tools(tools)`

Subtopics Covered (8):
  • `@tool` decorator with Pydantic `args_schema`
  • `InjectedToolArg` / closure binding for server-side `user_id`/`tenant_id` context
  • `model.bind_tools(tools)`
โ†’ What Topic Is Next: Next Topic 6.13: LangChain Memory and Conversation Trimming
Guide โ†’

`trim_messages(..., max_tokens=..., strategy="last", include_system=True, allow_partial=False)` preserving valid `(AIMessage(tool_calls) -> ToolMessage)` pairs

Subtopics Covered (8):
  • `trim_messages(...
  • Max_tokens=...
  • Strategy="last"
โ†’ What Topic Is Next: Next Topic 6.14: Introduction to Model Context Protocol (MCP)
Guide โ†’

Solving the `M AI Apps ร— N Data Sources` integration explosion via one open JSON-RPC 2.0 protocol (`M + N`) โ€” write an internal Jira/Postgres MCP server once, reuse...

Subtopics Covered (8):
  • Solving the `M AI Apps ร— N Data Sources` integration explosion via one open JSON-RPC 2.0 protocol (`M + N`) โ€” write an internal Jira/Postgres MCP server once
  • Reuse across internal agents
  • IDEs
โ†’ What Topic Is Next: Next Topic 6.15: MCP Architecture, Lifecycle and JSON-RPC 2.0 Terminology
Guide โ†’

Capability negotiation (`initialize` -> `initialized`), stateful sessions, JSON-RPC `request`/`response`/`notification` envelopes, and transport independence (`stdio...

Subtopics Covered (8):
  • Capability negotiation (`initialize` -> `initialized`)
  • Stateful sessions
  • JSON-RPC `request`/`response`/`notification` envelopes
โ†’ What Topic Is Next: Next Topic 6.16: MCP Hosts, Clients and Servers
Guide โ†’

1-to-1 relationship: the **MCP Host** (your FastAPI AI app / IDE) manages security consent and instantiates one **MCP Client** per connected **MCP Server** (`crm-mcp...

Subtopics Covered (8):
  • 1-to-1 relationship: the **MCP Host** (your FastAPI AI app / IDE) manages security consent
  • Instantiates one **MCP Client** per connected **MCP Server** (`crm-mcp`
  • `docs-mcp`
โ†’ What Topic Is Next: Next Topic 6.17: Core MCP Primitives: Tools, Resources and Prompts
Guide โ†’

`Tools` (model-invoked actions/queries), `Resources` (application/user-attached read-only context URIs like `kb://policies/leave-2026`), and `Prompts` (reusable para...

Subtopics Covered (8):
  • `Tools` (model-invoked actions/queries)
  • `Resources` (application/user-attached read-only context URIs like `kb://policies/leave-2026`)
  • `Prompts` (reusable parameterized workflow templates)
โ†’ What Topic Is Next: Next Topic 6.18: Building an MCP Server in Python (FastMCP / mcp SDK)
Guide โ†’

Defining `@mcp.tool()`, `@mcp.resource("kb://{doc_id}")`, and `@mcp.prompt()` with Python 3.12 type hints, Pydantic models, async lifespan DB pools, and structured o...

Subtopics Covered (8):
  • Defining `@mcp.tool()`
  • `@mcp.resource("kb://{doc_id}")`
  • `@mcp.prompt()` with Python 3.12 type hints
โ†’ What Topic Is Next: Module 6 Capstone (Week 19 Lab Build: Audited Enterprise Python MCP Server & Client Suite) โ†’ Next Topic 7.1: Prompt Engineering vs RAG vs Fine-Tuning Decision Framework

Build a typed `FastMCP` / `mcp` server + `AsyncExitStack` client exposing `kb://` URI resources, read-only SQL views, and approval-gated ticketing tools with Bearer scope checks, path-traversal protection, and redacted audit logs.

โ€ข Clean, type-annotated Python 3.12 source code on GitHub
โ€ข Automated `pytest` test suite covering normal, boundary, and failure paths
โ€ข README documenting architecture, model/embedding choices, and benchmark metrics

Module Learning & Hands-On Objectives

โœ“ Apply a rigorous engineering decision framework choosing between Prompting, RAG, and Supervised Fine-Tuning (`SFT`).
โœ“ Curate, clean, deduplicate, and format high-quality `ChatML` instruction datasets with assistant-only completion loss masking.
โœ“ Fine-tune an open-weight model practically on constrained GPU VRAM (`16 GB T4/L4`) using `PEFT` (`LoRA` & 4-bit `QLoRA`) and Hugging Face `TRL` (`SFTTrainer`).
โœ“ Benchmark pre- vs post-fine-tuning task accuracy, latency, and regressions โ€” and deliver **Month 5 Project (Project 6): Autonomous Business Operations Assistant**.
Guide โ†’

Comparing **Prompting** (zero training, instant iteration), **RAG** (dynamic/verifiable external facts, ACLs, citations), and **Fine-Tuning** (consistent tone/format...

Subtopics Covered (8):
  • Comparing **Prompting** (zero training
  • Instant iteration)
  • **RAG** (dynamic/verifiable external facts
โ†’ What Topic Is Next: Next Topic 7.2: When Fine-Tuning Is Appropriate (and When It Wastes Weeks)
Guide โ†’

Valid triggers: (1) Prompt + few-shot already maxed out on evals, (2) Strict latency/cost target requiring a small specialized 1Bโ€“8B model, (3) Specialized classific...

Subtopics Covered (8):
  • Valid triggers: (1) Prompt + few-shot already maxed out on evals
  • (2) Strict latency/cost target requiring a small specialized 1Bโ€“8B model
  • (3) Specialized classification/extraction/code DSL with `500โ€“5
โ†’ What Topic Is Next: Next Topic 7.3: Dataset Preparation and Curation Strategy
Guide โ†’

Why `1,000` clean, diverse, expert-verified `(messages -> gold_completion)` examples consistently outperform `50,000` noisy scraped examples (`LIMA` quality principl...

Subtopics Covered (8):
  • Why `1
  • 000` clean
  • Diverse
โ†’ What Topic Is Next: Next Topic 7.4: Data Cleaning, PII Scrubbing and Deduplication
Guide โ†’

Scrubbing real customer emails/phones/IDs BEFORE training (models can regurgitate memorized training PII to ANY user!), removing refusal boilerplate artifacts, and e...

Subtopics Covered (8):
  • Scrubbing real customer emails/phones/IDs BEFORE training (models can regurgitate memorized training PII to ANY user!)
  • Removing refusal boilerplate artifacts
  • Exact + `MinHash` near-deduplication
โ†’ What Topic Is Next: Next Topic 7.5: Instruction and Chat Dataset Formatting
Guide โ†’

Standard `{"messages": [{"role": "system", ...}, {"role": "user", ...}, {"role": "assistant", ...}]}` format rendered through `tokenizer.apply_chat_template()` so sp...

Subtopics Covered (8):
  • Standard `{"messages": [{"role": "system"
  • ...}
  • {"role": "user"
โ†’ What Topic Is Next: Next Topic 7.6: Stratified Training, Validation and Test Splits
Guide โ†’

Splitting `80% train / 10% val / 10% test` stratified by task category AND grouped by `customer_id`/`thread_id` so near-identical messages from the same ticket never...

Subtopics Covered (8):
  • Splitting `80% train / 10% val / 10% test` stratified by task category
  • Grouped by `customer_id`/`thread_id` so near-identical messages from the same ticket never leak across train
  • Test!
โ†’ What Topic Is Next: Next Topic 7.7: Tokenization for Training and Completion-Only Loss Masking
Guide โ†’

Setting `labels = -100` (PyTorch `CrossEntropyLoss` `ignore_index`) on `system` and `user` prompt tokens so gradient updates ONLY optimize the `assistant` response t...

Subtopics Covered (8):
  • Setting `labels = -100` (PyTorch `CrossEntropyLoss` `ignore_index`) on `system`
  • `user` prompt tokens so gradient updates ONLY optimize the `assistant` response tokens!
  • Production Pitfall Guard (Tokenization for Training and Completion-Only Loss Masking)
โ†’ What Topic Is Next: Next Topic 7.8: Supervised Fine-Tuning (SFT) Fundamentals
Guide โ†’

Teacher-forcing next-token cross-entropy objective over gold assistant demonstrations, packing short sequences vs padded batches, and monitoring `train_loss` vs `eva...

Subtopics Covered (8):
  • Teacher-forcing next-token cross-entropy objective over gold assistant demonstrations
  • Packing short sequences vs padded batches
  • Monitoring `train_loss` vs `eval_loss`
โ†’ What Topic Is Next: Next Topic 7.9: Hugging Face Trainer and TrainingArguments
Guide โ†’

Configuring `TrainingArguments` (`per_device_train_batch_size`, `gradient_accumulation_steps`, `learning_rate`, `bf16=True`, `logging_steps`, `eval_strategy`, `save_...

Subtopics Covered (8):
  • Configuring `TrainingArguments` (`per_device_train_batch_size`
  • `gradient_accumulation_steps`
  • `learning_rate`
โ†’ What Topic Is Next: Next Topic 7.10: PyTorch Training Mechanics for LLMs
Guide โ†’

Why full fine-tuning of a `7B` model requires `~112 GB+` VRAM (`14 GB` fp16 weights + `14 GB` gradients + `56โ€“84 GB` FP32 AdamW `m` & `v` states + activations!), `bf...

Subtopics Covered (8):
  • Why full fine-tuning of a `7B` model requires `~112 GB+` VRAM (`14 GB` fp16 weights + `14 GB` gradients + `56โ€“84 GB` FP32 AdamW `m` & `v` states + activations!)
  • `bf16` stability over `fp16`
  • `gradient_checkpointing`
โ†’ What Topic Is Next: Next Topic 7.11: Parameter-Efficient Fine-Tuning (PEFT) Intuition
Guide โ†’

Freezing `100%` of pretrained base weights `W_0` (no Adam optimizer state needed for `8B` frozen params!) and training only tiny injected adapter matrices (`0.1%โ€“1.5...

Subtopics Covered (8):
  • Freezing `100%` of pretrained base weights `W_0` (no Adam optimizer state needed for `8B` frozen params!)
  • Training only tiny injected adapter matrices (`0.1%โ€“1.5%` of parameters)
  • Production Pitfall Guard (Parameter-Efficient Fine-Tuning (PEFT) Intuition)
โ†’ What Topic Is Next: Next Topic 7.12: LoRA Architecture and Low-Rank Adapter Math
Guide โ†’

Decomposing weight update `W = W_0 + (lora_alpha / r) * (B @ A)` where `W_0 in R^(d x k)` is frozen, `A in R^(r x k)` (`Kaiming/Gaussian` init), `B in R^(d x r)` (`Z...

Subtopics Covered (8):
  • Decomposing weight update `W = W_0 + (lora_alpha / r) * (B @ A)` where `W_0 in R^(d x k)` is frozen
  • `A in R^(r x k)` (`Kaiming/Gaussian` init)
  • `B in R^(d x r)` (`Zero` init so `ฮ”W = 0` at Step 0!)
โ†’ What Topic Is Next: Next Topic 7.13: QLoRA and 4-Bit NF4 Quantization Fundamentals
Guide โ†’

4-bit NormalFloat (`NF4`, information-theoretically optimal for normally distributed weights!), Double Quantization (quantizing quantization scales), `bf16` compute...

Subtopics Covered (8):
  • 4-bit NormalFloat (`NF4`
  • Information-theoretically optimal for normally distributed weights!)
  • Double Quantization (quantizing quantization scales)
โ†’ What Topic Is Next: Next Topic 7.14: Hugging Face PEFT Library (LoraConfig & get_peft_model)
Guide โ†’

`LoraConfig(r=16, lora_alpha=32, lora_dropout=0.05, bias="none", task_type="CAUSAL_LM", target_modules="all-linear")`, `prepare_model_for_kbit_training()`, and `mode...

Subtopics Covered (8):
  • `LoraConfig(r=16
  • Lora_alpha=32
  • Lora_dropout=0.05
โ†’ What Topic Is Next: Next Topic 7.15: Hugging Face TRL Library (SFTTrainer & DPO Overview)
Guide โ†’

`trl.SFTTrainer` + `SFTConfig` (native `messages` chat-template rendering, completion-only loss, max_length, packing) + conceptual overview of post-SFT preference al...

Subtopics Covered (8):
  • `trl.SFTTrainer` + `SFTConfig` (native `messages` chat-template rendering
  • Completion-only loss
  • Max_length
โ†’ What Topic Is Next: Module 7 Capstone (Project 6: Autonomous Business Operations Assistant) โ†’ Next Topic 8.1: Test-Case Design for LLM Applications

Operations, finance, and customer-success teams juggle multi-step requests that span SQL order/account lookups, policy document checks, ticket creation, and customer email replies โ€” where unchecked autonomous agents risk infinite loops, unauthorized mutations, or unapproved external emails. Build a governed **Autonomous Business Operations Assistant** using `LangGraph` and `MCP` featuring intent classification, multi-step planning, controlled read/write tools, mandatory Human-in-the-Loop (`interrupt()`) approval before sensitive actions, immutable audit logs, error recovery, and automated agent trajectory evaluation.

โ€ข Stateful `LangGraph` + `MCP` Business Operations Assistant (`DB + Policy RAG + Draft + Mutating Tools`)
โ€ข Payload-Verified Human-in-the-Loop Approval API & Append-Only `agent_audit_logs` Timeline
โ€ข 25-Scenario Agent Task-Success & Tool-Call Accuracy Evaluation Suite + Report

Module Learning & Hands-On Objectives

โœ“ Measure context recall, faithfulness, and answer relevance automatically while blocking prompt-injection and PII leakage.
โœ“ Implement, test, and verify production-grade code and edge-case guardrails across all topics in Week 8.
Guide โ†’

Boundary conditions: empty/huge inputs, conflicting dates across 2 docs, negation traps (`"EXCEPT contractors"`), multilingual/Hinglish phrasing, typos, and adversar...

Subtopics Covered (8):
  • Boundary conditions: empty/huge inputs
  • Conflicting dates across 2 docs
  • Negation traps (`"EXCEPT contractors"`)
โ†’ What Topic Is Next: Next Topic 8.2: Output Schema and Semantic Invariant Validation
Guide โ†’

Testing JSON syntax, Pydantic types, enum membership, sum/date cross-field math (`subtotal + gst == total`), and forbidden-phrase absence (`"As an AI language model"...

Subtopics Covered (8):
  • Testing JSON syntax
  • Pydantic types
  • Enum membership
โ†’ What Topic Is Next: Next Topic 8.3: Hallucination Testing and Abstention Benchmarking
Guide โ†’

Dedicated **Negative / Unanswerable Benchmark** (`near-miss domain questions` whose answer is intentionally NOT in the docs!) measuring `False Answer Rate (Hallucina...

Subtopics Covered (8):
  • Dedicated **Negative / Unanswerable Benchmark** (`near-miss domain questions` whose answer is intentionally NOT in the docs!) measuring `False Answer Rate (Hallucination Rate)` vs `True Abstention Rate`
  • Production Pitfall Guard (Hallucination Testing and Abstention Benchmarking)
  • Hands-On Verification (Hallucination Testing and Abstention Benchmarking)
โ†’ What Topic Is Next: Next Topic 8.4: Factual Accuracy and Groundedness Verification
Guide โ†’

Natural Language Inference (`NLI`: `Entailment` / `Neutral` / `Contradiction`) and claim-level decomposition verifying numbers, dates, and conditions match retrieved...

Subtopics Covered (8):
  • Natural Language Inference (`NLI`: `Entailment` / `Neutral` / `Contradiction`)
  • Claim-level decomposition verifying numbers
  • Dates
โ†’ What Topic Is Next: Next Topic 8.5: RAG Retrieval Evaluation Pipeline
Guide โ†’

End-to-end automated harness running `golden_eval.jsonl` strictly through `QueryRewriter + HybridRetriever + Reranker` in seconds (zero generation LLM calls needed w...

Subtopics Covered (8):
  • End-to-end automated harness running `golden_eval.jsonl` strictly through `QueryRewriter + HybridRetriever + Reranker` in seconds (zero generation LLM calls needed when tuning retrieval!)
  • Production Pitfall Guard (RAG Retrieval Evaluation Pipeline)
  • Hands-On Verification (RAG Retrieval Evaluation Pipeline)
โ†’ What Topic Is Next: Next Topic 8.6: Context Precision and Context Recall
Guide โ†’

`Context Recall` (what fraction of gold ground-truth facts/chunks were retrieved in Top-K?) vs `Context Precision` (are relevant chunks ranked cleanly at positions 1...

Subtopics Covered (8):
  • `Context Recall` (what fraction of gold ground-truth facts/chunks were retrieved in Top-K?) vs `Context Precision` (are relevant chunks ranked cleanly at positions 1..2 rather than buried beneath irrelevant noise?)
  • Production Pitfall Guard (Context Precision and Context Recall)
  • Hands-On Verification (Context Precision and Context Recall)
โ†’ What Topic Is Next: Next Topic 8.7: Answer Relevance and Faithfulness (The RAG Triad)
Guide โ†’

The complete **RAG Triad**: (1) `Query <-> Retrieved Context` (`Context Relevance/Recall`), (2) `Retrieved Context <-> Answer` (`Faithfulness`), and (3) `Query <-> A...

Subtopics Covered (8):
  • The complete **RAG Triad**: (1) `Query <-> Retrieved Context` (`Context Relevance/Recall`)
  • (2) `Retrieved Context <-> Answer` (`Faithfulness`)
  • (3) `Query <-> Answer` (`Answer Relevance`) (`RAGAS` / `TruLens` methodology)
โ†’ What Topic Is Next: Next Topic 8.8: Agent Task-Success Evaluation
Guide โ†’

Evaluating final **Environment / Database Outcome State** (did the drafted ticket have `priority="P1"` and `order_id="ORD-88"`? did `pending_approval` get created?)...

Subtopics Covered (8):
  • Evaluating final **Environment / Database Outcome State** (did the drafted ticket have `priority="P1"`
  • `order_id="ORD-88"`? did `pending_approval` get created?) rather than judging only how polite the chat reply sounded!
  • Production Pitfall Guard (Agent Task-Success Evaluation)
โ†’ What Topic Is Next: Next Topic 8.9: OWASP Top 10 Risks for LLM and GenAI Applications
Guide โ†’

Complete threat modeling across Prompt Injection (`LLM01`), Sensitive Info Disclosure (`LLM02`), Supply Chain (`LLM03`), Data/Model Poisoning (`LLM04`), Improper Out...

Subtopics Covered (8):
  • Complete threat modeling across Prompt Injection (`LLM01`)
  • Sensitive Info Disclosure (`LLM02`)
  • Supply Chain (`LLM03`)
โ†’ What Topic Is Next: Next Topic 8.10: Direct Prompt Injection and Instruction Hierarchy
Guide โ†’

Why LLMs process instructions and data in one token sequence, leveraging model instruction hierarchy (`system > developer > user > tool_data`), XML data delimiters,...

Subtopics Covered (8):
  • Why LLMs process instructions
  • Data in one token sequence
  • Leveraging model instruction hierarchy (`system > developer > user > tool_data`)
โ†’ What Topic Is Next: Next Topic 8.11: Indirect Prompt Injection Defense
Guide โ†’

Attacks hidden inside untrusted external inputs (`resumes`, `emails`, `PDFs`, `web pages`, `support tickets`) attempting to hijack agent tools or exfiltrate session...

Subtopics Covered (8):
  • Attacks hidden inside untrusted external inputs (`resumes`
  • `emails`
  • `PDFs`
โ†’ What Topic Is Next: Next Topic 8.12: Jailbreak Attempts and Policy Bypass Resilience
Guide โ†’

Roleplay framing (`"Pretend we are writing a movie script"`), multi-turn crescendo escalation, obfuscated encodings, and combining input/output classifiers with stri...

Subtopics Covered (8):
  • Roleplay framing (`"Pretend we are writing a movie script"`)
  • Multi-turn crescendo escalation
  • Obfuscated encodings
โ†’ What Topic Is Next: Next Topic 8.13: Sensitive Information and System-Prompt Disclosure Prevention
Guide โ†’

NEVER placing API keys, DB connection strings, internal URLs, or proprietary algorithms inside system prompts (`LLM07` โ€” assume system prompts CAN leak!), and scopin...

Subtopics Covered (8):
  • NEVER placing API keys
  • DB connection strings
  • Internal URLs
โ†’ What Topic Is Next: Next Topic 8.14: Insecure Output Handling (Preventing XSS, SQLi, SSRF & RCE)
Guide โ†’

Treating EVERY string returned by an LLM as **untrusted user input**: sanitizing HTML/Markdown (`DOMPurify` / `bleach`), parameterizing SQL, blocking `eval()`/`exec(...

Subtopics Covered (8):
  • Treating EVERY string returned by an LLM as **untrusted user input**: sanitizing HTML/Markdown (`DOMPurify` / `bleach`)
  • Parameterizing SQL
  • Blocking `eval()`/`exec()`
โ†’ What Topic Is Next: Next Topic 8.15: Excessive Agency and Blast-Radius Containment
Guide โ†’

Minimizing (1) Excessive Functionality (only expose narrow task tools), (2) Excessive Permissions (scoped read-only DB credentials), and (3) Excessive Autonomy (HITL...

Subtopics Covered (8):
  • Minimizing (1) Excessive Functionality (only expose narrow task tools)
  • (2) Excessive Permissions (scoped read-only DB credentials)
  • (3) Excessive Autonomy (HITL gates + numeric caps)
โ†’ What Topic Is Next: Next Topic 8.16: Unsafe Tool Execution Prevention
Guide โ†’

Eliminating `eval()`, `exec()`, `pickle.loads()`, `yaml.load()` (use `safe_load`!), `shell=True`, unrestricted filesystem writes, and internal-network `SSRF`; runnin...

Subtopics Covered (8):
  • Eliminating `eval()`
  • `exec()`
  • `pickle.loads()`
โ†’ What Topic Is Next: Module 8 Capstone (Week 22 Lab Build: OWASP LLM Top 10 Guardrails, PII Redactor & Red-Team Suite) โ†’ Next Topic 9.1: FastAPI Fundamentals and Lifespan Architecture for AI Backends

Build `GenAISecurityMiddleware` enforcing prompt length bounds, email/phone/key PII redaction, Markdown XSS/beacon sanitization, `.safetensors`-only loading, Redis daily workspace USD caps, payload-hashed HITL tokens, and a 25-attack red-team `pytest` suite.

โ€ข Clean, type-annotated Python 3.12 source code on GitHub
โ€ข Automated `pytest` test suite covering normal, boundary, and failure paths
โ€ข README documenting architecture, model/embedding choices, and benchmark metrics

Module Learning & Hands-On Objectives

โœ“ Build non-blocking `FastAPI` GenAI services with `lifespan` pools, Pydantic v2 contracts, JWT RBAC, validated uploads, `SSE` token streaming, background workers, PostgreSQL, and Redis.
โœ“ Engineer a provider-independent `LLMGateway` with Circuit Breakers, automatic model fallback, jittered retries, concurrency semaphores, tenant USD budgets, and safe Redis caching.
โœ“ Instrument structured JSON logs, distributed spans (`Query -> Embed -> Retrieve -> Rerank -> LLM -> Tool`), `TTFT`/`ITL` metrics, and admin usage/cost dashboards.
โœ“ Containerize and automate deployment using multi-stage non-root `Docker`, `Docker Compose`, `Nginx` (`proxy_buffering off` for SSE!), `GitHub Actions`, and cloud GPU vs CPU capacity planning.
Guide โ†’

`FastAPI(lifespan=...)` initializing shared `AsyncEngine` (PostgreSQL), `AsyncQdrantClient`, `Redis`, `httpx.AsyncClient`, and warm local reranker/embedding models O...

Subtopics Covered (8):
  • `FastAPI(lifespan=...)` initializing shared `AsyncEngine` (PostgreSQL)
  • `AsyncQdrantClient`
  • `Redis`
โ†’ What Topic Is Next: Next Topic 9.2: Pydantic v2 Request, Response and Error Envelope Models
Guide โ†’

Strict `ConfigDict(extra="forbid")` request DTOs (`ChatRequest`, `IngestResponse`, `ApprovalDecision`), `Field` bounds, and unified `{"error": {"code": ..., "message...

Subtopics Covered (8):
  • Strict `ConfigDict(extra="forbid")` request DTOs (`ChatRequest`
  • `IngestResponse`
  • `ApprovalDecision`)
โ†’ What Topic Is Next: Next Topic 9.3: API Routing, Versioning and Dependency Injection (Depends)
Guide โ†’

Modular `APIRouter(prefix="/api/v1/...")` per bounded domain (`auth`, `workspaces`, `documents`, `rag`, `agents`, `admin`) and `Depends()` injecting `CurrentUser`, `...

Subtopics Covered (8):
  • Modular `APIRouter(prefix="/api/v1/...")` per bounded domain (`auth`
  • `workspaces`
  • `documents`
โ†’ What Topic Is Next: Next Topic 9.4: Async Endpoints vs Event-Loop Blocking Pitfalls
Guide โ†’

Why calling CPU-heavy PDF parsing, local PyTorch CPU embedding, or synchronous SDKs inside `async def` freezes the ENTIRE Uvicorn event loop for all concurrent users...

Subtopics Covered (8):
  • Why calling CPU-heavy PDF parsing
  • Local PyTorch CPU embedding
  • Or synchronous SDKs inside `async def` freezes the ENTIRE Uvicorn event loop for all concurrent users (`asyncio.to_thread` / worker offload!)
โ†’ What Topic Is Next: Next Topic 9.5: Authentication and Workspace RBAC in FastAPI
Guide โ†’

Argon2id password hashing (`pwdlib`), `OAuth2PasswordBearer` / JWT validation, verifying active workspace membership `(user_id, workspace_id, role)`, and enforcing r...

Subtopics Covered (8):
  • Argon2id password hashing (`pwdlib`)
  • `OAuth2PasswordBearer` / JWT validation
  • Verifying active workspace membership `(user_id
โ†’ What Topic Is Next: Next Topic 9.6: Validated Streaming File Uploads to Object Storage
Guide โ†’

Reading `UploadFile` in `64 KB` async chunks (never `await file.read()` on `100 MB` uploads!), checking magic bytes (`%PDF-`, `PK\x03\x04` DOCX), computing `SHA-256`...

Subtopics Covered (8):
  • Reading `UploadFile` in `64 KB` async chunks (never `await file.read()` on `100 MB` uploads!)
  • Checking magic bytes (`%PDF-`
  • `PK\x03\x04` DOCX)
โ†’ What Topic Is Next: Next Topic 9.7: Streaming Responses with Server-Sent Events (SSE)
Guide โ†’

Returning `StreamingResponse(event_generator(), media_type="text/event-stream", headers={"Cache-Control": "no-cache", "X-Accel-Buffering": "no"})` emitting typed `ev...

Subtopics Covered (8):
  • Returning `StreamingResponse(event_generator()
  • Media_type="text/event-stream"
  • Headers={"Cache-Control": "no-cache"
โ†’ What Topic Is Next: Next Topic 9.8: Background Processing for Document Ingestion and Batch Evals
Guide โ†’

When light `BackgroundTasks` suffices (audit webhook) vs durable Redis-backed workers (`Celery` / `ARQ`) with retries, visibility timeouts, and DLQs for heavy PDF in...

Subtopics Covered (8):
  • When light `BackgroundTasks` suffices (audit webhook) vs durable Redis-backed workers (`Celery` / `ARQ`) with retries
  • Visibility timeouts
  • DLQs for heavy PDF ingestion & offline eval runs
โ†’ What Topic Is Next: Next Topic 9.9: Async PostgreSQL + pgvector Database Integration
Guide โ†’

`create_async_engine(..., pool_size=10, max_overflow=20, pool_pre_ping=True)`, `async_sessionmaker(expire_on_commit=False)`, `Alembic` migrations (including `CREATE...

Subtopics Covered (8):
  • `create_async_engine(...
  • Pool_size=10
  • Max_overflow=20
โ†’ What Topic Is Next: Next Topic 9.10: Redis Caching, Rate Windows and Distributed Locks
Guide โ†’

`redis.asyncio` connection pooling for sliding-window rate limits, embedding/retrieval caches, pub/sub job progress, and `SET key token NX EX 30` idempotency locks

Subtopics Covered (8):
  • `redis.asyncio` connection pooling for sliding-window rate limits
  • Embedding/retrieval caches
  • Pub/sub job progress
โ†’ What Topic Is Next: Next Topic 9.11: Model Service Abstraction (LLMGateway)
Guide โ†’

Centralizing ALL model calls (`generate`, `stream`, `generate_structured`, `embed`) behind one internal `LLMGateway` enforcing timeouts, retries, cost accounting, PI...

Subtopics Covered (8):
  • Centralizing ALL model calls (`generate`
  • `stream`
  • `generate_structured`
โ†’ What Topic Is Next: Next Topic 9.12: Provider Fallback and Circuit Breaker Strategies
Guide โ†’

Maintaining primary + secondary model routes (`Primary Hosted API -> Secondary Region / Alternative Provider / Self-Hosted vLLM`), tripping a `CircuitBreaker` (`CLOS...

Subtopics Covered (8):
  • Maintaining primary + secondary model routes (`Primary Hosted API -> Secondary Region / Alternative Provider / Self-Hosted vLLM`)
  • Tripping a `CircuitBreaker` (`CLOSED -> OPEN -> HALF_OPEN`) on sustained `5xx`/`429` spikes so requests fail over in `< 50 ms` instead of waiting `30s` per request!
  • Production Pitfall Guard (Provider Fallback and Circuit Breaker Strategies)
โ†’ What Topic Is Next: Next Topic 9.13: Request Queues and Backpressure
Guide โ†’

Bounding in-flight LLM requests with `BoundedSemaphore`, returning clean `HTTP 429 Retry-After` when queue depth exceeds SLA rather than piling up 5,000 doomed socke...

Subtopics Covered (8):
  • Bounding in-flight LLM requests with `BoundedSemaphore`
  • Returning clean `HTTP 429 Retry-After` when queue depth exceeds SLA rather than piling up 5
  • 000 doomed sockets
โ†’ What Topic Is Next: Next Topic 9.14: Stage-Level Retry and Timeout Engineering
Guide โ†’

Setting explicit per-stage budgets (`query_rewrite: 2.5s`, `vector_search: 0.5s`, `rerank: 0.8s`, `llm_first_token: 6.0s`, `tool_http: 4.0s`) + full-jitter exponenti...

Subtopics Covered (8):
  • Setting explicit per-stage budgets (`query_rewrite: 2.5s`
  • `vector_search: 0.5s`
  • `rerank: 0.8s`
โ†’ What Topic Is Next: Next Topic 9.15: Rate Limits (RPM / TPM) and Concurrency Pacing
Guide โ†’

Understanding dual LLM provider limits (**Requests Per Minute `RPM`** AND **Tokens Per Minute `TPM`**), pre-estimating input + `max_output_tokens`, and pacing bursts...

Subtopics Covered (8):
  • Understanding dual LLM provider limits (**Requests Per Minute `RPM`**
  • **Tokens Per Minute `TPM`**)
  • Pre-estimating input + `max_output_tokens`
โ†’ What Topic Is Next: Next Topic 9.16: Token Accounting and USD Cost Budgets
Guide โ†’

Recording `input_tokens`, `cached_input_tokens`, `output_tokens`, `embedding_tokens`, and computed `cost_usd` per `(tenant_id, user_id, feature, model)` in `ai_usage...

Subtopics Covered (8):
  • Recording `input_tokens`
  • `cached_input_tokens`
  • `output_tokens`
โ†’ What Topic Is Next: Module 9 Capstone โ†’ End-of-Course Live Client Project: Generative AI, LLMs, Production RAG & AI Agents with Python โ€” Enterprise Client Production Platform

Architect, build, secure, evaluate, containerize, and defend a complete production-oriented **Enterprise Multi-Agent AI Knowledge and Business Automation Platform** in Python 3.12 that unifies Multi-Tenant Workspace RBAC, Multi-Format Document Intelligence, Hybrid Reranked Cited RAG, a LangGraph + MCP Multi-Agent Platform with Human-in-the-Loop Approval, and an Enterprise FinOps/Quality Governance Admin Console.

โ€ข Complete Multi-Tenant FastAPI + React UI + LangGraph + MCP Platform Source Code on GitHub
โ€ข System Architecture Diagram + PostgreSQL/Alembic + Qdrant/`pgvector` Schema Design + OpenAPI 3.1 Docs
โ€ข Async PDF/DOCX/TXT/CSV Ingestion + RBAC Hybrid Reranked Cited RAG + Multi-Agent HITL Platform
โ€ข Admin Model/Prompt/Usage/Cost Governance Console + Structured Logs/Tracing/Metrics
โ€ข Automated `pytest` Security/Integration Suite + Golden RAG/Agent Evaluation Report + `Docker Compose` & Live Viva Defense
๐ŸŽ“ Like the 9-Module (146-Topic) Syllabus? Experience It Live First!

Attend Your 1st Weekend Live Class Free With Active Working IT Professionals

Verify your email OTP in 15 seconds to receive the live Zoom/Meet demo link, complete 9-module PDF, and personalized roadmap for Generative AI, LLMs, Production RAG & AI Agents with Python.

๐Ÿ“„ Download Syllabus PDF
Hands-On Industry Stack โ€ข 10 Core Technologies

Technologies, Frameworks & Tools You Will Master

โœ“ Taught Live by Working IT Professionals
Python 3.12 GenAI Engineering Logo

Python 3.12 GenAI Engineering

Core Language
LLMs, Structured Outputs & Tools Logo

LLMs, Structured Outputs & Tools

Data Validation
Qdrant, pgvector & Hybrid RAG Logo

Qdrant, pgvector & Hybrid RAG

Semantic Search
LangGraph Agents & MCP Servers Logo

LangGraph Agents & MCP Servers

Agentic AI
Hugging Face, LoRA & QLoRA Logo

Hugging Face, LoRA & QLoRA

Deep Learning
RAGAS Evals & AI Guardrails Logo

RAGAS Evals & AI Guardrails

App & Cloud Security
Semantic Caching & Token FinOps Logo

Semantic Caching & Token FinOps

In-Memory Cache
Streaming FastAPI & Docker Deploy Logo

Streaming FastAPI & Docker Deploy

High-Speed API
LeetCode Problem Solving Logo

LeetCode Problem Solving

Trainer Coding Prep
HackerRank Coding Prep Logo

HackerRank Coding Prep

Trainer Coding Prep
Course Overview โ€ข Freshers & Working Pros

What You Will Learn & Why It Matters on Real Jobs

๐Ÿ‘จโ€๐Ÿ’ป 100% Working IT Pro Trainers
What Is This Course?

Generative AI, LLMs, Production RAG & AI Agents with Python teaches you how modern tech companies design, build, test, and deploy reliable Generative AI, LLMs, RAG & Agentic AI Engineering software using Python 3.12 & Pydantic v2, OpenAI, Gemini & Open LLMs, Structured Outputs & Tools, Embeddings & Semantic Search, Qdrant & PostgreSQL pgvector โ€” explained in clear everyday language before writing real production code.

Who Should Join?

Suitable for both complete beginners (guided step-by-step from Day 1 setup and core logic) and technical students/working professionals aiming for production architecture mastery.

Key Engineering Capabilities You Will Build:

  • โ€ข Integrate cloud & open-weight LLMs with deterministic Pydantic structured outputs, native tool calling, retries, and token cost budgets.

    Purpose: Directly required by Generative AI, LLMs, RAG & Agentic AI Engineering engineering teams to ship reliable client systems.

  • โ€ข Build grounded Hybrid RAG pipelines (`BM25 + Dense Vector Search + Cross-Encoder Reranking`) over PDFs/docs in Qdrant and `pgvector`.

    Purpose: Directly required by Generative AI, LLMs, RAG & Agentic AI Engineering engineering teams to ship reliable client systems.

  • โ€ข Orchestrate tool-using AI agents, human-in-the-loop checkpoints, and standardized `MCP` servers using `LangGraph`.

    Purpose: Directly required by Generative AI, LLMs, RAG & Agentic AI Engineering engineering teams to ship reliable client systems.

  • โ€ข Quantify faithfulness/hallucinations with automated evaluation harnesses, block prompt injection, and deploy streaming FastAPI GenAI APIs.

    Purpose: Directly required by Generative AI, LLMs, RAG & Agentic AI Engineering engineering teams to ship reliable client systems.

  • โ€ข Automated Testing, Debugging & Quality Gates (Python 3.12 & Pydantic v2, OpenAI, Gemini & Open LLMs, Structured Outputs & Tools, Embeddings & Semantic Search, Qdrant & PostgreSQL pgvector)

    Purpose: Automated Python 3.12 & Pydantic v2, OpenAI, Gemini & Open LLMs, Structured Outputs & Tools, Embeddings & Semantic Search, Qdrant & PostgreSQL pgvector test suites โ€ข Linting & static checks โ€ข Mentor Git pull-request reviews โ€” ensuring your code never breaks silently when real users hit edge cases.

  • โ€ข 100% Topic-Wise Timed Mock Tests, Spoken MockAttempt AI Viva & Live Client Production

    Purpose: Verify every single Generative AI, LLMs, Production RAG & AI Agents with Python topic through timed MCQ exams and spoken technical interviews before deploying your Live Client Project.

Student Learning Outcomes (By End of Course):

Baseline: Python 3.12, Pydantic v2, OpenAI/Gemini SDKs, Hugging Face `transformers`/`peft`, Qdrant, `pgvector`, `LangGraph`, `MCP`, FastAPI & Docker.
  1. 1. Integrate cloud & open-weight LLMs with deterministic Pydantic structured outputs, native tool calling, retries, and token cost budgets.
  2. 2. Build grounded Hybrid RAG pipelines (`BM25 + Dense Vector Search + Cross-Encoder Reranking`) over PDFs/docs in Qdrant and `pgvector`.
  3. 3. Orchestrate tool-using AI agents, human-in-the-loop checkpoints, and standardized `MCP` servers using `LangGraph`.
  4. 4. Quantify faithfulness/hallucinations with automated evaluation harnesses, block prompt injection, and deploy streaming FastAPI GenAI APIs.

Weekend-Only Live Batches

Taught live by active Working IT Professionals between 7:00 AM and 8:00 PM IST (choose any slot based on trainer availability).

Batch Available (Sat โ€“ Sun Only): 2 Hours / Day โ€ข 7:00 AM to 8:00 PM IST (choose any slot based on trainer availability)

Mon โ€“ Fri Guided Practice: Real GitHub repository builds, LeetCode/HackerRank coding & โ‰ฅ90% Mock/AI Interview gates.

BATCH-GAIX-2026 ONGOING

Generative AI, LLMs, Production RAG & AI Agents with Python โ€” Live Cohort

Weekend Live (Satโ€“Sun โ€ข 2h/Day โ€ข 7 AMโ€“8 PM IST) โ€ข 07:00 AM โ€“ 08:00 PM IST Flexible Live Slots

Starts: 21 Nov 2026

Eligibility

Prerequisites

  • โ€ข Solid Python fundamentals (functions, classes, JSON/HTTP APIs โ€” or completion of PYTH).
  • โ€ข No prior Generative AI, LLMs, Production RAG & AI Agents with Python industry experience required โ€” Module 1 starts from environment setup, core mental models, and plain-English fundamentals.
  • โ€ข Basic computer & internet familiarity on a Windows, macOS, or Linux laptop (8 GB+ RAM recommended for smooth live coding labs).
Live Client Production Deployment & Verified Internship Showcase ๐Ÿš€ Live Client Production Project + Internship Letter
End-of-Course Production Deployment

Generative AI, LLMs, Production RAG & AI Agents with Python โ€” Enterprise Client Production Platform

Role: Generative AI, LLMs, Production RAG & AI Agents with Python Engineering Project Intern

After completing all 14 progressive hands-on module projects during live classes, students join our mentor-led Client Production Sprint to build, test, and deploy "Generative AI, LLMs, Production RAG & AI Agents with Python โ€” Enterprise Client Production Platform" to live cloud production โ€” earning an Official Verified Internship Letter detailing their exact technical contributions.

Domain: Live Enterprise Generative AI, LLMs, RAG & Agentic AI Engineering Client Engagement โ€ข Infra: Python 3.12 & Pydantic v2, OpenAI, Gemini & Open LLMs, Structured Outputs & Tools, Embeddings & Semantic Search, Qdrant & PostgreSQL pgvector โ€ข Git CI/CD + Automated Testing + Live HTTPS Cloud Production

Certified on Your Official Internship Confirmation Letter:

  • โœ“ Translated live client functional and non-functional requirements into modular Python 3.12 & Pydantic v2, OpenAI, Gemini & Open LLMs, Structured Outputs & Tools, Embeddings & Semantic Search, Qdrant & PostgreSQL pgvector production architecture.
  • โœ“ Implemented core application modules, input validation, security hardening, and optimized data/state workflows.
  • โœ“ Completed peer Git pull-request code reviews, automated verification suites, and edge-case debugging sprints.
  • โœ“ Deployed the verified build to live client production with monitoring, documentation, and mentor sign-off.
ID: MAA-2026-XXXX QR + BARCODE

1. Graduation Certificate

Certifies GAIX module mastery, Mock/AI Viva scores & GitHub repos.

ID: MAA-INT-XXXX VERIFY 24ร—7 โ†’

2. Client Internship Letter

Employer BGV-verifiable proof of live production deployment contributions.

Industry Career Scope, Annual CTC Packages & Next-Course Job Pathways

Career Scope, Salary Packages & What You Should Learn Next for Better Job Opportunities

See the exact job positions and realistic salary packages unlocked by Generative AI, LLMs, Production RAG & AI Agents with Python, plus which specialized MockAttempt Academy courses to pair next to qualify for higher-paying multi-stack engineering roles.

Direct Job Roles After This Course
๐Ÿ’ผ Generative AI, LLMs, Production RAG & AI Agents with Python Developer ๐Ÿ’ผ Associate Generative AI, LLMs, RAG & Agentic AI Engineering Engineer ๐Ÿ’ผ Software Development Engineer (SDE-1)
Top Hiring Industries & Domains
๐Ÿข Global SaaS & Product Companies ๐Ÿข FinTech & Digital Banking ๐Ÿข Cloud & AI Platforms ๐Ÿข Global Capability Centers (GCCs) ๐Ÿข Enterprise Engineering Consulting
Fresher / Entry-Level (0โ€“1 Yr) โ‚น4.5 โ€“ โ‚น8.5 LPA โ€ข $55Kโ€“$85K Global

Hands-on module projects, topic-wise MCQ mocks, AI interviews & live client internship proof.

Mid-Level Product Engineer (1โ€“3 Yrs) โ‚น9.5 โ€“ โ‚น19.0 LPA โ€ข $85Kโ€“$130K Global

Production architecture, performance tuning & automated testing mastery.

Senior / Multi-Stack Specialist (3โ€“6+ Yrs) โ‚น20.0 โ€“ โ‚น38.0+ LPA โ€ข $130Kโ€“$185K+ Global

Unlocked by combining this course with the recommended next courses below.

What Should You Learn Next โ€” & For Which Job Position?

Recommended Next Courses from Our Catalog to Multiply Your Job Eligibility & CTC

CAREER UPGRADE PATH #1

Full-Lifecycle Generative AI, LLMs, RAG & Agentic AI Engineering Engineer

โ‚น10.0 LPA โ€“ โ‚น24.0 LPA ($85Kโ€“$135K Global)

Why Learn Next (For What Purpose): Pair Generative AI, LLMs, Production RAG & AI Agents with Python with complementary specialist tracks or use your 30-Day 100% Tuition Credit toward our 6-Month Job-Guarantee* Career Program.

Curriculum Governance & E-E-A-T Faculty Review

Architected & Audited by Ravi Shankar Mishra (Founder & Lead Architect, MockAttempt Academy) & Active Production Engineers

Every module, GitHub lab, 50-MCQ assessment, and 4-axis Spoken AI Viva in Generative AI, LLMs, Production RAG & AI Agents with Python is reviewed quarterly against live enterprise hiring bars and taught in clear English on weekends by active Working IT Professionals.

Program Questions

Frequently Asked Questions โ€” Generative AI, LLMs, Production RAG & AI Agents with Python

GAIX is a hands-on engineering course covering Structured LLM Outputs, Tool Calling, Embeddings, Qdrant/pgvector, Hybrid RAG + Reranking, Stateful LangGraph Agents, MCP Servers, LoRA/QLoRA, RAGAS Evaluation, Guardrails, and FastAPI + Docker deployment.

Yes โ€” 100% of your โ‚น4,499 fee credits directly toward GAIP (โ‚น15,000) within 30 days.

โšก Free 1st Live Demo โ€ข All-Inclusive Fees (Incl. 18% GST)

Book Free Live Demo or Reserve Batch Seat

+ Add Background, Location or Questions (Optional)