actionchoice各选项置信度
攻击7%
喝药58%
逃跑24%
求和9%
嘲讽2%
Playground
角色下一步做什么?血量很低时选择喝药自保,血量充足时选择进攻。
{ "npc": "边境守卫", "hp": "12%", "enemies": 3, "inventory": { "healing_potion": 1 }, "terrain": "狭窄桥面", "ally_nearby": false}
两个例子只差一处,结果会跟着变。
改了什么血量很低 → 血量充足
actionchoice攻击喝药逃跑求和嘲讽设置 SYSTEM_ONE_API_KEY。代码片段使用目录中已发布的模型 id。
{"model":"decider-v1.1","state":{"npc":"边境守卫","hp":"12%","enemies":3,"inventory":{"healing_potion":1},"terrain":"狭窄桥面","ally_nearby":false},"questions":{"action":{"type":"choice","instructions":"Choose the NPC's next action given the game state.","criteria":{"attack":"攻击","potion":"喝药","flee":"逃跑","parley":"求和","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":"边境守卫","hp":"12%","enemies":3,"inventory":{"healing_potion":1},"terrain":"狭窄桥面","ally_nearby":false},"questions":{"action":{"type":"choice","instructions":"Choose the NPC'\''s next action given the game state.","criteria":{"attack":"攻击","potion":"喝药","flee":"逃跑","parley":"求和","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": "边境守卫", "hp": "12%", "enemies": 3, "inventory": { "healing_potion": 1 }, "terrain": "狭窄桥面", "ally_nearby": false }, questions: { action: choice("Choose the NPC's next action given the game state.", { attack: "攻击", potion: "喝药", flee: "逃跑", parley: "求和", taunt: "嘲讽", }), },}, { headers: { 'Idempotency-Key': crypto.randomUUID() } });result.answers.action.choiceresult.response.requestId;