Skip to content

/AWS1/IF_LM2=>CREATEBOTLOCALE()

About CreateBotLocale

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.

Method Signature

METHODS /AWS1/IF_LM2~CREATEBOTLOCALE
  IMPORTING
    !IV_BOTID TYPE /AWS1/LM2ID OPTIONAL
    !IV_BOTVERSION TYPE /AWS1/LM2DRAFTBOTVERSION OPTIONAL
    !IV_LOCALEID TYPE /AWS1/LM2LOCALEID OPTIONAL
    !IV_DESCRIPTION TYPE /AWS1/LM2DESCRIPTION OPTIONAL
    !IV_NLUINTENTCONFIDENCETHRESH TYPE /AWS1/RT_DOUBLE_AS_STRING OPTIONAL
    !IO_VOICESETTINGS TYPE REF TO /AWS1/CL_LM2VOICESETTINGS OPTIONAL
    !IO_UNIFIEDSPEECHSETTINGS TYPE REF TO /AWS1/CL_LM2UNIFIEDSPEECHSTGS OPTIONAL
    !IO_SPEECHRECOGNITIONSETTINGS TYPE REF TO /AWS1/CL_LM2SPEECHRECOGSTGS OPTIONAL
    !IO_GENERATIVEAISETTINGS TYPE REF TO /AWS1/CL_LM2GENERATIVEAISTGS OPTIONAL
    !IV_SPEECHDETECTSENSITIVITY TYPE /AWS1/LM2SPEECHDETSENSITIVITY OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_lm2createbotlocalersp
  RAISING
    /AWS1/CX_LM2CONFLICTEXCEPTION
    /AWS1/CX_LM2INTERNALSERVEREX
    /AWS1/CX_LM2PRECONDFAILEDEX
    /AWS1/CX_LM2SERVICEQUOTAEXCDEX
    /AWS1/CX_LM2THROTTLINGEX
    /AWS1/CX_LM2VALIDATIONEX
    /AWS1/CX_LM2CLIENTEXC
    /AWS1/CX_LM2SERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_botid TYPE /AWS1/LM2ID /AWS1/LM2ID

The identifier of the bot to create the locale for.

iv_botversion TYPE /AWS1/LM2DRAFTBOTVERSION /AWS1/LM2DRAFTBOTVERSION

The version of the bot to create the locale for. This can only be the draft version of the bot.

iv_localeid TYPE /AWS1/LM2LOCALEID /AWS1/LM2LOCALEID

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.

iv_nluintentconfidencethresh TYPE /AWS1/RT_DOUBLE_AS_STRING /AWS1/RT_DOUBLE_AS_STRING

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

Optional arguments:

iv_description TYPE /AWS1/LM2DESCRIPTION /AWS1/LM2DESCRIPTION

A description of the bot locale. Use this to help identify the bot locale in lists.

io_voicesettings TYPE REF TO /AWS1/CL_LM2VOICESETTINGS /AWS1/CL_LM2VOICESETTINGS

The Amazon Polly voice ID that Amazon Lex uses for voice interaction with the user.

io_unifiedspeechsettings TYPE REF TO /AWS1/CL_LM2UNIFIEDSPEECHSTGS /AWS1/CL_LM2UNIFIEDSPEECHSTGS

Unified speech settings to configure for the new bot locale.

io_speechrecognitionsettings TYPE REF TO /AWS1/CL_LM2SPEECHRECOGSTGS /AWS1/CL_LM2SPEECHRECOGSTGS

Speech-to-text settings to configure for the new bot locale.

io_generativeaisettings TYPE REF TO /AWS1/CL_LM2GENERATIVEAISTGS /AWS1/CL_LM2GENERATIVEAISTGS

Contains specifications about the generative AI capabilities from Amazon Bedrock that you can turn on for your bot.

iv_speechdetectsensitivity TYPE /AWS1/LM2SPEECHDETSENSITIVITY /AWS1/LM2SPEECHDETSENSITIVITY

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.

RETURNING

oo_output TYPE REF TO /aws1/cl_lm2createbotlocalersp /AWS1/CL_LM2CREATEBOTLOCALERSP

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->createbotlocale(
  io_generativeaisettings = new /aws1/cl_lm2generativeaistgs(
    io_buildtimesettings = new /aws1/cl_lm2buildtimesettings(
      io_descriptivebotbuilder = new /aws1/cl_lm2descriptivebotbu00(
        io_bedrockmodelspecification = new /aws1/cl_lm2bedrockmodelspec(
          io_guardrail = new /aws1/cl_lm2bedrockguardrail00(
            iv_identifier = |string|
            iv_version = |string|
          )
          iv_customprompt = |string|
          iv_modelarn = |string|
          iv_tracestatus = |string|
        )
        iv_enabled = ABAP_TRUE
      )
      io_sampleutterancegeneration = new /aws1/cl_lm2sampleutteranceg00(
        io_bedrockmodelspecification = new /aws1/cl_lm2bedrockmodelspec(
          io_guardrail = new /aws1/cl_lm2bedrockguardrail00(
            iv_identifier = |string|
            iv_version = |string|
          )
          iv_customprompt = |string|
          iv_modelarn = |string|
          iv_tracestatus = |string|
        )
        iv_enabled = ABAP_TRUE
      )
    )
    io_runtimesettings = new /aws1/cl_lm2runtimesettings(
      io_nluimprovement = new /aws1/cl_lm2nluimprovementspec(
        io_intentdisambiguationstgs = new /aws1/cl_lm2intentdisambigua00(
          iv_customdisambiguationmsg = |string|
          iv_enabled = ABAP_TRUE
          iv_maxdisambiguationintents = 123
        )
        iv_assistednlumode = |string|
        iv_enabled = ABAP_TRUE
      )
      io_slotresolutionimprovement = new /aws1/cl_lm2slotresolutionim00(
        io_bedrockmodelspecification = new /aws1/cl_lm2bedrockmodelspec(
          io_guardrail = new /aws1/cl_lm2bedrockguardrail00(
            iv_identifier = |string|
            iv_version = |string|
          )
          iv_customprompt = |string|
          iv_modelarn = |string|
          iv_tracestatus = |string|
        )
        iv_enabled = ABAP_TRUE
      )
    )
  )
  io_speechrecognitionsettings = new /aws1/cl_lm2speechrecogstgs(
    io_speechmodelconfig = new /aws1/cl_lm2speechmodelconfig(
      io_deepgramconfig = new /aws1/cl_lm2deepgramspeechmd00(
        iv_apitokensecretarn = |string|
        iv_modelid = |string|
      )
    )
    iv_speechmodelpreference = |string|
  )
  io_unifiedspeechsettings = new /aws1/cl_lm2unifiedspeechstgs(
    io_speechfoundationmodel = new /aws1/cl_lm2speechfndationmdel(
      iv_modelarn = |string|
      iv_voiceid = |string|
    )
  )
  io_voicesettings = new /aws1/cl_lm2voicesettings(
    iv_engine = |string|
    iv_voiceid = |string|
  )
  iv_botid = |string|
  iv_botversion = |string|
  iv_description = |string|
  iv_localeid = |string|
  iv_nluintentconfidencethresh = |0.1|
  iv_speechdetectsensitivity = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_id = lo_result->get_botid( ).
  lv_draftbotversion = lo_result->get_botversion( ).
  lv_localename = lo_result->get_localename( ).
  lv_localeid = lo_result->get_localeid( ).
  lv_description = lo_result->get_description( ).
  lv_confidencethreshold = lo_result->get_nluintentconfidencethrsh( ).
  lo_voicesettings = lo_result->get_voicesettings( ).
  IF lo_voicesettings IS NOT INITIAL.
    lv_voiceengine = lo_voicesettings->get_engine( ).
    lv_voiceid = lo_voicesettings->get_voiceid( ).
  ENDIF.
  lo_unifiedspeechsettings = lo_result->get_unifiedspeechsettings( ).
  IF lo_unifiedspeechsettings IS NOT INITIAL.
    lo_speechfoundationmodel = lo_unifiedspeechsettings->get_speechfoundationmodel( ).
    IF lo_speechfoundationmodel IS NOT INITIAL.
      lv_bedrockmodelarn = lo_speechfoundationmodel->get_modelarn( ).
      lv_voiceid = lo_speechfoundationmodel->get_voiceid( ).
    ENDIF.
  ENDIF.
  lo_speechrecognitionsettin = lo_result->get_speechrecogsettings( ).
  IF lo_speechrecognitionsettin IS NOT INITIAL.
    lv_speechmodelpreference = lo_speechrecognitionsettin->get_speechmodelpreference( ).
    lo_speechmodelconfig = lo_speechrecognitionsettin->get_speechmodelconfig( ).
    IF lo_speechmodelconfig IS NOT INITIAL.
      lo_deepgramspeechmodelconf = lo_speechmodelconfig->get_deepgramconfig( ).
      IF lo_deepgramspeechmodelconf IS NOT INITIAL.
        lv_secretsmanagersecretarn = lo_deepgramspeechmodelconf->get_apitokensecretarn( ).
        lv_deepgrammodelid = lo_deepgramspeechmodelconf->get_modelid( ).
      ENDIF.
    ENDIF.
  ENDIF.
  lv_botlocalestatus = lo_result->get_botlocalestatus( ).
  lv_timestamp = lo_result->get_creationdatetime( ).
  lo_generativeaisettings = lo_result->get_generativeaisettings( ).
  IF lo_generativeaisettings IS NOT INITIAL.
    lo_runtimesettings = lo_generativeaisettings->get_runtimesettings( ).
    IF lo_runtimesettings IS NOT INITIAL.
      lo_slotresolutionimproveme = lo_runtimesettings->get_slotresolutionimprovem00( ).
      IF lo_slotresolutionimproveme IS NOT INITIAL.
        lv_enabled = lo_slotresolutionimproveme->get_enabled( ).
        lo_bedrockmodelspecificati = lo_slotresolutionimproveme->get_bedrockmodelspec( ).
        IF lo_bedrockmodelspecificati IS NOT INITIAL.
          lv_bedrockmodelarn = lo_bedrockmodelspecificati->get_modelarn( ).
          lo_bedrockguardrailconfigu = lo_bedrockmodelspecificati->get_guardrail( ).
          IF lo_bedrockguardrailconfigu IS NOT INITIAL.
            lv_bedrockguardrailidentif = lo_bedrockguardrailconfigu->get_identifier( ).
            lv_bedrockguardrailversion = lo_bedrockguardrailconfigu->get_version( ).
          ENDIF.
          lv_bedrocktracestatus = lo_bedrockmodelspecificati->get_tracestatus( ).
          lv_bedrockmodelcustompromp = lo_bedrockmodelspecificati->get_customprompt( ).
        ENDIF.
      ENDIF.
      lo_nluimprovementspecifica = lo_runtimesettings->get_nluimprovement( ).
      IF lo_nluimprovementspecifica IS NOT INITIAL.
        lv_enabled = lo_nluimprovementspecifica->get_enabled( ).
        lv_assistednlumode = lo_nluimprovementspecifica->get_assistednlumode( ).
        lo_intentdisambiguationset = lo_nluimprovementspecifica->get_intentdisambiguationstgs( ).
        IF lo_intentdisambiguationset IS NOT INITIAL.
          lv_enabled = lo_intentdisambiguationset->get_enabled( ).
          lv_maxdisambiguationintent = lo_intentdisambiguationset->get_maxdisambiguationintents( ).
          lv_customdisambiguationmes = lo_intentdisambiguationset->get_customdisambiguationmsg( ).
        ENDIF.
      ENDIF.
    ENDIF.
    lo_buildtimesettings = lo_generativeaisettings->get_buildtimesettings( ).
    IF lo_buildtimesettings IS NOT INITIAL.
      lo_descriptivebotbuildersp = lo_buildtimesettings->get_descriptivebotbuilder( ).
      IF lo_descriptivebotbuildersp IS NOT INITIAL.
        lv_boolean = lo_descriptivebotbuildersp->get_enabled( ).
        lo_bedrockmodelspecificati = lo_descriptivebotbuildersp->get_bedrockmodelspec( ).
        IF lo_bedrockmodelspecificati IS NOT INITIAL.
          lv_bedrockmodelarn = lo_bedrockmodelspecificati->get_modelarn( ).
          lo_bedrockguardrailconfigu = lo_bedrockmodelspecificati->get_guardrail( ).
          IF lo_bedrockguardrailconfigu IS NOT INITIAL.
            lv_bedrockguardrailidentif = lo_bedrockguardrailconfigu->get_identifier( ).
            lv_bedrockguardrailversion = lo_bedrockguardrailconfigu->get_version( ).
          ENDIF.
          lv_bedrocktracestatus = lo_bedrockmodelspecificati->get_tracestatus( ).
          lv_bedrockmodelcustompromp = lo_bedrockmodelspecificati->get_customprompt( ).
        ENDIF.
      ENDIF.
      lo_sampleutterancegenerati = lo_buildtimesettings->get_sampleutterancegenerat00( ).
      IF lo_sampleutterancegenerati IS NOT INITIAL.
        lv_boolean = lo_sampleutterancegenerati->get_enabled( ).
        lo_bedrockmodelspecificati = lo_sampleutterancegenerati->get_bedrockmodelspec( ).
        IF lo_bedrockmodelspecificati IS NOT INITIAL.
          lv_bedrockmodelarn = lo_bedrockmodelspecificati->get_modelarn( ).
          lo_bedrockguardrailconfigu = lo_bedrockmodelspecificati->get_guardrail( ).
          IF lo_bedrockguardrailconfigu IS NOT INITIAL.
            lv_bedrockguardrailidentif = lo_bedrockguardrailconfigu->get_identifier( ).
            lv_bedrockguardrailversion = lo_bedrockguardrailconfigu->get_version( ).
          ENDIF.
          lv_bedrocktracestatus = lo_bedrockmodelspecificati->get_tracestatus( ).
          lv_bedrockmodelcustompromp = lo_bedrockmodelspecificati->get_customprompt( ).
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.
  lv_speechdetectionsensitiv = lo_result->get_speechdetectsensitivity( ).
ENDIF.