Standards for creating consistent, discoverable examples in the red-hat-ai-examples repository.
- Use lowercase with hyphens:
knowledge-tuning,model-compression - For multi-module examples, use numbered prefixes:
00_Setup,01_Processing
| Type | Convention | Example |
|---|---|---|
| Notebooks | Descriptive with underscores | Base_Model_Evaluation.ipynb |
| Python scripts | snake_case | knowledge_generation_pipeline.py |
| Module READMEs | {Module_Name}_README.md |
01_Base_Model_Evaluation_README.md |
| Metadata | Always example.yaml |
example.yaml |
- Spaces in filenames
- Generic names (
test.ipynb,example.py,temp.py) - camelCase for Python files
Every example MUST have:
example.yaml- Metadata fileREADME.md- Documentationpyproject.toml- Dependencies (if required).env.example- Environment template (if env vars needed)
Simple Example:
examples/llmcompressor/
├── example.yaml
├── README.md
├── workbench_example.ipynb
├── pyproject.toml
└── .env.example
Multi-Module Example:
examples/knowledge-tuning/
├── example.yaml
├── README.md
├── .env.example
├── 00_Setup/
│ ├── 00_Setup_README.md
│ ├── Setup.ipynb
│ └── pyproject.toml
├── 01_Base_Model_Evaluation/
│ └── ...
- Title - Clear, descriptive (matches
metadata.title) - Overview - What, why, and key technologies (2-3 paragraphs)
- Prerequisites - RHOAI version, hardware, credentials, prior knowledge
- Setup - Step-by-step environment preparation
- Usage - How to run the example
- Expected Outcomes - What success looks like
- Hardware Requirements - Minimum and recommended specs
- Troubleshooting
- References
Required sections:
- Title
- Navigation (previous/next links)
- Overview
- Prerequisites
- Procedure
- Verification
- Next Steps
- Title and Description (Markdown) - Name, purpose, prerequisites
- Imports (Code) - All imports in one cell with
load_dotenv()
- Group code into logical sections with Markdown headers
- Keep cells focused on single tasks
- Add explanatory text before complex code
- Clear outputs before committing (handled by
nbstripout)
Add keep_output tag only for:
- Final evaluation metrics
- Important visualizations
- Summary tables
# Model Configuration
STUDENT_MODEL_NAME=RedHatAI/Llama-3.1-8B-Instruct
# API Configuration (required)
# HF_TOKEN=your_token_here
# Training Configuration
NUM_EPOCHS=3
BATCH_SIZE=8- Group related variables with comments
- Comment out sensitive variables (tokens, keys)
- Provide safe defaults where possible
- Never commit actual
.envfiles