Model Training — MDDB API

Training datasets from collections and runs of the operator's trainer commands (module modelTraining, admin)

List the trainer profiles the operator configured #

GET /v1/training/profiles

The profiles of MDDB_TRAINERS_CONFIG with the parameters each declares, and any profile the server refused. The command line, the argument templates and the environment allowlist are never shown. Admin only; module modelTraining (off by default). REST only: no gRPC method, GraphQL field or MCP tool.

Authorization: BearerAuth or APIKeyAuth or none

Responses #

Status Description Body
200 The profiles object (application/json)
403 Admin access required, or a scoped MCP key
404 The modelTraining module is off

List training datasets #

GET /v1/training/datasets

Authorization: BearerAuth or APIKeyAuth or none

Responses #

Status Description Body
200 Every dataset, newest first TrainingJobList (application/json)
403 Admin access required
404 The modelTraining module is off

Build a training dataset from collections #

POST /v1/training/datasets

Starts a job that exports one or several collections as JSON Lines (text or pairs) into the job's directory, split into a training and a validation part. A collection without licence information needs acknowledgeUnlicensed: true.

Authorization: BearerAuth or APIKeyAuth or none

Request body #

Required.

Content type application/json: TrainingDatasetRequest

{
  "acknowledgeUnlicensed": false,
  "collections": [
    "string"
  ],
  "dedupe": true,
  "format": "text",
  "lang": "string",
  "maxRecords": 0,
  "name": "string",
  "pairs": {
    "input": "string",
    "output": "string",
    "system": "string"
  },
  "seed": 0,
  "shuffle": false,
  "validationRatio": 0
}

Responses #

Status Description Body
202 The dataset job was accepted TrainingJobAccepted (application/json)
400 An invalid request, or collections without licence information not acknowledged ErrorResponse (application/json)
403 Admin access required
404 The modelTraining module is off
507 Not enough free disk space under MDDB_TRAINING_DIR

A dataset's status, summary and preview #

GET /v1/training/datasets/{id}

Authorization: BearerAuth or APIKeyAuth or none

Parameters #

Name In Type Description
id (required) path string Pattern ^ds_[0-9a-f]{16}$.

Responses #

Status Description Body
200 The dataset TrainingJobDetail (application/json)
404 No such dataset, or the module is off

Delete a dataset and its files #

DELETE /v1/training/datasets/{id}

Authorization: BearerAuth or APIKeyAuth or none

Parameters #

Name In Type Description
id (required) path string Pattern ^ds_[0-9a-f]{16}$.

Responses #

Status Description Body
200 Deleted
404 No such dataset
409 The dataset is still being built, or a running job uses it

Download a part of a completed dataset #

GET /v1/training/datasets/{id}/download

Authorization: BearerAuth or APIKeyAuth or none

Parameters #

Name In Type Description
id (required) path string
part query string One of "train", "validation". Default "train".

Responses #

Status Description Body
200 The JSON Lines file string (binary) (application/x-ndjson)
400 An unknown part
404 No such dataset
409 The dataset is not completed

List training runs #

GET /v1/training/jobs

Authorization: BearerAuth or APIKeyAuth or none

Responses #

Status Description Body
200 Every run, newest first TrainingJobList (application/json)
403 Admin access required
404 The modelTraining module is off

Start a run of a trainer profile #

POST /v1/training/jobs

Starts the profile's command on a built dataset (datasetId) or on one built for the run (dataset). Only parameter values travel: each is checked against the profile's declaration and passed as its own argument, never through a shell. trial: true runs on a small cut of the dataset with the profile's trialParameters. When the profile has an evaluate command and the dataset is pairs with a validation part, the base model and the result are scored.

Authorization: BearerAuth or APIKeyAuth or none

Request body #

Required.

Content type application/json: TrainingRunRequest

{
  "dataset": {
    "acknowledgeUnlicensed": false,
    "collections": [
      "string"
    ],
    "dedupe": true,
    "format": "text",
    "lang": "string",
    "maxRecords": 0,
    "name": "string",
    "pairs": {
      "input": "string",
      "output": "string",
      "system": "string"
    },
    "seed": 0,
    "shuffle": false,
    "validationRatio": 0
  },
  "datasetId": "string",
  "evaluate": false,
  "name": "string",
  "profile": "string",
  "trial": false
}

Responses #

Status Description Body
202 The run was accepted TrainingJobAccepted (application/json)
400 Unknown profile or parameter, a refused value, or an invalid dataset ErrorResponse (application/json)
409 No trainer is configured, or the profile runs as many jobs as it allows ErrorResponse (application/json)

A run's status, stage, progress, evaluation and log tail #

GET /v1/training/jobs/{id}

Authorization: BearerAuth or APIKeyAuth or none

Parameters #

Name In Type Description
id (required) path string Pattern ^run_[0-9a-f]{16}$.

Responses #

Status Description Body
200 The run and the last 16 KiB of its log TrainingJobDetail (application/json)
404 No such run

Delete a finished run and its directory, result included #

DELETE /v1/training/jobs/{id}

Authorization: BearerAuth or APIKeyAuth or none

Parameters #

Name In Type Description
id (required) path string Pattern ^run_[0-9a-f]{16}$.

Responses #

Status Description Body
200 Deleted
404 No such run
409 The run is still going

Cancel a run #

POST /v1/training/jobs/{id}/cancel

Ends the command's process group (SIGTERM, then SIGKILL after a grace period; on Windows the process is killed).

Authorization: BearerAuth or APIKeyAuth or none

Parameters #

Name In Type Description
id (required) path string

Responses #

Status Description Body
202 Cancelling
404 No such run
409 The run has ended

Evaluate a finished run again #

POST /v1/training/jobs/{id}/evaluate

Authorization: BearerAuth or APIKeyAuth or none

Parameters #

Name In Type Description
id (required) path string

Responses #

Status Description Body
202 The evaluation started
400 The profile has no evaluate command, or is gone
409 The run has no result, is still going, or the profile is busy

Download a run's result file #

GET /v1/training/jobs/{id}/download

Serves only a regular file in the run's output directory whose name matches the profile's output pattern.

Authorization: BearerAuth or APIKeyAuth or none

Parameters #

Name In Type Description
id (required) path string

Responses #

Status Description Body
200 The result file string (binary) (application/octet-stream)
404 No such run, or it has no result