oracular / evaluate
Function: evaluate()
ts
function evaluate(
state,
intent,
at,
opts?
): Evaluation;Defined in: evaluate.ts:34
predict, shouldReveal and explain in one call, from a single decay pass over the intent. The three results are identical to what the separate functions return for the same inputs; this is the one to call on every event when you need all of them. Read-only.
Parameters
| Parameter | Type | Description |
|---|---|---|
state | EngineState | The current state. Not mutated. |
intent | string | Name of an intent declared in the config. |
at | number | The time to evaluate at. |
opts? | EvaluateOptions | Reveal overrides (threshold, z, cooldown, bound) and explain filters (nonZero, limit) in one object. |
Returns
prediction (as predict), reveal (as shouldReveal) and explanation (as explain with the same filters).
Throws
RangeError when intent is not declared in the config.
Throws
TypeError when state is not an engine state, at is not finite, or opts is malformed.
Example
ts
const { prediction, reveal, explanation } = evaluate(state, 'upgrade', Date.now(), { limit: 3 });
if (reveal) showOffer(explanation[0]?.signal);