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

> ## Agent Instructions
> Choose User guide for browser tasks, Developers for CLI, SDK and external agents, and Administration for organization management.
> Confirm identity and organization/project context before operations. Documentation access does not grant ThinkPlatform permissions.
> Review side effects, verify changes with a read, and do not blindly retry an operation with an uncertain outcome.
> Use documented UI steps for the web app and documented public CLI or SDK interfaces for automation. Follow each page’s prerequisites and authentication requirements.

# MLOps commands

> Manage datasets, training bundles, jobs, models, and inference deployments.

These examples assume an authenticated active saved profile with the intended organization and project. Confirm it with `tp context show` before running commands. Add root `--json` before the command when machine parsing needs JSON output; use root `--profile <name>` only to override the active profile.

## Check context and available resources

```bash theme={"system"}
tp auth whoami
tp context show
tp mlops data list
tp mlops models list
tp mlops jobs list
tp mlops computes list
tp mlops environments list
tp mlops cloud list
```

## Data assets

```bash theme={"system"}
tp mlops data datastores
tp mlops data next-version <short_dataset_name>
tp mlops data upload-dir --name <short_dataset_name> --version v001 --local-dir ./dataset --datastore datalake --upload-mode sas --dry-run
tp mlops data upload-dir --name <short_dataset_name> --version v001 --local-dir ./dataset --datastore datalake --upload-mode sas
tp mlops data register --name <dataset_name> --version <version> --base-path <path_or_uri> --dry-run
tp mlops data versions <dataset_name>
tp mlops data files <dataset_name> <version>
```

Use a short logical name for new datasets. The API may return an org/project-prefixed `assetName`; use that returned name for `versions`, `files`, and training commands.

## Bundles

```bash theme={"system"}
tp mlops bundles validate \
  --dir ./bundle \
  --dataset-name <dataset_name> \
  --dataset-version <version> \
  --environment-name tp-bundle-cpu-general \
  --compute-name cpu-batch-cluster \
  --local-smoke \
  --local-dataset-dir ./dataset

tp mlops bundles upload --dir ./bundle --version v001 --dry-run
tp mlops bundles upload --dir ./bundle --version v001

tp mlops bundles submit \
  --bundle-name <bundle_name> \
  --bundle-version v001 \
  --model-name <model_name> \
  --dataset-name <dataset_name> \
  --dataset-version <version> \
  --environment-name tp-bundle-cpu-general \
  --compute-name cpu-batch-cluster \
  --parameters '{"max_train_rows":5000}' \
  --timeout-seconds 180
```

Bundle basics:

* Include entrypoint/training code, dependency metadata, and output contract expected by ThinkPlatform.
* `training-bundle.yaml` must include `schema_version`, `name`, and `entry.command`.
* Declare a `dataset_contract` with required files when the bundle expects a dataset organized as a directory.
* Write metrics and model outputs where ThinkPlatform registration can find them.
* Always write scalar evaluation metrics to `TP_ARTIFACTS_OUTPUT_DIR/metrics.json`.
* Use MLflow metric logging in training code when available so `tp mlops jobs metrics <job_id>` and the run UI can return scalar metrics.
* Validate locally before starting a cloud job when possible.

Recommended training code pattern:

```python theme={"system"}
import json
import os
from pathlib import Path

metrics = {
    "rows": float(len(test_rows)),
    "mae": mae,
    "rmse": rmse,
    "baseline_mae": baseline_mae,
    "business_lift": business_lift,
}

artifacts_dir = Path(os.environ.get("TP_ARTIFACTS_OUTPUT_DIR", "outputs/artifacts"))
artifacts_dir.mkdir(parents=True, exist_ok=True)
(artifacts_dir / "metrics.json").write_text(json.dumps(metrics, indent=2), encoding="utf-8")

try:
    import mlflow

    mlflow.log_metrics({key: float(value) for key, value in metrics.items()})
except Exception as exc:
    print(f"warning: failed to log mlflow metrics: {exc}")
```

Metric completion check:

```bash theme={"system"}
tp mlops jobs wait <job_id> --timeout-seconds 900
tp mlops jobs metrics <job_id>
```

If `jobs metrics` returns `{}` or the UI says no metrics are available, update the bundle to log metrics and rerun training. A `Completed` job without metrics is not a complete model validation.

## Training

```bash theme={"system"}
tp mlops train submit \
  --model-name <model_name> \
  --architecture-name <architecture_or_bundle> \
  --dataset-name <dataset_name> \
  --dataset-version <version> \
  --dry-run

tp mlops train submit \
  --model-name <model_name> \
  --architecture-name <architecture_or_bundle> \
  --dataset-name <dataset_name> \
  --dataset-version <version>

tp mlops jobs wait <job_id> --timeout-seconds 600
tp mlops jobs get <job_id>
tp mlops jobs metrics <job_id>
tp mlops jobs logs <job_id>
```

After every training job, capture at least the primary metric, baseline metric, business metric, and row count from `tp mlops jobs metrics <job_id>` in the user-facing report.

## Models

```bash theme={"system"}
tp mlops models list
tp mlops models versions <model_name>
tp mlops models validate-online --model-name <model_name> --model-version <version> --payload-file ./sample.json
tp mlops models upload-dir --name <model_name> --version v001 --local-dir ./model-package --model-type custom_model --upload-mode sas --dry-run
tp mlops models upload-dir --name <model_name> --local-dir ./model-package --model-type triton_model --dry-run
```

Model artifact upload and model registry promotion are separate operational checks. If `upload-dir` uploads files but registration fails, inspect the uploaded Data Lake path and retry `tp mlops models register --name <model_name> --version <version> --base-path <uploaded_prefix> --model-type <model_type>` to isolate the registration failure.

## Cloud deployment and inference

```bash theme={"system"}
tp mlops cloud create-online --logical-name <logical_name> --model-name <model_name> --model-version <version> --instance-type <instance_type> --dry-run

tp mlops cloud create-online --logical-name <logical_name> --model-name <model_name> --model-version <version> --instance-type <instance_type>

tp mlops cloud wait --endpoint-name <endpoint_name> --timeout-seconds 1800
tp mlops cloud get --endpoint-name <endpoint_name>
tp mlops cloud invoke-online --endpoint-name <endpoint_name> --triton-model-name <triton_model_name> --payload-file ./sample.json
tp mlops cloud update-online --endpoint-name <endpoint_name> --logical-name <logical_name> --model-name <model_name> --model-version <version> --dry-run
tp mlops cloud set-online-traffic --endpoint-name <endpoint_name> --deployment-name <deployment_name> --traffic 100 --dry-run
```

## Verification checklist

* Data asset exists and is readable.
* Training job completed and `tp mlops jobs metrics <job_id>` returns non-empty metrics.
* Metrics include a primary task metric, baseline comparison, business metric, and data volume.
* Model version exists and passes deployability checks.
* Endpoint/deployment state is healthy.
* Inference sample returns expected schema and plausible output.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.