POST
/
scoring_system
/
import_spec
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 scoringSpec = await client.scoringSystem.importSpec({
    hf_scoring_spec_name: 'withpi/tldr_scoring_system',
  });

  console.log(scoringSpec.description);
}

main();
{
  "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"
}

Authorizations

x-api-key
string
header
required

Body

application/json
hf_scoring_spec_name
string
required

Huggingface dataset e.g. withpi/my_scoring_system containing the Scoring spec. This is only needed for the source=HUGGINGFACE.

Example:

"withpi/tldr_scoring_system"

hf_token
string | null

Huggingface token to use if you want to read to your own HF organization. This is only needed for the source=HUGGINGFACE.

source
enum<string>

Source of where to get the Scoring spec

Available options:
HUGGINGFACE

Response

200
application/json
Successful Response
description
string
required

The application description

Example:

"Write a children's story communicating a simple life lesson."

dimensions
object[]
required

The dimensions of the scoring spec

Example:
[
  {
    "description": "dimension1 description",
    "label": "dimension1",
    "sub_dimensions": [
      {
        "description": "subdimension1 description",
        "label": "subdimension1",
        "scoring_type": "PI_SCORER"
      }
    ]
  }
]
name
string
required

The name of the scoring spec

Example:

"Sample Scoring Spec"