Skip to content

NLPActionExecute

type NLPActionExecute = (context) => Promise<void>;

Defined in: core/src/nlp/nlp.types.ts:40

Runs a matched intent.

Slots are read off entities by passing the slot object itself, which is what makes the read typed — entities.get(room) is a Room[]. Every lookup is an array, so an intent that wants exactly one value has to say which:

execute: async ({ entities }) => {
const [selected] = entities.get(room);
if (!selected) return;
// …
}

Where an existing Action is the right target, invokeAction builds one of these from it rather than making you write the call out.

Parameter Type
context NLPActionContext

Promise<void>