Run Generation Pipeline
Runs the full question generation pipeline locally using run_generation.py.
Usage
code
/run-generation [--type <type>] [--difficulty <difficulty>] [--count <n>] [--dry-run]
Arguments
| Argument | Required | Default | Description |
|---|---|---|---|
--type | No | all | Question type: math, logic, pattern, spatial, verbal, memory |
--difficulty | No | all | Difficulty level: easy, medium, hard |
--count | No | 50 | Number of questions to generate |
--dry-run | No | false | Generate and evaluate but don't insert to database |
Implementation
Step 1: Parse Arguments
Extract the optional arguments from the user's input:
- •
--type <type>or-t <type>- maps to--types <type> - •
--difficulty <difficulty>or-d <difficulty>- maps to--difficulties <difficulty> - •
--count <n>or-c <n>- maps to--count <n> - •
--dry-run- adds--dry-runflag
Validate:
- •Type must be one of:
math,logic,pattern,spatial,verbal,memory - •Difficulty must be one of:
easy,medium,hard - •Count must be a positive integer
Step 2: Build Command
Construct the command with only the specified arguments:
bash
cd /Users/mattgioe/aiq/question-service && source venv/bin/activate && export $(grep -v '^#' .env | xargs) && python run_generation.py --async --async-judge --verbose [additional args based on input]
Examples:
No arguments (generate all types/difficulties):
bash
cd /Users/mattgioe/aiq/question-service && source venv/bin/activate && export $(grep -v '^#' .env | xargs) && python run_generation.py --count 50 --async --async-judge --verbose
With type only:
bash
cd /Users/mattgioe/aiq/question-service && source venv/bin/activate && export $(grep -v '^#' .env | xargs) && python run_generation.py --types math --count 50 --async --async-judge --verbose
With difficulty only:
bash
cd /Users/mattgioe/aiq/question-service && source venv/bin/activate && export $(grep -v '^#' .env | xargs) && python run_generation.py --difficulties hard --count 50 --async --async-judge --verbose
With both:
bash
cd /Users/mattgioe/aiq/question-service && source venv/bin/activate && export $(grep -v '^#' .env | xargs) && python run_generation.py --types spatial --difficulties easy --count 50 --async --async-judge --verbose
Dry run:
bash
cd /Users/mattgioe/aiq/question-service && source venv/bin/activate && export $(grep -v '^#' .env | xargs) && python run_generation.py --types math --count 10 --async --async-judge --verbose --dry-run
Step 3: Run and Report
Execute the command and report results including:
- •Number of questions generated
- •Number approved by judge
- •Number unique after deduplication
- •Number inserted to database
- •Approval rate
Exit Codes
| Code | Meaning | Action |
|---|---|---|
| 0 | Success | All questions generated and inserted |
| 1 | Partial failure | Some questions failed - check logs |
| 2 | Complete failure | No questions generated - check API keys/quotas |
| 3 | Config error | Missing or invalid environment variables |
| 4 | Database error | Cannot connect to database |
Examples
code
/run-generation
Generate 50 questions of all types and difficulties.
code
/run-generation --type math
Generate 50 math questions at all difficulty levels.
code
/run-generation --difficulty hard
Generate 50 hard questions of all types.
code
/run-generation --type pattern --difficulty easy --count 20
Generate 20 easy pattern questions.
code
/run-generation --type spatial --count 30 --dry-run
Generate 30 spatial questions without inserting to database (for testing).
Requirements
- •
question-service/.envmust contain valid API keys (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.) - •
question-service/venvmust be set up with dependencies installed - •
DATABASE_URLmust be configured in.env