SDKs & clients
Experiments in driving real-time games with TypeSafe Jev: a fast
from typesafe_sdk import Choice, Noul, Score, TypeSafeAPIError, TypeSafeClientThe link points at the commit we read, so the line number still holds.
These question sets are lifted from this project's source exactly as written.
from src/jev_game_lab/smoke.py:18
actionchoicePick 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_dangertrue/falseIs the player in immediate danger of dying within the next few seconds?
threatscoreHow 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'] },
},
});