Skip to content

/AWS1/CL_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

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_generativeaisettings TYPE REF TO /AWS1/CL_LM2GENERATIVEAISTGS /AWS1/CL_LM2GENERATIVEAISTGS

generativeAISettings

RETURNING

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

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

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->/aws1/if_lm2~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( 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_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|
).

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_voiceid = lo_voicesettings->get_voiceid( ).
    lv_voiceengine = lo_voicesettings->get_engine( ).
  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( ).
      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.
ENDIF.