When building interactive multi-dimensional assessments in the browser, keeping scoring deterministic, transparent, and zero-latency matters more than throwing an LLM at every response.
Weighted Vector Scoring in TypeScript
Instead of opaque server-side black boxes, each scenario prompt can map cleanly to a fixed 7-axis weight vector:
export type Axis = 'pride' | 'greed' | 'lust' | 'envy' | 'gluttony' | 'wrath' | 'sloth' ;
export interface AnswerWeight { weights : Partial < Record < Axis , number >> ; }
export function scoreResponses ( answers : AnswerWeight [ ] ) : Record < Axis , number > { const totals : Record < Axis , number > = { pride : 0 , greed : 0 , lust : 0 , envy : 0 , gluttony : 0 , wrath : 0 , sloth : 0 , } ; for ( const ans of answers ) { for ( const [ axis , val ] of Object . entries ( ans . weights ) ) { totals [ axis as Axis ] += val ?? 0 ; } } const maxVal = Math . max ( 1 , . . . Object . values ( totals ) ) ; for ( const k of Object .…