Skip to content
Docs navigation: Decision model / Questions

Questions

RightNow AIDecision modelQuestions Updated

On this page
decide.ts
import { SystemZeroClient } from '@rightnowai/system-zero';

const client = new SystemZeroClient({
  apiKey: process.env.SYSTEM_ZERO_API_KEY,
  baseURL: "https://api.rightnowai.co/v1",
});
const reply = await client.decide({
  "model": "rightnow-decision",
  "state": "The blender I ordered arrived with a cracked jar.",
  "questions": {
    "damaged": {
      "type": "boolean",
      "instructions": "Did the item arrive damaged?"
    }
  }
});
console.log(JSON.stringify(reply, null, 2));
const models = await client.models.list();
console.log(models);

// Set SYSTEM_ZERO_API_KEY to your API key before running this example.
// Run this example on your server.
// SDK defaults: The default is 5 retries, also the maximum, with 150 seconds
// per attempt and a 60-second total retry budget. A single wait longer than 60
// seconds raises the last error.
// Use Retry-After-Ms, or Retry-After when milliseconds are absent. The wait is
// never shorter than a random backoff floor: a random fraction of 0.5 seconds
// doubled for each attempt, capped at 8 seconds.

Which question type should I use?

Use boolean for a yes-or-no decision, choice to select a named option, and score for an ordered rating. See Decisions for their result shapes.

For a boolean, confidence is the selected outcome's probability. For a choice, it is probabilities[choice], the maximum option probability.

calibration_version: An opaque public identifier, or unpublished when none is assigned. A nonempty identifier does not prove calibration.

The fee is USD 0.0001 per answered question. The answered count is requested questions minus refused questions. Refused questions are not charged. The call fee is USD 0.00001.

Residual prompt text and answered-question charges apply once per call, not per page, image or audio pass. See Billing and credits for the published prices.

Can I send files?

Inline input: text, JSON state (robot state), images, voice, PDF, video (preview). Only listed formats are supported. Send text in state; Inputs lists input formats and availability.

Should I retry?

Retry only when error.retryable or x-should-retry permits it, and wait for the response's stated delay. Keep the same Idempotency-Key and JSON body for the decision's retries.

Stop automatic retries when the retry flag is false. See Errors and Idempotency.

How do I get a key?

Create a named key under API keys in an active workspace. A key belongs to its workspace and is shown once.

Use the key from your server over HTTPS. See Authentication for the header and Workspaces and keys for workspace ownership.

Is billing open?

Billing is open. See Billing and credits for charges and credit rules.

What happens to my data?

The current privacy policy says submitted content and returned answers are never used to train models. A request with an Idempotency-Key can store its answer and a one-way request fingerprint for replay.

Read the API privacy policy for data handling and retention.