Skip to content
SONOEDocs
EspañolESConsole

Score

A Score places the state on ordered levels you describe, from lowest to highest. The answer is a position that can land between two levels, a probability for each level, and a confidence.

Request

type"score"required
instructionsstring | object | arrayoptional

What to rate. If omitted, Sonoe asks which level fits best.

criteriaarray<string | object | array>required

The levels in order, from lowest to highest. Between 2 and 10.

{
  "model": "sonoe-latest",
  "state": "Absolutely love it, five stars, would buy again!",
  "questions": {
    "sentiment": {
      "type": "score",
      "instructions": "How positive is this review?",
      "criteria": ["Very negative", "Negative", "Neutral", "Positive", "Very positive"]
    }
  }
}

Answer

type"score"required
scorenumberrequired

The expected level: each level's index (0, 1, 2…) weighted by its probability. It can land between levels: 3.5 is between "Positive" and "Very positive".

legendmap<string, string | object | array>required
Each level's index (as a string) and the level you sent.
probabilitiesmap<string, number>required
Each level's index and its probability. They add up to 1.
confidencenumberrequired
How sure Sonoe is, from 0 to 1.
{
  "model": "sonoe-1.1.0",
  "answers": {
    "sentiment": {
      "type": "score",
      "score": 3.519,
      "legend": { "0": "Very negative", "1": "Negative", "2": "Neutral", "3": "Positive", "4": "Very positive" },
      "probabilities": { "0": 0.0009, "1": 0.0042, "2": 0.0258, "3": 0.413, "4": 0.5561 },
      "confidence": 0.4935
    }
  },
  "usage": { "input_tokens": 195, "output_tokens": 0 }
}

Using the score

The score is a number on your scale, so you can compare and threshold it directly:

s = answers["sentiment"]
if s["score"] >= 3:
    ask_for_a_public_review()

When you need the single most likely level instead, take the key with the highest probability in probabilities.

Tips

  • Order matters. Always lowest to highest; the score is computed from the positions.
  • Make levels distinct. "Low / Medium / High" works; "Somewhat high / Quite high / High" doesn't.
  • Fewer levels, better answers. 3 to 5 levels are usually enough.
  • In the native API, a Score is a scale question: its value is the same number as score, and answer is the most likely level.