actionchoiceConfidence per option
Attack7%
Drink a potion58%
Flee24%
Ask for a truce9%
Taunt2%
Playground
What should the character do next? When health is low it drinks a potion to stay alive; when health is high it attacks.
{ "npc": "Border guard", "hp": "12%", "enemies": 3, "inventory": { "healing_potion": 1 }, "terrain": "narrow bridge", "ally_nearby": false}
These two examples differ by one detail. The result changes with them.
What changedLow health → high health
actionchoiceAttackDrink a potionFleeAsk for a truceTauntSet SYSTEM_ONE_API_KEY. The snippet uses a published catalog model id.
{"model":"decider-v1.1","state":{"npc":"Border guard","hp":"12%","enemies":3,"inventory":{"healing_potion":1},"terrain":"narrow bridge","ally_nearby":false},"questions":{"action":{"type":"choice","instructions":"Choose the NPC's next action given the game state.","criteria":{"attack":"Attack","potion":"Drink a potion","flee":"Flee","parley":"Ask for a truce","taunt":"Taunt"}}}}curl "https://system-one.dev/v1/systemone" \ -H "Authorization: Bearer $SYSTEM_ONE_API_KEY" \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: saved-operation-id' \ --data '{"model":"decider-v1.1","state":{"npc":"Border guard","hp":"12%","enemies":3,"inventory":{"healing_potion":1},"terrain":"narrow bridge","ally_nearby":false},"questions":{"action":{"type":"choice","instructions":"Choose the NPC'\''s next action given the game state.","criteria":{"attack":"Attack","potion":"Drink a potion","flee":"Flee","parley":"Ask for a truce","taunt":"Taunt"}}}}'// npm install @system-one-ai/core@0.6.0 @system-one-ai/transport-fetch@0.6.0 @system-one-ai/adapter-system-one@0.6.0import { createSystemOne, choice, score, booleanQuestion } from '@system-one-ai/core';import { systemOneAdapter } from '@system-one-ai/adapter-system-one';import { createFetchTransport } from '@system-one-ai/transport-fetch';const client = createSystemOne({ baseURL: "https://system-one.dev/v1", apiKey: process.env.SYSTEM_ONE_API_KEY!, model: "decider-v1.1", adapter: systemOneAdapter, transport: createFetchTransport(), timeoutMs: 30_000, maxRetries: 0,});const result = await client.evaluate({ state: { "npc": "Border guard", "hp": "12%", "enemies": 3, "inventory": { "healing_potion": 1 }, "terrain": "narrow bridge", "ally_nearby": false }, questions: { action: choice("Choose the NPC's next action given the game state.", { attack: "Attack", potion: "Drink a potion", flee: "Flee", parley: "Ask for a truce", taunt: "Taunt", }), },}, { headers: { 'Idempotency-Key': crypto.randomUUID() } });result.answers.action.choiceresult.response.requestId;