2 min read · 328 wordsservicesairag
Module 3: Services Deep Dive
Overview
Module 2 gave you the map; this module is the territory. Every one of the five services gets a dedicated, line-by-line lesson — including the two that a prior draft of this course left completely uncovered: document_service.py (chunking, embeddings, ChromaDB writes) and rag_graph_service.py (the one real LangGraph StateGraph in this codebase).
What You'll Learn
- Every function in
openai_service.py: chat completion, email analysis, RAG answers, retrieval evaluation - The token/cost estimation math behind every
ToolCallrow - The three-agent email pipeline: analysis → reply → review, and how it differs from a LangGraph workflow
- The character-based chunking algorithm, embedding calls, and ChromaDB writes behind document ingestion
- The Corrective RAG
StateGraph: four nodes, one conditional edge, and why the branch exists at all
Prerequisites
- Module 2: Data Layer — services consume the models and schemas from that module directly
Lessons in This Module
| # | Lesson | What it covers |
|---|---|---|
| 08a | OpenAI Service | Chat, email analysis, RAG answers, retrieval evaluation |
| 08b | Monitoring Service | Token estimation and cost calculation |
| 08c | Multi-Agent Email | The three-agent sequential pipeline |
| 08d | Document Service | Chunking, embeddings, ChromaDB writes |
| 08e | RAG Graph Service | The one real LangGraph StateGraph, node by node |
Learning Outcomes
By the end of this module you can:
- List all six system prompts in this codebase and which ones expect JSON back
- Explain the character-based chunking algorithm's overlap math by hand
- Draw the Corrective RAG graph from memory: nodes, edges, and the one conditional branch
- State precisely why the email workflow is not LangGraph, and what the actual difference is in code