Application\<TInput, TOutput>
A DashaScript conversational application deployed to the Dasha platform.
Extends
Type Parameters
• TInput extends Record
<string
, unknown
>
conversation input data type
• TOutput extends Record
<string
, unknown
>
conversation output data type
Properties
account
readonly
account:Account
A user Account that the application was deployed under.
applicationId
applicationId:
string
An internal application UID.
applicationName
applicationName:
string
Application name as seen in [.dashaapp
].
[.dashaapp
]: https://docs.dasha.ai/en-us/default/application/configuration/#application-name
axios
readonly
axios:null
|AxiosInstance
An instance of the axios
HTTP client used for #httpRequest()
,
or null
if #httpRequest()
has been disabled.
Initialized with the value of DeploymentOptions.axios
connectionProvider?
optional
connectionProvider:ConnectionProvider
<TInput
,TOutput
>
A ConnectionProvider to use for this application's conversations.
Deprecated
use the channel
argument to Conversation.execute instead
customerId
readonly
customerId:string
An internal client UID.
customTtsProvider
customTtsProvider:
CustomTtsProvider
A CustomTtsProvider callback to use when the TtsProviderName | TTS provider
is set to "custom"
in Conversation.audio.tts.
groupId
readonly
groupId:string
An internal application group UID.
inputSchema?
optional
inputSchema:unknown
JSON Schema of DSL context input variables. Conversation context: https://docs.dasha.ai/en-us/default/dasha-script-language/conversation-context
log
readonly
log:Logger
outputSchema?
optional
outputSchema:unknown
JSON Schema of DSL context output variables. Conversation context: https://docs.dasha.ai/en-us/default/dasha-script-language/conversation-context
queue
readonly
queue:ConversationQueue
<TInput
,TOutput
>
A ConversationQueue object for managing planned conversations.
sttDispatcher
sttDispatcher:
SttDispatcher
<TInput
,TOutput
>
An SttDispatcher callback that selects a speech-to-text engine
for all new conversations. If not set explicitly, a "default"
SttProviderName | STT provider will be used.
Deprecated
use Conversation.audio.stt instead
ttsDispatcher
ttsDispatcher:
TtsDispatcher
<TInput
,TOutput
>
A TtsDispatcher callback that selects a text-to-speech engine
for all new conversations. If not set explicitly, a "default"
TtsProviderName | TTS provider will be used.
Deprecated
use Conversation.audio.tts instead
Methods
createConversation()
createConversation(
input
?):Conversation
<TInput
,TOutput
>
Create a single Conversation.
Parameters
input?
TInput
conversation's input data; can also be set later with Conversation.input
Returns
Conversation
<TInput
, TOutput
>
dispose()
dispose():
void
Close the connection with the application, freeing all local resources.
Returns
void
healthCheck()
healthCheck():
Promise
<boolean
>
Returns
Promise
<boolean
>
setExternal()
setExternal<
TArgs
>(name
,fn
):void
Set an external call handler for this application.
The handler is called with all the call arguments passed as a dictionary,
as well as the current Conversation object. It can return a JSON-serializable
value, possibly wrapped in a promise, which then is treated as the call's return value.
As a special case, undefined
gets converted to null
.
Type Parameters
• TArgs extends Record
<string
, unknown
>
Parameters
name
string
fn
(args
, conv
) => unknown
Returns
void
start()
start(
options
?):Promise
<void
>
Start the deployed application, enabling it to receive incoming requests and run queued conversations.
Parameters
options?
concurrency
number
max number of conversations to run at once
Returns
Promise
<void
>
stop()
stop(
options
?):Promise
<void
>
Stop the running application, disabling the creation of new conversations. Conversations that are already running are unaffected.
Parameters
options?
cancelationToken
checkPeriodInMs
number
waitUntilAllProcessed
boolean
Returns
Promise
<void
>
waitUntilCurrentProcessed()
waitUntilCurrentProcessed(
options
?):Promise
<boolean
>
Parameters
options?
cancelationToken
checkPeriodInMs
number
Returns
Promise
<boolean
>