Constructor
new core/LexFeature(lexRuntime, optionsopt)
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
lexRuntime |
external:LexRuntime | The LexRuntime service that is used |
|||||||||||||||||
options |
Object |
<optional> |
Options that will be used to interact with lex bot. Properties
|
Properties:
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
LEX_DEFAULTS |
Object | Default values to use with calls to external:LexRuntime. Properties
|
|||||||||||||||||||||||||
EVENTS |
Object | Built-in messages that the feature emits. Properties
|
Extends
Members
(readonly) id :string
Gets the string id of the object.
Type:
- string
- Overrides:
Methods
_processWithAudio(inputAudio, sourceSampleRate, configopt) → {Promise}
Sends audio input to Amazon Lex.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
inputAudio |
TypedArray | TypedArray view of the input audio buffer |
|||||||||||||||||
sourceSampleRate |
Number | Sample rate of the input audio |
|||||||||||||||||
config |
Object |
<optional> |
Optional config for overriding lex bot info Properties
|
Returns:
A Promise-like object that resolves to a Lex response object.
For details on the structure of that response object see: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/LexRuntime.html#postContent-property
- Type
- Promise
_setupAudioContext()
Setup audio context which will be used for setting up microphone related audio node
beginVoiceRecording()
Begin microphone recording. This function will also try to resume audioContext so that
it's suggested to call this function after a user interaction
emit(message, valueopt)
Send a message, causing listener functions for the message on this object
to be executed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
string | The message to emit. |
|
value |
any |
<optional> |
Optional argument to pass to listener callbacks. |
- Overrides:
(async) enableMicInput()
Async function to setup microphone recorder which will get user permission for accessing microphone
This method must be called before attempting to record voice input with the
beginVoiceRecording() method. Expect an error to be thrown if the user has
chosen to block microphone access.
Throws:
-
See the documentation for
MediaDevices.getUserMedia().
The most likely error to expect will be the "NotAllowed" error indicating
the user has denied access to the microphone. - Type
- DOMException
endVoiceRecording() → {Promise}
Stop microphone recording and send recorded audio data to lex.
Returns:
A Promise-like object that resolves to a Lex response object.
For details on the structure of that response object see: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/LexRuntime.html#postContent-property
- Type
- Promise
getEngineUserAgentString()
Returns:
The useragent string for the engine you are using, e.g. 'babylonjs/5.1.0'
listenTo(message, callback)
Execute a function when a message is received for this object.
Parameters:
Name | Type | Description |
---|---|---|
message |
string | The message to listen for. |
callback |
function | Function to execute once the message is received. |
- Overrides:
processWithText(inputText, configopt) → {Promise}
Sends text user input to Amazon Lex.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
inputText |
String | Text to send to lex bot |
|||||||||||||||||
config |
Object |
<optional> |
Optional config for overriding lex bot info Properties
|
Returns:
A Promise-like object that resolves to a Lex response object.
For details on the structure of that response object see: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/LexRuntime.html#postContent-property
- Type
- Promise
stopListening(message, callbackopt)
Prevent a function from being executed when a message is received for this
object.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
string | The message to stop listening for. |
|
callback |
function |
<optional> |
Optional callback to remove. If none is defined, |
- Overrides:
stopListeningByRegexp(regexp, callbackopt)
De-register callback(s) from being executed when messages matching the given
regular expression are received.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
regexp |
Regexp | regexp - The regular expression to filter messages with. |
|
callback |
function |
<optional> |
Optional callback to remove. If none is defined, |
- Overrides:
stopListeningToAll()
Prevent any functions from being executed when any message is received for
this object.
- Overrides: