Skip to main content

$dialer.setAsrProperty

The method specifies an additional setting for the ASR provider. The setting applies only to the current session.

tip

Use $dialer.setAsrProperty to specify the settings that are not supported by the $dialer.setAsrConfig method.

The method supports a limited number of settings for the following ASR providers:

  • Yandex SpeechKit v2
  • Yandex SpeechKit v3
  • Tinkoff VoiceKit
  • 3iTech

For example, with this method you can:

  • Enable sentiment analysis in Tinkoff Voicekit.
  • Specify what languages should be recognized by Yandex SpeechKit v3.
tip

Some settings add extra user request data to $request.rawRequest. In the Speech recognition results article, you can view the full list of supported fields.

Syntax

$dialer.setAsrProperty({
key: "streaming_config.config.enable_sentiment_analysis",
value: true
});

Here:

  • key is the setting name.
  • value is the setting value.
caution
  • If you specify a setting that is not supported by the provider, it will be ignored.
  • If you specify a value that is not supported for the setting, an error will occur in the script and the call will end.

How to use

Suppose you are using Tinkoff ASR and developing a script that should behave differently based on the user’s gender and emotions:

  1. In the initial state of the script, specify the true value for these additional settings:

    • streaming_config.config.enable_sentiment_analysis
    • streaming_config.config.enable_gender_identification
  2. In another state, use the received data about the user’s gender and emotions. The data is available in $request.rawRequest.data.propertiesResponse.result.

state: Start
q!: $regex</start>
a: Let’s start.
script:
$dialer.setAsrProperty({
key: "streaming_config.config.enable_sentiment_analysis",
value: true
});
$dialer.setAsrProperty({
key: "streaming_config.config.enable_gender_identification",
value: true
});

state: Hello
intent!: /hello
script: $session.asrResults = $request.rawRequest.data.propertiesResponse.result;
if: $session.asrResults.recognition_result.gender_identification_result.male_proba > 0.8
# Bot answers if the user is likely to be a male
a: ...
if: $session.asrResults.recognition_result.sentiment_analysis_result.negative_prob_audio < 0.2
# Bot answers if the user is unlikely to have negative emotions
a: ...
tip

To get the ASR provider name in the current call, use the $dialer.getAsrProvider method.

Supported settings

$dialer.setAsrProperty allows you to specify a limited number of settings for ASR providers:

  • config.specification.profanityFilter
  • config.specification.rawResults

In the Yandex SpeechKit v2 documentation, you can view the description of these settings and learn about their effect on speech recognition.

info

If you want to use settings that are not supported by $dialer.setAsrProperty, please contact our support team: support@just-ai.com.

List of specified settings

The list of specified settings and their values is added to $request.rawRequest. The data is available in the $request.rawRequest.asrTtsProviderData.asr.asrProperties field.

Example:

{
"streaming_config.config.profanity_filter": "true",
"streaming_config.config.enable_sentiment_analysis": "true",
"streaming_config.config.enable_gender_identification": "true"
}