Course materials and code examples for learning about RAG (Retrieval Augmented Generation) and LLM fundamentals.
- Python 3.9 or higher
- Poetry for dependency management
- Azure OpenAI API access (or OpenAI API)
- Clone this repository:
git clone https://github.com/drdk/CUNY_course.git
cd CUNY_course- Install dependencies using Poetry:
poetry install- Set up your environment variables in a
.envfile:
# For Azure OpenAI
AZURE_OPENAI_ENDPOINT=your_endpoint_here
AZURE_OPENAI_API_KEY=your_key_here
AZURE_OPENAI_DEPLOYMENT=your_deployment_name
# Or for OpenAI
OPENAI_API_KEY=your_key_hereRun Python scripts directly:
poetry run python CUNY_course/example_code/structured_output.py
poetry run python CUNY_course/example_code/format_errror.pyOr activate the virtual environment first:
poetry shell
python CUNY_course/example_code/structured_output.pyStart Jupyter:
poetry run jupyter notebookCUNY_course/
├── CUNY_course/
│ ├── example_code/ # Python code examples
│ │ ├── structured_output.py
│ │ └── format_errror.py
│ ├── example_data/ # Sample data files
│ │ ├── 10languages.txt
│ │ ├── usconstitution.txt
│ │ └── ...
│ ├── data_types/ # Pydantic models and schemas
│ │ └── person.py
│ ├── outline.md # Course outline
│ └── links.md # Useful links and resources
├── pyproject.toml # Poetry dependencies
└── README.md # This file
structured_output.py- Demonstrates how to extract structured data from text using LLMs with Pydantic modelsformat_errror.py- Simple example showing Python data structuresperson.py- Pydantic models for representing people and relationshipsoutline.md- Full course outline with lecture topicsexample_data/- Various text files for experimentation
poetry run black .poetry run pytest- See outline.md for the full course outline and lecture structure
- See links.md for useful tools and resources
See the LICENSE file for details.