Slot
Defined in: core/src/nlp/utterance/utterance.slot.ts:47
A fillable position in an Utterance — the thing {room} would have
been in a string-templated NLP engine.
The design difference is that a slot is an object, not a name, and that
settles two problems a shared namespace has. Nothing has to own the identifier
room, because identity is the object reference and the id below is a guid
with no meaning outside the engine; two providers can each hold a slot they
both think of as “room” without colliding. And a slot knows how to fetch its
own values and when they went stale, so adding a room is a markUpdated away
from a retrain rather than an edit to a static entity list.
Extend this when a provider has a bespoke source; reach for slot when a function is enough.
Extends
Section titled “Extends”EventEmitter<SlotEvents>
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
T |
unknown |
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Slot<T>(): Slot<T>;Returns
Section titled “Returns”Slot<T>
Inherited from
Section titled “Inherited from”Properties
Section titled “Properties”getValues
Section titled “getValues”abstract getValues: (context) => Promise<SlotValue<T>[]>;Defined in: core/src/nlp/utterance/utterance.slot.ts:59
Every value this slot can currently take. Called when the engine (re)builds.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
context |
SlotGetContext |
Returns
Section titled “Returns”Promise<SlotValue<T>[]>
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get id(): string;Defined in: core/src/nlp/utterance/utterance.slot.ts:54
The guid an engine keys extractions on. Internal and never shown to anyone — the meaningful names live on the values a match resolves to.
Returns
Section titled “Returns”string
Methods
Section titled “Methods”emit()
Section titled “emit()”emit<K>(event, ...args): void;Defined in: core/src/utils/utils.eventemitter.ts:62
Invokes all listeners for event synchronously, without awaiting async listeners.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
K extends "updated" |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event |
K |
…args |
Parameters<SlotEvents[K]> |
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”emitAsync()
Section titled “emitAsync()”emitAsync<K>(event, ...args): Promise<void>;Defined in: core/src/utils/utils.eventemitter.ts:73
Invokes all listeners for event and awaits them concurrently via Promise.all.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
K extends "updated" |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event |
K |
…args |
Parameters<SlotEvents[K]> |
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”markUpdated()
Section titled “markUpdated()”markUpdated(): void;Defined in: core/src/nlp/utterance/utterance.slot.ts:65
Signals that getValues would now answer differently. An engine listens for this and rebuilds; nothing is cached here.
Returns
Section titled “Returns”void
on<K>( event, callback, options?): () => void;Defined in: core/src/utils/utils.eventemitter.ts:21
Registers callback for event. Returns an unsubscribe function; passing
options.abortSignal also removes the listener when that signal aborts.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
K extends "updated" |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event |
K |
callback |
EventListener<Parameters<SlotEvents[K]>> |
options |
OnOptions |
Returns
Section titled “Returns”() => void
Inherited from
Section titled “Inherited from”once()
Section titled “once()”once<K>( event, callback, options?): () => void;Defined in: core/src/utils/utils.eventemitter.ts:45
Like on, but the listener is removed after firing once.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
K extends "updated" |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
event |
K |
callback |
EventListener<Parameters<SlotEvents[K]>> |
options |
OnOptions |
Returns
Section titled “Returns”() => void