> ## Documentation Index
> Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Train

> Model training and fine-tuning

The `train` command enables model training and fine-tuning capabilities.

## Requirements

<Note>
  Training dependencies are checked at startup via `unsloth` package availability but only fully loaded when training commands run.
</Note>

**Install training dependencies:**

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai train training_data.jsonl
```

### Train with specific model

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai train data.jsonl --model gpt-4o
```

## Agent Training

Train agents through iterative feedback loops with the `train agents` subcommand.

### Usage

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# 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:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# 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

* [Eval](/docs/cli/eval) - Evaluation and testing
* [Storage Backends](/docs/storage/backends) - Pluggable storage backends
