Before the session · Give to learners

Setup Guide

Get your laptop ready for the hands-on session: Python, libraries, API key, and a one-click check.

For learners20–30 minutesDo this before class

Do this before the session (about 20–30 minutes, mostly waiting for downloads). At the end, one script tells you whether everything works. If it says All good, you are ready.

1. Install Python

You need Python 3.11, 3.12 or 3.13. Check what you have:

Terminal
python --version      # on Mac/Linux you may need: python3 --version

If it is missing or older, install it from python.org/downloads. On Windows, tick "Add Python to PATH" during install.

2. Open a terminal in the main folder

Unzip the folder you received. The main folder is the one that contains 11-rag-setup and the RAG module folders (12-rag-... to 15-rag-...), that is 00-basics. Open a terminal there (VS Code: File → Open Folder, then Terminal → New Terminal).

3. Create a virtual environment and install the libraries

A virtual environment is a private box of libraries for this course, so it does not disturb other Python projects.

Windows
python -m venv .venv
.venv\Scripts\activate
pip install -r 11-rag-setup/requirements.txt
Mac / Linux
python3 -m venv .venv
source .venv/bin/activate
pip install -r 11-rag-setup/requirements.txt

You will see (.venv) at the start of the terminal line when it is active. The install takes 5–15 minutes (it downloads PyTorch for the local models).

Every time you open a new terminal

Activate the environment again (the second line above) before running any file.

4. Add your OpenAI API key

  1. Create a key at platform.openai.com/api-keys (your account needs a small amount of credit; the whole course costs a few rupees).
  2. Make a copy of the template, named .env, in the main folder:
Windows
copy 11-rag-setup\env_template.txt .env
Mac / Linux
cp 11-rag-setup/env_template.txt .env
  1. Open .env in VS Code or Notepad and replace sk-paste-your-key-here with your key. Save.
Keep your key secret

Never paste your key into code, screenshots, WhatsApp or GitHub. The .env file keeps it out of your code.

5. Run the setup check

Terminal (main folder, environment active)
python 11-rag-setup/check_setup.py
What success looks like
Python 3.12.4

1) Libraries
  [OK]   openai
  [OK]   langchain_core
  ...
2) Free local models (the first time this takes a few minutes)
  [OK]   all-MiniLM-L6-v2 (sentence embeddings)
  [OK]   ms-marco-MiniLM-L6-v2 (reranker)
  [OK]   glove-wiki-gigaword-50 (word vectors)

3) OpenAI API key
  [OK]   chat model gpt-6-luna replied: 'OK'
  [OK]   embedding model text-embedding-3-small returned 1536 numbers

All good. You are ready for the session!

6. How to run the exercise files

File typeHow to run
.ipynb (notebook)In VS Code: open the file, click Select Kernel (top right) and pick .venv, then run the cells one by one (Shift+Enter).
Or in the terminal: jupyter notebook and open the file in the browser.
.py (script)Go into its folder and run it, for example:
cd 14-rag-tool-calling-basics/1_GIVE_FIRST_Starter_Code
python 1_tool_calling_from_scratch.py
.py with a web page (Gradio)Run it the same way, then open http://127.0.0.1:7860 in your browser. Press Ctrl+C in the terminal to stop it before starting the next app.

Problems?

You seeFix
'python' is not recognizedReinstall Python with "Add Python to PATH" ticked, or use py instead of python on Windows.
... cannot be loaded because running scripts is disabled (Windows PowerShell)Run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once, then activate again. Or use the Command Prompt instead of PowerShell.
ModuleNotFoundError in a notebook, but check_setup passesThe notebook is using a different Python. Select the .venv kernel.
OPENAI_API_KEY not foundThe file must be named exactly .env (not .env.txt) and sit in the main folder.
401 Incorrect API key / insufficient_quotaCheck the key, or add credit to your OpenAI account.
Model downloads fail on office or college Wi-FiSome networks block model downloads. Try a mobile hotspot once; after that the models are saved on your laptop.