Configuring multiple speech providers

VoiceAI Connect supports connecting to various speech services and enables configuration of parameters for each service (e.g., your credentials to the service). A combination of a speech service and its parameters is termed a provider. Typically, a bot is associated with one speech-to-text (STT) provider and one text-to-speech (TTS) provider.

However, there are scenarios where greater control over provider usage is required, and VoiceAI Connect offers you this control through the following features:


How do I use it?

Load balancing and fallback speech-to-text providers

For configuring load balancing and/or fallback speech-to-text providers, you need to configure a provider of type "list" and configure its providers list with the relevant providers. You then need to configure the sttProvider bot parameter with the name of the provider that you configured with the type "list".

This feature is supported only by VoiceAI Connect Enterprise (from Version 3.20 and later).

The Administrator can use the following bots parameter for controlling this feature:

Parameter

Type

Description

maxSttRetriesPerPriority

Number

The maximum number of alternative providers to fallback to in the same priority before advancing to a higher priority.

A value of -1 indicates that all providers within the same priority level should be attempted before moving to a higher priority. A value of 0 indicates that only one provider within each priority level should be tried.

Default: -1. Range: -1 – 100.

Note: The parameter is applicable only when sttProvider is configured to a provider of type "list".

The Administrator can use the following providers parameter for controlling this feature:

Parameter

Type

Description

providers

Array of objects

Defines a list of providers and assigns them to groups of providers.

Each element in the array is an object with fields as detailed below.

VoiceAI Connect performs load balancing and/or fallback between the providers specified in the array, according to their priority.

Example:

{
  "providers": [
    {
      "name": "provider_1",
      "type": "azure"
    },
    {
      "name": "provider_2",
      "type": "azure"
    },
    {
      "name": "group_1",
      "type": "list",
      "providers": [
        {
          "name": "provider_1",
          "priority": 0
        },
        {
          "name": "provider_2",
          "priority": 1
        }
      ]
    }   
  ],
  "bots": [
    {
      "name": "bot_1",
      "sttProvider": "group_1",
      "maxSttRetriesPerPriority": 0
    }
  ]
}

Note:

  • The array is limited to 10 providers.

  • Using this parameter overrides configuration of the sttFallbackProviders parameters.

The following table lists the fields inside the providers array elements:

Field

Type

Description

name

String

The name of the speech-to-text provider.

priority

Number (Optional)

The priority of the provider.

VoiceAI Connect will use the lowest priority providers. Only in case of failure, it will failover to higher priority providers.

If multiple providers are configured with the same priority, VoiceAI Connect will randomly choose (i.e., load balance) between them.

Default: 0. Range: 0-100.

sttContextId

String (Optional)

A value to be set to the sttContextId parameter when using this provider. See Speech-to-text models and contexts for more details.

sttModel

String (Optional)

A value to be set to the sttModel parameter when using this provider. See Speech-to-text models and contexts for more details.

By setting different values to the priority field, you can achieve various load balancing and/or fallback behaviors.

{
  "providers": [
    {
      "name": "provider_1",
      "type": "azure"
    },
    {
      "name": "provider_2",
      "type": "azure"
    },
    {
      "name": "group_1",
      "type": "list",
      "providers": [
        {
          "name": "provider_1",
          "priority": 0
        },
        {
          "name": "provider_2",
          "priority": 0
        }
      ]
    }   
  ],
  "bots": [
    {
      "name": "bot_1",
      "sttProvider": "group_1",
      "maxSttRetriesPerPriority": 0
    }
  ]
}
{
  "providers": [
    {
      "name": "provider_1",
      "type": "azure"
    },
    {
      "name": "provider_2",
      "type": "azure"
    },
    {
      "name": "group_1",
      "type": "list",
      "providers": [
        {
          "name": "provider_1",
          "priority": 0
        },
        {
          "name": "provider_2",
          "priority": 1
        }
      ]
    }   
  ],
  "bots": [
    {
      "name": "bot_1",
      "sttProvider": "group_1"
    }
  ]
}
{
  "providers": [
    {
      "name": "provider_1",
      "type": "azure"
    },
    {
      "name": "provider_2",
      "type": "azure"
    },
    {
      "name": "alternative_provider_3",
      "type": "azure"
    },
    {
      "name": "group_1",
      "type": "list",
      "providers": [
        {
          "name": "provider_1",
          "priority": 0
        },
        {
          "name": "provider_2",
          "priority": 0
        },
        {
          "name": "alternative_provider_3",
          "priority": 1
        }
      ]
    }
  ],
  "bots": [
    {
      "name": "bot_1",
      "sttProvider": "group_1",
      "maxSttRetriesPerPriority": 0
    }
  ]
}

Dynamic speech-to-text provider change

On bot message, where the sttProvider parameter is different than the current speech-to-text provider, VoiceAI Connect stops the current speech-to-text session with the current provider, and the next speech-to-text request will be with the new provider (if the new speech-to-text provider is listed in the additionalSttProviders parameter list value).

To integrate this feature in your bot, see Changing the speech provider.

This feature is supported only by VoiceAI Connect Enterprise (from Version 3.6 and later).

The Administrator can use the following bot parameter to define a list of speech-to-text providers allowed for dynamic change:

Parameter

Type

Description

 additionalSttProviders

String

Defines a list of up to ten provider names that the bot can use as speech-to-text providers.

Note:

  • Configuration cannot include both directSTT and additionalSttProviders.

  • The values listed in the additionalSttProviders parameter must also be one of the providers configured in providers.

Example

The following shows an example of a bot configuration for two speech-to-text providers:

{
  "name": "MyBot",
  "provider": "my_azure_provider",
  "displayName": "My Bot",
  "credentials": {
    "botSecret": "..."
  },
  "additionalSttProviders": [
    "my_azure_provider",
    "my_google_provider"
  ]
}

Example:

The following shows an example of a bot configuration for one group of providers, and additional speech-to-text providers comprised of a group and two separate providers:

{
  "providers": [
    {
      "name": "provider_1",
      "type": "azure"
    },
    {
      "name": "provider_2",
      "type": "azure"
    },
    {
      "name": "provider_3",
      "type": "azure"
    },
    {
      "name": "provider_4",
      "type": "azure"
    },
    {
      "name": "provider_5",
      "type": "azure"
    },
    {
      "name": "group_1",
      "type": "list",
      "providers": [
        {
          "name": "provider_1",
          "priority": 0
        },
        {
          "name": "provider_2",
          "priority": 1
        }
      ]
    },
    {
      "name": "group_2",
      "type": "list",
      "providers": [
        {
          "name": "provider_3",
          "priority": 0
        },
        {
          "name": "provider_4",
          "priority": 1
        }
      ]
    }
  ],
  "bots": [
    {
      "name": "bot_1",
      "sttProvider": "group_1",
      "additionalSttProviders": [
        "group_2",
        "provider_5"
      ]
    }
  ]
}

Dynamic text-to-speech provider change

On bot message, where the ttsProvider parameter is different than the current text-to-speech provider, VoiceAI Connect stops the current text-to-speech session with the current provider, and the next text-to-speech request will be with the new provider (if the new text-to-speech provider is listed in the additionalTtsProviders parameter list value). To integrate this feature in your bot, see changing-the-speech-provider.htm.

This feature is supported only by VoiceAI Connect Enterprise (from Version 3.6 and later).

The Administrator can use the following bot parameter is used to define a list of text-to-speech providers:

Parameter

Type

Description

 additionalTtsProviders

String

Defines a list of up to five provider names that the bot can use as text-to-speech providers.

Note:

  • If voiceName is not configured, then the default voiceName is used.

  • Configuration cannot include both directTTS and additionalTtsProviders.

  • The values listed in the additionalTtsProviders parameter must also be one of the values configured in ttsProvider.

Example

The following shows an example of a bot configuration for two text-to-speech providers:

{
  "name": "MyBot",
  "provider": "my_azure_provider",
  "displayName": "My Bot",
  "credentials": {
    "botSecret": "..."
  },
  "additionalTtsProviders": [
    "my_azure_provider",
    "my_google_provider"
  ]
}