This directory contains Python script versions of the tutorial notebooks, suitable for running directly or studying the code.
| File | Description |
|---|---|
example.py |
General introduction to Mellea with basic examples. |
simple_email.py |
Email generation example - the classic "Hello World" of Mellea. |
instruct_validate_repair.py |
Walkthrough of the instruct-validate-repair paradigm. |
compositionality_with_generative_stubs.py |
Tutorial on composing generative functions. |
context_example.py |
Working with contexts and context management. |
document_mobject.py |
Using document MObjects for text processing. |
table_mobject.py |
Working with table data structures. |
model_options_example.py |
Configuring model options and parameters. |
sentiment_classifier.py |
Building a sentiment classification system. |
Recommended order for learning Mellea:
- simple_email.py - Start here for basic concepts
- instruct_validate_repair.py - Core paradigm
- compositionality_with_generative_stubs.py - Building blocks
- context_example.py - Context management
- model_options_example.py - Configuration
- sentiment_classifier.py - Complete application
- document_mobject.py - Working with documents
- table_mobject.py - Working with structured data
To convert a script to a notebook:
# Install jupytext
uv pip install jupytext
# Convert
jupytext --to notebook docs/examples/tutorial/simple_email.py../notebooks/— Interactive Jupyter notebook versions of these tutorials- Tutorial: Your First Generative Program — Step-by-step written guide