Metadata-Version: 2.5
Name: veri-sdk
Version: 0.2.44
Summary: Python SDK + CLI for Veri — the AI compute platform: training and serving on demand
Project-URL: Homepage, https://veri.studio
Project-URL: Documentation, https://docs.veri.studio
License-Expression: MIT
Requires-Python: >=3.10
Requires-Dist: click<9,>=8
Requires-Dist: httpx>=0.27
Requires-Dist: platformdirs>=4
Requires-Dist: rich>=13
Requires-Dist: tomlkit>=0.13
Requires-Dist: typer<0.26,>=0.20.1
Provides-Extra: all
Requires-Dist: mcp<2,>=1.22; extra == 'all'
Requires-Dist: pyyaml<7,>=6; extra == 'all'
Requires-Dist: starlette>=0.27; extra == 'all'
Requires-Dist: textual>=0.80; extra == 'all'
Requires-Dist: uvicorn>=0.31.1; extra == 'all'
Requires-Dist: websockets<18,>=14.1; extra == 'all'
Provides-Extra: attach
Requires-Dist: websockets<18,>=14.1; extra == 'attach'
Provides-Extra: dev
Requires-Dist: mcp<2,>=1.22; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: pyyaml<7,>=6; extra == 'dev'
Requires-Dist: respx>=0.21; extra == 'dev'
Requires-Dist: websockets<18,>=14.1; extra == 'dev'
Provides-Extra: mcp
Requires-Dist: mcp<2,>=1.22; extra == 'mcp'
Requires-Dist: starlette>=0.27; extra == 'mcp'
Requires-Dist: uvicorn>=0.31.1; extra == 'mcp'
Provides-Extra: tui
Requires-Dist: textual>=0.80; extra == 'tui'
Provides-Extra: yaml
Requires-Dist: pyyaml<7,>=6; extra == 'yaml'
Description-Content-Type: text/markdown

# veri-sdk

Python SDK for [Veri](https://veri.studio) — RL post-training platform.

## Install

```bash
uv pip install veri-sdk
# or
pip install veri-sdk
```

Optional extras, for the commands that need more than the core install:

| Extra | Adds | For |
| --- | --- | --- |
| `veri-sdk[mcp]` | the MCP SDK | `veri mcp serve`, `veri mcp serve-http` |
| `veri-sdk[attach]` | websockets | `veri sessions attach` |
| `veri-sdk[yaml]` | PyYAML | `veri evaluators create --file spec.yaml` |
| `veri-sdk[all]` | every extra | keeping them all across reinstalls |

```bash
uv tool install --upgrade 'veri-sdk[mcp]'   # the CLI as a uv tool
pipx install --force 'veri-sdk[mcp]'        # the CLI with pipx
pip install 'veri-sdk[mcp]'                 # into a Python 3.10+ venv
```

A uv tool or pipx install keeps only the extras named on the latest install:
installing `'veri-sdk[attach]'` alone removes `[mcp]`. Name them together
(`'veri-sdk[mcp,attach]'`) or install `'veri-sdk[all]'`. `veri doctor` reports
whether the `mcp` extra imports.

## Quickstart

```python
from veri_sdk import Client

client = Client(api_key="your-api-key", base_url="https://api.veri.studio")

# Upload a dataset
dataset = client.datasets.upload("training_data.jsonl", name="my-dataset")

# Start a GRPO training job — the reward Python source is attached to the
# job inline (rewards are not stored as a resource)
job = client.training_jobs.create(
    base_model="Qwen/Qwen3-4B",
    dataset_id=dataset.id,
    reward_source=open("reward.py").read(),
    output_name="my-fine-tuned-model",
    hyperparameters={
        "learning_rate": 1e-6,
        "max_steps": 100,
        "rollouts_per_prompt": 4,
        "max_response_length": 512,
    },
)

print(f"Job {job.id} — status: {job.status}")

# Wait for completion
job.wait(poll_interval=15)
print(f"Done! Status: {job.status}")

# Download checkpoint
if job.download_url:
    job.download("./checkpoints")
```

## Data Sources

```python
# Upload JSONL file
dataset = client.datasets.upload("data.jsonl")

# Connect to S3
dataset = client.datasets.connect(
    name="my-s3-data",
    source_type="s3",
    source_uri="s3://my-bucket/data.jsonl",
    credentials={"aws_access_key_id": "...", "aws_secret_access_key": "..."},
)

# Connect to HuggingFace
dataset = client.datasets.connect(
    name="gsm8k",
    source_type="hf",
    hf_dataset="gsm8k",
    hf_config={"split": "train", "column_mapping": {"question": "prompt"}},
)

# Connect to a database
dataset = client.datasets.connect(
    name="prod-prompts",
    source_type="postgres",
    db_connection="postgres://user:pass@host/db",
    db_query="SELECT prompt, answer FROM training_data",
)

# Validate before connecting
result = client.datasets.validate(
    source_type="hf", hf_dataset="gsm8k", hf_config={"split": "train"}
)
print(f"Valid: {result['valid']}, Rows: {result['num_rows']}")
```

## GPU Selection

```python
# Specify the GPU config explicitly.
job = client.training_jobs.create(
    base_model="Qwen/Qwen3-4B",
    gpu_type="A100-80GB",
    gpu_count=2,
    ...
)
```

## Checkpoint Destination

Checkpoints are always stored in Veri storage; any other `checkpoint_destination`
is rejected at submit. Download the weights or push them to Hugging Face:

```python
job = client.training_jobs.create(...)
job.wait()
job.download("./checkpoints")
```

## List & Manage

```python
# List your datasets
datasets = client.datasets.list()

# List jobs by status
running_jobs = client.training_jobs.list(status="running")

# Cancel a job
client.training_jobs.cancel(job.id)
```
