Skip to content

/AWS1/IF_BDC=>STARTRECOMMENDATION()

About StartRecommendation

Starts a recommendation job that analyzes agent traces and generates optimization suggestions for system prompts or tool descriptions to improve agent performance.

Method Signature

METHODS /AWS1/IF_BDC~STARTRECOMMENDATION
  IMPORTING
    !IV_NAME TYPE /AWS1/BDCRECOMMENDATIONNAME OPTIONAL
    !IV_DESCRIPTION TYPE /AWS1/BDCRECDESCRIPTION OPTIONAL
    !IV_TYPE TYPE /AWS1/BDCRECOMMENDATIONTYPE OPTIONAL
    !IO_RECOMMENDATIONCONFIG TYPE REF TO /AWS1/CL_BDCRECCONFIG OPTIONAL
    !IV_CLIENTTOKEN TYPE /AWS1/BDCCLIENTTOKEN OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_bdcstartrecresponse
  RAISING
    /AWS1/CX_BDCACCESSDENIEDEX
    /AWS1/CX_BDCCONFLICTEXCEPTION
    /AWS1/CX_BDCINTERNALSERVEREX
    /AWS1/CX_BDCSERVICEQUOTAEXCDEX
    /AWS1/CX_BDCTHROTTLINGEX
    /AWS1/CX_BDCVALIDATIONEX
    /AWS1/CX_BDCCLIENTEXC
    /AWS1/CX_BDCSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_name TYPE /AWS1/BDCRECOMMENDATIONNAME /AWS1/BDCRECOMMENDATIONNAME

The name of the recommendation. Must be unique within your account.

iv_type TYPE /AWS1/BDCRECOMMENDATIONTYPE /AWS1/BDCRECOMMENDATIONTYPE

The type of recommendation to generate. Valid values are SYSTEM_PROMPT_RECOMMENDATION for system prompt optimization or TOOL_DESCRIPTION_RECOMMENDATION for tool description optimization.

io_recommendationconfig TYPE REF TO /AWS1/CL_BDCRECCONFIG /AWS1/CL_BDCRECCONFIG

The configuration for the recommendation, including the input to optimize, agent traces to analyze, and evaluation settings.

Optional arguments:

iv_description TYPE /AWS1/BDCRECDESCRIPTION /AWS1/BDCRECDESCRIPTION

The description of the recommendation.

iv_clienttoken TYPE /AWS1/BDCCLIENTTOKEN /AWS1/BDCCLIENTTOKEN

A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, the service ignores the request, but does not return an error.

RETURNING

oo_output TYPE REF TO /aws1/cl_bdcstartrecresponse /AWS1/CL_BDCSTARTRECRESPONSE

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->startrecommendation(
  io_recommendationconfig = new /aws1/cl_bdcrecconfig(
    io_systempromptrecconfig = new /aws1/cl_bdcsyspromptrecconfig(
      io_agenttraces = new /aws1/cl_bdcagenttracesconfig(
        io_cloudwatchlogs = new /aws1/cl_bdccloudwatchlogstr00(
          io_rule = new /aws1/cl_bdccloudwatchlogsrule(
            it_filters = VALUE /aws1/cl_bdccloudwatchlogsfilt=>tt_cloudwatchlogsfilterlist(
              (
                new /aws1/cl_bdccloudwatchlogsfilt(
                  io_value = new /aws1/cl_bdcfiltervalue(
                    iv_booleanvalue = ABAP_TRUE
                    iv_doublevalue = '0.1'
                    iv_stringvalue = |string|
                  )
                  iv_key = |string|
                  iv_operator = |string|
                )
              )
            )
          )
          it_loggrouparns = VALUE /aws1/cl_bdcloggrouparnlist_w=>tt_loggrouparnlist(
            ( new /aws1/cl_bdcloggrouparnlist_w( |string| ) )
          )
          it_servicenames = VALUE /aws1/cl_bdcservicenamelist_w=>tt_servicenamelist(
            ( new /aws1/cl_bdcservicenamelist_w( |string| ) )
          )
          iv_endtime = '20150101000000.0000000'
          iv_starttime = '20150101000000.0000000'
        )
        it_sessionspans = VALUE /aws1/cl_rt_document=>tt_list(
          ( /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| ) )
        )
      )
      io_evaluationconfig = new /aws1/cl_bdcrecevalconfig(
        it_evaluators = VALUE /aws1/cl_bdcrecevaltrreference=>tt_recommendationevaluatorlist(
          ( new /aws1/cl_bdcrecevaltrreference( |string| ) )
        )
      )
      io_systemprompt = new /aws1/cl_bdcsystempromptconfig(
        io_configurationbundle = new /aws1/cl_bdcsysprmptconfbundle(
          iv_bundlearn = |string|
          iv_systempromptjsonpath = |string|
          iv_versionid = |string|
        )
        iv_text = |string|
      )
    )
    io_tooldescriptionrecconfig = new /aws1/cl_bdctooldescrecconfig(
      io_agenttraces = new /aws1/cl_bdcagenttracesconfig(
        io_cloudwatchlogs = new /aws1/cl_bdccloudwatchlogstr00(
          io_rule = new /aws1/cl_bdccloudwatchlogsrule(
            it_filters = VALUE /aws1/cl_bdccloudwatchlogsfilt=>tt_cloudwatchlogsfilterlist(
              (
                new /aws1/cl_bdccloudwatchlogsfilt(
                  io_value = new /aws1/cl_bdcfiltervalue(
                    iv_booleanvalue = ABAP_TRUE
                    iv_doublevalue = '0.1'
                    iv_stringvalue = |string|
                  )
                  iv_key = |string|
                  iv_operator = |string|
                )
              )
            )
          )
          it_loggrouparns = VALUE /aws1/cl_bdcloggrouparnlist_w=>tt_loggrouparnlist(
            ( new /aws1/cl_bdcloggrouparnlist_w( |string| ) )
          )
          it_servicenames = VALUE /aws1/cl_bdcservicenamelist_w=>tt_servicenamelist(
            ( new /aws1/cl_bdcservicenamelist_w( |string| ) )
          )
          iv_endtime = '20150101000000.0000000'
          iv_starttime = '20150101000000.0000000'
        )
        it_sessionspans = VALUE /aws1/cl_rt_document=>tt_list(
          ( /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| ) )
        )
      )
      io_tooldescription = new /aws1/cl_bdctooldescsource(
        io_configurationbundle = new /aws1/cl_bdctooldescconfbundle(
          it_tools = VALUE /aws1/cl_bdcconfbndltoolentry=>tt_confbundletoolentrylist(
            (
              new /aws1/cl_bdcconfbndltoolentry(
                iv_tooldescriptionjsonpath = |string|
                iv_toolname = |string|
              )
            )
          )
          iv_bundlearn = |string|
          iv_versionid = |string|
        )
        io_tooldescriptiontext = new /aws1/cl_bdctooldesctextinput(
          it_tools = VALUE /aws1/cl_bdctooldescinput=>tt_tooldescriptionlist(
            (
              new /aws1/cl_bdctooldescinput(
                io_tooldescription = new /aws1/cl_bdctooldescconfig( |string| )
                iv_toolname = |string|
              )
            )
          )
        )
      )
    )
  )
  iv_clienttoken = |string|
  iv_description = |string|
  iv_name = |string|
  iv_type = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_recommendationid = lo_result->get_recommendationid( ).
  lv_recommendationarn = lo_result->get_recommendationarn( ).
  lv_recommendationname = lo_result->get_name( ).
  lv_recommendationdescripti = lo_result->get_description( ).
  lv_recommendationtype = lo_result->get_type( ).
  lo_recommendationconfig = lo_result->get_recommendationconfig( ).
  IF lo_recommendationconfig IS NOT INITIAL.
    lo_systempromptrecommendat = lo_recommendationconfig->get_systempromptrecconfig( ).
    IF lo_systempromptrecommendat IS NOT INITIAL.
      lo_systempromptconfig = lo_systempromptrecommendat->get_systemprompt( ).
      IF lo_systempromptconfig IS NOT INITIAL.
        lv_systemprompttext = lo_systempromptconfig->get_text( ).
        lo_systempromptconfigurati = lo_systempromptconfig->get_configurationbundle( ).
        IF lo_systempromptconfigurati IS NOT INITIAL.
          lv_configurationbundlearn = lo_systempromptconfigurati->get_bundlearn( ).
          lv_configurationbundlevers = lo_systempromptconfigurati->get_versionid( ).
          lv_string = lo_systempromptconfigurati->get_systempromptjsonpath( ).
        ENDIF.
      ENDIF.
      lo_agenttracesconfig = lo_systempromptrecommendat->get_agenttraces( ).
      IF lo_agenttracesconfig IS NOT INITIAL.
        LOOP AT lo_agenttracesconfig->get_sessionspans( ) into lo_row.
          lo_row_1 = lo_row.
          IF lo_row_1 IS NOT INITIAL.
          ENDIF.
        ENDLOOP.
        lo_cloudwatchlogstraceconf = lo_agenttracesconfig->get_cloudwatchlogs( ).
        IF lo_cloudwatchlogstraceconf IS NOT INITIAL.
          LOOP AT lo_cloudwatchlogstraceconf->get_loggrouparns( ) into lo_row_2.
            lo_row_3 = lo_row_2.
            IF lo_row_3 IS NOT INITIAL.
              lv_string = lo_row_3->get_value( ).
            ENDIF.
          ENDLOOP.
          LOOP AT lo_cloudwatchlogstraceconf->get_servicenames( ) into lo_row_4.
            lo_row_5 = lo_row_4.
            IF lo_row_5 IS NOT INITIAL.
              lv_servicename = lo_row_5->get_value( ).
            ENDIF.
          ENDLOOP.
          lv_timestamp = lo_cloudwatchlogstraceconf->get_starttime( ).
          lv_timestamp = lo_cloudwatchlogstraceconf->get_endtime( ).
          lo_cloudwatchlogsrule = lo_cloudwatchlogstraceconf->get_rule( ).
          IF lo_cloudwatchlogsrule IS NOT INITIAL.
            LOOP AT lo_cloudwatchlogsrule->get_filters( ) into lo_row_6.
              lo_row_7 = lo_row_6.
              IF lo_row_7 IS NOT INITIAL.
                lv_string = lo_row_7->get_key( ).
                lv_cloudwatchlogsfilterope = lo_row_7->get_operator( ).
                lo_filtervalue = lo_row_7->get_value( ).
                IF lo_filtervalue IS NOT INITIAL.
                  lv_filterstringvalue = lo_filtervalue->get_stringvalue( ).
                  lv_double = lo_filtervalue->get_doublevalue( ).
                  lv_boolean = lo_filtervalue->get_booleanvalue( ).
                ENDIF.
              ENDIF.
            ENDLOOP.
          ENDIF.
        ENDIF.
      ENDIF.
      lo_recommendationevaluatio = lo_systempromptrecommendat->get_evaluationconfig( ).
      IF lo_recommendationevaluatio IS NOT INITIAL.
        LOOP AT lo_recommendationevaluatio->get_evaluators( ) into lo_row_8.
          lo_row_9 = lo_row_8.
          IF lo_row_9 IS NOT INITIAL.
            lv_evaluatorarn = lo_row_9->get_evaluatorarn( ).
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDIF.
    lo_tooldescriptionrecommen = lo_recommendationconfig->get_tooldescriptionrecconfig( ).
    IF lo_tooldescriptionrecommen IS NOT INITIAL.
      lo_tooldescriptionsource = lo_tooldescriptionrecommen->get_tooldescription( ).
      IF lo_tooldescriptionsource IS NOT INITIAL.
        lo_tooldescriptiontextinpu = lo_tooldescriptionsource->get_tooldescriptiontext( ).
        IF lo_tooldescriptiontextinpu IS NOT INITIAL.
          LOOP AT lo_tooldescriptiontextinpu->get_tools( ) into lo_row_10.
            lo_row_11 = lo_row_10.
            IF lo_row_11 IS NOT INITIAL.
              lv_recommendationtoolname = lo_row_11->get_toolname( ).
              lo_tooldescriptionconfig = lo_row_11->get_tooldescription( ).
              IF lo_tooldescriptionconfig IS NOT INITIAL.
                lv_tooldescriptiontext = lo_tooldescriptionconfig->get_text( ).
              ENDIF.
            ENDIF.
          ENDLOOP.
        ENDIF.
        lo_tooldescriptionconfigur = lo_tooldescriptionsource->get_configurationbundle( ).
        IF lo_tooldescriptionconfigur IS NOT INITIAL.
          lv_configurationbundlearn = lo_tooldescriptionconfigur->get_bundlearn( ).
          lv_configurationbundlevers = lo_tooldescriptionconfigur->get_versionid( ).
          LOOP AT lo_tooldescriptionconfigur->get_tools( ) into lo_row_12.
            lo_row_13 = lo_row_12.
            IF lo_row_13 IS NOT INITIAL.
              lv_recommendationtoolname = lo_row_13->get_toolname( ).
              lv_string = lo_row_13->get_tooldescriptionjsonpath( ).
            ENDIF.
          ENDLOOP.
        ENDIF.
      ENDIF.
      lo_agenttracesconfig = lo_tooldescriptionrecommen->get_agenttraces( ).
      IF lo_agenttracesconfig IS NOT INITIAL.
        LOOP AT lo_agenttracesconfig->get_sessionspans( ) into lo_row.
          lo_row_1 = lo_row.
          IF lo_row_1 IS NOT INITIAL.
          ENDIF.
        ENDLOOP.
        lo_cloudwatchlogstraceconf = lo_agenttracesconfig->get_cloudwatchlogs( ).
        IF lo_cloudwatchlogstraceconf IS NOT INITIAL.
          LOOP AT lo_cloudwatchlogstraceconf->get_loggrouparns( ) into lo_row_2.
            lo_row_3 = lo_row_2.
            IF lo_row_3 IS NOT INITIAL.
              lv_string = lo_row_3->get_value( ).
            ENDIF.
          ENDLOOP.
          LOOP AT lo_cloudwatchlogstraceconf->get_servicenames( ) into lo_row_4.
            lo_row_5 = lo_row_4.
            IF lo_row_5 IS NOT INITIAL.
              lv_servicename = lo_row_5->get_value( ).
            ENDIF.
          ENDLOOP.
          lv_timestamp = lo_cloudwatchlogstraceconf->get_starttime( ).
          lv_timestamp = lo_cloudwatchlogstraceconf->get_endtime( ).
          lo_cloudwatchlogsrule = lo_cloudwatchlogstraceconf->get_rule( ).
          IF lo_cloudwatchlogsrule IS NOT INITIAL.
            LOOP AT lo_cloudwatchlogsrule->get_filters( ) into lo_row_6.
              lo_row_7 = lo_row_6.
              IF lo_row_7 IS NOT INITIAL.
                lv_string = lo_row_7->get_key( ).
                lv_cloudwatchlogsfilterope = lo_row_7->get_operator( ).
                lo_filtervalue = lo_row_7->get_value( ).
                IF lo_filtervalue IS NOT INITIAL.
                  lv_filterstringvalue = lo_filtervalue->get_stringvalue( ).
                  lv_double = lo_filtervalue->get_doublevalue( ).
                  lv_boolean = lo_filtervalue->get_booleanvalue( ).
                ENDIF.
              ENDIF.
            ENDLOOP.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.
  lv_recommendationstatus = lo_result->get_status( ).
  lv_timestamp = lo_result->get_createdat( ).
  lv_timestamp = lo_result->get_updatedat( ).
ENDIF.