One company, one topic: leave at DDS. See how a PDF becomes chunks, how chunks become vectors, how a question finds its answer, and what each choice costs. Every lab on this page runs in your browser.
Click a step. The dashed step is the optional move from memory to a hosted vector database (Pinecone, notebook Day 2B, take-home).
Change a setting and watch what happens. Labs marked "toy" use a simplified model so the idea is visible. They never pretend to be a real model.
The real DDS Leave Policy v2 text (about 11,000 characters). The amber band is the notice table in section 3.4 (7, 14 and 30 days). If a chunk boundary cuts through it, the bot may read only part of the table.
A question is compared with every chunk. The best top_k chunks go to the model. This toy retriever uses keywords plus a few synonyms so you can see the ranking. Real OpenAI embeddings understand meaning far better.
An embedding is a list of numbers. The number of numbers is the dimension. The vector database index must use the same dimension as the embedding model.
An agent reads the question, picks the tool, reads the result and writes the answer. Employee data below is real, from dds_leave.db. The reply text is a simulation of what DecoBot is told to say, not a live OpenAI call.
Five problems every enterprise RAG meets. Pick one, read the failure, then switch the fix on. The retrieved chunks are scripted from the real DDS policy so you can see the idea without an API key. The notebook (Day 2, Part E) runs the real thing.
Model list and prices checked on 27 Nov 2026 for AI Accelerator Bootcamp 9. Prices are US dollars per 1 million tokens, standard tier. Models and prices change often, so confirm on the provider page before you budget.
The model the notebooks were built and tested with. $0.75 in, $4.50 out. Cheaper newer option: gpt-6-luna at $0.10 in, $0.50 out.
Stable Flash model. $0.75 in, $3.75 out until 31 Dec 2026, then $1.50 and $7.50. The newest family is gemini-4-argon.
text-embedding-3-small ($0.02) for OpenAI, gemini-embedding-001 ($0.15) for Gemini. Never mix them in one index: the vector sizes differ.
OpenAI notebooks (Step 3 / setup cell) MODEL = "gpt-5.4-mini" # class default MODEL = "gpt-6-luna" # cheapest current option MODEL = "gpt-6.2-sol" # stronger, for the hard SQL questions EMBED_MODEL = "text-embedding-3-small" Gemini notebooks (setup cell) MODEL = "gemini-3.8-flash" # class default MODEL = "gemini-4-argon" # newest family MODEL = "gemini-3.5-flash-lite" # cheapest stable EMBED_MODEL = "gemini-embedding-001"
Pick an OpenAI or Gemini model, a price window and the usage. Prices are US dollars per 1 million tokens, checked on 27 Nov 2026, and every price box is editable. This is a planning estimate, not an invoice.
input tokens = calls x (system 330 + tools 400 + question 30)
+ top_k x chunk tokens + tool output 150 x (calls - 1)
output tokens = answer 120 + 40 x (calls - 1)
cost / question = input x in-price + output x out-price
embedding (one time) = chunks x chunk tokens x embedding price / 1M
vector storage = vectors x dimensions x 4 bytes
Documents hold rules. The database holds personal numbers. All data is synthetic, made for training.
One row per person, with leave balances already computed from the requests.
One row per request. Links to employees by employee_id. One employee has 1 to 5 requests.
leave_requests.employee_id points to employees.employee_id. The same key joins the tables in SQL.
Duplicate employee ids. End before start. Requests for unknown employees. Zero or negative working days. Remaining days that do not add up.
6 requests are dated after the simulated today (2026-11-29). 9 approved requests overlap an earlier one for the same person. Synthetic data, so we note it.
Working days are Monday to Friday, no public holidays removed. Approved and started by 29 Nov 2026 means used. Approved and later means booked. Pending, Rejected and Cancelled do not count.
Teach in Colab. Publish on Hugging Face Spaces. Render is the optional second home.
app.py, requirements.txt, and the data folder (PDF and database).OPENAI_API_KEY and PINECONE_API_KEY.render.yaml).pip install -r requirements.txt. Start: python app.py.from pinecone import Pinecone
from llama_index.core import VectorStoreIndex
from llama_index.vector_stores.pinecone import PineconeVectorStore
pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"])
store = PineconeVectorStore(pinecone_index=pc.Index("dds-leave-policy-nov26"))
index = VectorStoreIndex.from_vector_store(store) # no embedding at start-up
policy_engine = index.as_query_engine(similarity_top_k=3, text_qa_template=qa_prompt)Clarity Canvas (user, latest policy, owner), system prompt, the latest-policy experiment, clear questions, Prompt Clinic.
Embeddings, RAG with LlamaIndex, chunking lab, and five RAG failure modes with fixes. Optional take-home: Day 2B puts the same index in Pinecone.
SQL, three read-only tools, a FunctionAgent, five scenes, bad tool descriptions.
| File | Use |
|---|---|
| Day1_System_Prompt_and_Clarity.ipynb | Colab, no files |
| DecoBot_Prompt_Lab.html | Browser playbook, no key. Clarity Canvas, prompt and tool descriptions, scored out of 50 |
| DecoBot_RAG_Playbook.html | Browser playbook, no key. Chunking playground, latest-policy lab, failure clinic, knowledge ops |
| Day2_RAG_and_Chunking.ipynb | Colab, upload the PDF. Index in memory |
| Day2B_RAG_with_Pinecone.ipynb | OPTIONAL take-home, not taught in class. Same index in Pinecone. Needs OPENAI_API_KEY and PINECONE_API_KEY |
| Day3_SQL_Tools_and_Agent.ipynb | Colab, upload the PDF and dds_leave.db |
| DDS_Leave_Policy_v2.pdf | The policy, DDS-HR-POL-001 v2.0, effective 1 July 2026 |
| dds_leave.db / build_database.py | The database and the script that rebuilds it |
| Day1, Day2, Day3 decks and the 3-slide overview | 17, 18, 17 and 3 slides, click animation on every box |
The OpenAI and Pinecone calls were not run end to end by the builder. Run each notebook once with your own keys before class, especially the new failure modes lab in Day 2.
The policy does not define the probation period (the handbook only says "as stated in the employment contract"). Section 1 points to 4.4 for extended illness, but the content is in 5.4.
A prompt that says "refuse other people's data" is not security. A real site needs company login and tools locked to the signed-in employee.
Model prices change. The calculator is a planning tool, not an invoice. Check the OpenAI pricing page before you budget.