Welcome to Generative AI for Beginners! This guide walks you through configuring your development environment so you can run all course code samples.
| Requirement | Minimum version |
|---|---|
| Python | 3.10 |
| Node.js (optional, for TypeScript samples) | 18 LTS |
| Git | 2.x |
git clone https://github.com/microsoft/generative-ai-for-beginners.git
cd generative-ai-for-beginners# Create the virtual environment
python -m venv .venv
# Activate on macOS / Linux
source .venv/bin/activate
# Activate on Windows (PowerShell)
.venv\Scripts\Activate.ps1Each lesson folder contains its own requirements.txt. Install globally for all lessons:
pip install -r requirements.txtOr navigate into a specific lesson directory and install only what that lesson needs:
cd 06-text-generation-apps
pip install -r requirements.txtThe course supports three providers. Choose one and follow the corresponding instructions.
- Create an Azure OpenAI resource.
- Deploy a model (e.g.,
gpt-4o). - Copy
.env.copyto.envinside the lesson folder and fill in the values:
AZURE_OPENAI_ENDPOINT=https://<your-resource>.openai.azure.com/
AZURE_OPENAI_API_KEY=<your-api-key>
AZURE_OPENAI_DEPLOYMENT_NAME=<your-deployment-name>
AZURE_OPENAI_API_VERSION=2024-02-01- Generate a GitHub personal access token with
models:readscope. - Add the token to
.env:
GITHUB_TOKEN=<your-github-token>- Create an account at https://platform.openai.com.
- Generate an API key.
- Add it to
.env:
OPENAI_API_KEY=<your-api-key>For TypeScript samples, install dependencies inside the lesson folder:
cd 06-text-generation-apps
npm installFrom the repository root, verify your setup by running:
python src/main.pypytest tests/generative-ai-for-beginners/
├── src/
│ └── main.py # Starter entry-point script
├── docs/
│ └── setup.md # This file – environment setup guide
├── tests/
│ └── test_main.py # Placeholder unit tests
├── 00-course-setup/ # Lesson 0: development environment guide
├── 01-introduction-to-genai/
│ └── ... # Lessons 1-21 follow the same pattern
├── .env.copy # Template for environment variables
├── .gitignore
└── README.md
| Symptom | Fix |
|---|---|
ModuleNotFoundError when importing openai |
Activate the virtual environment and run pip install -r requirements.txt |
AuthenticationError from the API |
Double-check the API key in your .env file |
pytest: command not found |
Install pytest: pip install pytest |
For further help, join the Azure AI Foundry Discord or open an issue on GitHub.