SDK 与客户端
基于 TypeSafe Jev 的实时游戏驱动实验工具。
Experiments in driving real-time games with TypeSafe Jev: a fast
from typesafe_sdk import Choice, Noul, Score, TypeSafeAPIError, TypeSafeClient链接指向我们抓取当天的那个 commit,行号是准的。
下面是从这个项目源码里原样取出来的 question 组合。
取自 src/jev_game_lab/smoke.py:18
action选项Pick the single best action for the player right now.
attack — Shoot the nearest enemy.retreat — Move away from enemies to gain distance.grab_medkit — Move toward the medkit pickup.run_to_exit — Head straight for the level exit.in_danger是/否Is the player in immediate danger of dying within the next few seconds?
threat打分How threatening is the overall situation for the player?
0 — trivial1 — manageable2 — dangerous3 — criticalimport { experimental_evaluate as evaluate } from 'ai';
const { answers } = await evaluate({
model: 'typesafe-ai/jev',
state,
questions: {
action: { type: 'choice', instructions: 'Pick the single best action for the player right now.',
criteria: { attack: 'Shoot the nearest enemy.', retreat: 'Move away from enemies to gain distance.', grab_medkit: 'Move toward the medkit pickup.', run_to_exit: 'Head straight for the level exit.' } },
in_danger: { type: 'boolean', instructions: 'Is the player in immediate danger of dying within the next few seconds?' },
threat: { type: 'score', instructions: 'How threatening is the overall situation for the player?',
criteria: ['trivial', 'manageable', 'dangerous', 'critical'] },
},
});