Signal · Methods

signal.decide

signal.decide({ state, questions }) returns a decision for each typed question about state: a choice with its probabilities and no text, where a noul is the probability of yes. The questions are the schema: an answer outside what was asked fails the call. Example: a decision provider with scripted answers (no model is called); a chat provider answers the same call with choices only and calibrated: false.

Request
{
  url: 'https://model.invalid/v1/systemone',
  body: {
    model: 'written-here',
    state: 'Two for The Tempest on Saturday, please. Grace',
    questions: {
      wants: {
        type: 'choice',
        instructions: 'What does the member want?',
        criteria: {
          seats: 'Seats for a night',
          refund: 'Money back',
          other: 'Anything else',
        },
      },
      urgent: {
        type: 'noul',
        instructions: 'Does it need an answer today?',
      },
    },
  },
}
Scripted provider answers
{
  wants: {
    choice: 'seats',
    probabilities: { seats: 0.94, refund: 0.04, other: 0.02 },
    confidence: 0.94,
  },
  urgent: { noul: 0.12 },
}
Output
{
  calibrated: true,
  decisions: {
    wants: {
      choice: 'seats',
      probabilities: { seats: 0.94, refund: 0.04, other: 0.02 },
      confidence: 0.94,
    },
    urgent: { answer: false, noul: 0.12 },
  },
}
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.