createBotLocale method
- required String botId,
- required String botVersion,
- required String localeId,
- required double nluIntentConfidenceThreshold,
- AudioFillerSettings? audioFillerSettings,
- String? description,
- GenerativeAISettings? generativeAISettings,
- SpeechDetectionSensitivity? speechDetectionSensitivity,
- SpeechRecognitionSettings? speechRecognitionSettings,
- UnifiedSpeechSettings? unifiedSpeechSettings,
- VoiceSettings? voiceSettings,
Creates a locale in the bot. The locale contains the intents and slot types that the bot uses in conversations with users in the specified language and locale. You must add a locale to a bot before you can add intents and slot types to the bot.
May throw ConflictException.
May throw InternalServerException.
May throw PreconditionFailedException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter botId :
The identifier of the bot to create the locale for.
Parameter botVersion :
The version of the bot to create the locale for. This can only be the
draft version of the bot.
Parameter localeId :
The identifier of the language and locale that the bot will be used in.
The string must match one of the supported locales. All of the intents,
slot types, and slots used in the bot must have the same locale. For more
information, see Supported
languages.
Parameter nluIntentConfidenceThreshold :
Determines the threshold where Amazon Lex will insert the
AMAZON.FallbackIntent,
AMAZON.KendraSearchIntent, or both when returning alternative
intents. AMAZON.FallbackIntent and
AMAZON.KendraSearchIntent are only inserted if they are
configured for the bot.
For example, suppose a bot is configured with the confidence threshold of
0.80 and the AMAZON.FallbackIntent. Amazon Lex returns three
alternative intents with the following confidence scores: IntentA (0.70),
IntentB (0.60), IntentC (0.50). The response from the
RecognizeText operation would be:
- AMAZON.FallbackIntent
- IntentA
- IntentB
- IntentC
Parameter audioFillerSettings :
Audio filler settings to configure for the new bot locale. When enabled,
Amazon Lex plays a brief background audio filler during speech-to-speech
interactions to mask processing delays. Requires
unifiedSpeechSettings (speech-to-speech) to be configured on
the bot locale.
Parameter description :
A description of the bot locale. Use this to help identify the bot locale
in lists.
Parameter speechDetectionSensitivity :
The sensitivity level for voice activity detection (VAD) in the bot
locale. This setting helps optimize speech recognition accuracy by
adjusting how the system responds to background noise during voice
interactions.
Parameter speechRecognitionSettings :
Speech-to-text settings to configure for the new bot locale.
Parameter unifiedSpeechSettings :
Unified speech settings to configure for the new bot locale.
Parameter voiceSettings :
The Amazon Polly voice ID that Amazon Lex uses for voice interaction with
the user.
Implementation
Future<CreateBotLocaleResponse> createBotLocale({
required String botId,
required String botVersion,
required String localeId,
required double nluIntentConfidenceThreshold,
AudioFillerSettings? audioFillerSettings,
String? description,
GenerativeAISettings? generativeAISettings,
SpeechDetectionSensitivity? speechDetectionSensitivity,
SpeechRecognitionSettings? speechRecognitionSettings,
UnifiedSpeechSettings? unifiedSpeechSettings,
VoiceSettings? voiceSettings,
}) async {
_s.validateNumRange(
'nluIntentConfidenceThreshold',
nluIntentConfidenceThreshold,
0,
1,
isRequired: true,
);
final $payload = <String, dynamic>{
'localeId': localeId,
'nluIntentConfidenceThreshold': nluIntentConfidenceThreshold,
if (audioFillerSettings != null)
'audioFillerSettings': audioFillerSettings,
if (description != null) 'description': description,
if (generativeAISettings != null)
'generativeAISettings': generativeAISettings,
if (speechDetectionSensitivity != null)
'speechDetectionSensitivity': speechDetectionSensitivity.value,
if (speechRecognitionSettings != null)
'speechRecognitionSettings': speechRecognitionSettings,
if (unifiedSpeechSettings != null)
'unifiedSpeechSettings': unifiedSpeechSettings,
if (voiceSettings != null) 'voiceSettings': voiceSettings,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri:
'/bots/${Uri.encodeComponent(botId)}/botversions/${Uri.encodeComponent(botVersion)}/botlocales',
exceptionFnMap: _exceptionFns,
);
return CreateBotLocaleResponse.fromJson(response);
}