POST
/
search
/
query_classifier
/
distill
import PiClient from 'withpi';

const client = new PiClient({
  apiKey: process.env['WITHPI_API_KEY'], // This is the default and can be omitted
});

async function main() {
  const classificationStatus = await client.search.queryClassifier.distill.startJob({
    base_model: 'MODERNBERT_BASE',
    examples: [
      {
        llm_input: 'Tell me something different',
        llm_output: 'The lazy dog was jumped over by the quick brown fox',
      },
    ],
  });

  console.log(classificationStatus.job_id);
}

main();
{
  "detailed_status": [
    "Downloading model",
    "Tuning prompt"
  ],
  "job_id": "1234abcd",
  "state": "RUNNING",
  "trained_models": [
    {
      "epoch": 123,
      "eval_loss": 123,
      "pi_score": 0,
      "serving_id": 123,
      "serving_state": "UNLOADED",
      "step": 123
    }
  ]
}

Authorizations

x-api-key
string
header
required

Body

application/json
base_model
enum<string>
required

The base model to start the classification tuning process

Available options:
MODERNBERT_BASE,
MODERNBERT_LARGE
examples
object[]
required

Examples to use in the classification tuning process

An example for training or evaluation

learning_rate
number
default:0.00002

Classification learning rate

Example:

0.000005

num_train_epochs
integer
default:5

Classification number of train epochs

Example:

5

Response

200
application/json
Successful Response

ClassificationStatus is the status of a classification job.

detailed_status
string[]
required

Detailed status of the job

Example:
["Downloading model", "Tuning prompt"]
job_id
string
required

The job id

Example:

"1234abcd"

state
enum<string>
required

Current state of the job

Available options:
QUEUED,
RUNNING,
DONE,
ERROR,
CANCELLED
trained_models
object[] | null

A list of trained classification models.