POST
/
scoring_system
/
calibrate
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 response = await client.scoringSystem.calibrate.startJob({
    scoring_spec: {
      description: "Write a children's story communicating a simple life lesson.",
      dimensions: [
        {
          description: 'dimension1 description',
          label: 'dimension1',
          sub_dimensions: [
            { description: 'subdimension1 description', label: 'subdimension1', scoring_type: 'PI_SCORER' },
          ],
        },
      ],
      name: 'Sample Scoring Spec',
    },
  });

  console.log(response.job_id);
}

main();
{
  "calibrated_scoring_spec": {
    "description": "Write a children's story communicating a simple life lesson.",
    "dimensions": [
      {
        "description": "dimension1 description",
        "label": "dimension1",
        "sub_dimensions": [
          {
            "description": "subdimension1 description",
            "label": "subdimension1",
            "scoring_type": "PI_SCORER"
          }
        ]
      }
    ],
    "name": "Sample Scoring Spec"
  },
  "detailed_status": [
    "Downloading model",
    "Tuning prompt"
  ],
  "job_id": "1234abcd",
  "state": "RUNNING"
}

Authorizations

x-api-key
string
header
required

Body

application/json
scoring_spec
object
required

The scoring spec to calibrate

examples
object[] | null

Rated examples to use when calibrating the scoring spec. Must specify either the examples or the preference examples

An labeled example for training or evaluation

preference_examples
object[] | null

Preference examples to use when calibrating the scoring spec. Must specify either the examples or preference examples

An preference example for training or evaluation

strategy
enum<string>

The strategy to use to calibrate the scoring spec. FULL would take longer than LITE but may result in better result.

Available options:
LITE,
FULL

Response

200
application/json
Successful Response
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
calibrated_scoring_spec
object | null

The calibrated scoring spec