The train command enables model training and fine-tuning capabilities.
Requirements
Training dependencies are checked at startup via unsloth package availability but only fully loaded when training commands run.
Install training dependencies:
pip install "praisonai[train]"
If training dependencies are missing, you’ll see:
ERROR: Training dependencies not installed. Install with:
pip install "praisonai[train]"
Or run: praisonai train init
Usage
praisonai train [OPTIONS] [DATASET]
Arguments
| Argument | Description |
|---|
DATASET | Training dataset path |
Options
| Option | Short | Description | Default |
|---|
--model | -m | Base model to fine-tune | gpt-4o-mini |
--verbose | -v | Verbose output | false |
Examples
Train with dataset
praisonai train training_data.jsonl
Train with specific model
praisonai train data.jsonl --model gpt-4o
Agent Training
Train agents through iterative feedback loops with the train agents subcommand.
Usage
praisonai train agents [OPTIONS] [AGENT_FILE]
Options
| Option | Short | Description | Default |
|---|
--iterations | -n | Number of training iterations | 3 |
--human | -h | Use human feedback instead of LLM grading | false |
--scenarios | -s | Path to scenarios JSON file | - |
--input | -i | Single input text for training | - |
--expected | -e | Expected output for the input | - |
--output | -o | Output directory for training data | - |
--model | -m | LLM model for grading | gpt-4o-mini |
--storage-backend | - | Storage backend: file, sqlite, or redis://url | file |
--storage-path | - | Path for storage backend | - |
Examples
# Simple training with single input
praisonai train agents --input "What is Python?"
# Training with expected output
praisonai train agents --input "What is 2+2?" --expected "4"
# Training with scenarios file
praisonai train agents --scenarios scenarios.json
# Human feedback mode
praisonai train agents --input "Explain AI" --human
# More iterations
praisonai train agents --input "Hello" --iterations 5
# With agent file
praisonai train agents my_agent.yaml --scenarios scenarios.json
Storage Backend Options
Store training data in different backends:
# SQLite backend (recommended for production)
praisonai train agents --input "Hello" --storage-backend sqlite --storage-path ~/.praisonai/train.db
# Redis backend (for distributed systems)
praisonai train agents --input "Hello" --storage-backend redis://localhost:6379
# File backend (default)
praisonai train agents --input "Hello" --storage-backend file --storage-path ~/.praisonai/train
See Also