addOther
Using the catch-all Other intent
The other
intent is unique. It acts as a catch-all intent for cases where no other intent can be matched.
You cannot name a normal intent "other"
. If you wish to manipulate
properties on the other
intent, you must use the addOther
method.
This intent is rarely called, but you can instruct the AI to do so more commonly or less commonly in the description of this method.
The other
Intent Lifecycle
Furthermore, the lifecycle of other
is slightly different than normal intents. Specifically, because the other
intent does not have any parameters, the following will occur onIntent
only occurs when the intents identified goes from anything that is not other
to other
. In other words, even if the content of the input changes, and it was other
before and after, onIntent
will not be called again.
addOther
Parameters
When dealing with the call signature, addOther
functions very similarly to addIntent
with a few "missing" parameters that you cannot customize on other
.
Of course, you cannot customize the name. The configuration is also missing a few properties.
Value Name | Type | Description |
---|---|---|
description | string | Customize when the other intent can be called. |
onIntent | (intentCall: IntentCall<T>, input?: string) => void | Called when this intent is identified. |
onCleanup | (intentCall: IntentCall<T>, input?: string) => void | Called when this intent is no longer detected. |
Consult the addIntent
documentation to learn more about what these do.