Skip to content

/AWS1/IF_BDK=>CREATEADVNCDPROMPTOPTMZTNJOB()

About CreateAdvancedPromptOptimizationJob

Creates an advanced prompt optimization job. The job optimizes your prompt templates for specific models using your evaluation dataset and criteria.

Method Signature

METHODS /AWS1/IF_BDK~CREATEADVNCDPROMPTOPTMZTNJOB
  IMPORTING
    !IV_JOBNAME TYPE /AWS1/BDKADVDPROPTMZJOBNAME OPTIONAL
    !IV_JOBDESCRIPTION TYPE /AWS1/BDKADVDPROMPTOPTMZJOBDSC OPTIONAL
    !IV_CLIENTTOKEN TYPE /AWS1/BDKIDEMPOTENCYTOKEN OPTIONAL
    !IO_INPUTCONFIG TYPE REF TO /AWS1/CL_BDKADVDPROPTMZINPCFG OPTIONAL
    !IO_OUTPUTCONFIG TYPE REF TO /AWS1/CL_BDKADVDPROPTMZOUTCFG OPTIONAL
    !IV_ENCRYPTIONKEYARN TYPE /AWS1/BDKKMSKEYARN OPTIONAL
    !IT_TAGS TYPE /AWS1/CL_BDKTAG=>TT_TAGLIST OPTIONAL
    !IT_MODELCONFIGURATIONS TYPE /AWS1/CL_BDKMODELCONFIGURATION=>TT_MODELCONFIGURATIONS OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_bdkcreadvproptjobrsp
  RAISING
    /AWS1/CX_BDKACCESSDENIEDEX
    /AWS1/CX_BDKCONFLICTEXCEPTION
    /AWS1/CX_BDKINTERNALSERVEREX
    /AWS1/CX_BDKRESOURCENOTFOUNDEX
    /AWS1/CX_BDKSERVICEQUOTAEXCDEX
    /AWS1/CX_BDKTHROTTLINGEX
    /AWS1/CX_BDKTOOMANYTAGSEX
    /AWS1/CX_BDKVALIDATIONEX
    /AWS1/CX_BDKCLIENTEXC
    /AWS1/CX_BDKSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_jobname TYPE /AWS1/BDKADVDPROPTMZJOBNAME /AWS1/BDKADVDPROPTMZJOBNAME

A name for the advanced prompt optimization job.

io_inputconfig TYPE REF TO /AWS1/CL_BDKADVDPROPTMZINPCFG /AWS1/CL_BDKADVDPROPTMZINPCFG

Specifies the S3 location of your JSONL input file containing prompt templates and evaluation samples.

io_outputconfig TYPE REF TO /AWS1/CL_BDKADVDPROPTMZOUTCFG /AWS1/CL_BDKADVDPROPTMZOUTCFG

Specifies the S3 location where optimization results will be stored.

it_modelconfigurations TYPE /AWS1/CL_BDKMODELCONFIGURATION=>TT_MODELCONFIGURATIONS TT_MODELCONFIGURATIONS

A list of model configurations specifying the target models for prompt optimization. You can specify up to 5 models.

Optional arguments:

iv_jobdescription TYPE /AWS1/BDKADVDPROMPTOPTMZJOBDSC /AWS1/BDKADVDPROMPTOPTMZJOBDSC

A description of the advanced prompt optimization job.

iv_clienttoken TYPE /AWS1/BDKIDEMPOTENCYTOKEN /AWS1/BDKIDEMPOTENCYTOKEN

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

iv_encryptionkeyarn TYPE /AWS1/BDKKMSKEYARN /AWS1/BDKKMSKEYARN

The Amazon Resource Name (ARN) of the KMS key used for encrypting the output data. If not specified, the output is encrypted with an Amazon-owned KMS key.

it_tags TYPE /AWS1/CL_BDKTAG=>TT_TAGLIST TT_TAGLIST

Tags to associate with the advanced prompt optimization job.

RETURNING

oo_output TYPE REF TO /aws1/cl_bdkcreadvproptjobrsp /AWS1/CL_BDKCREADVPROPTJOBRSP

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->createadvncdpromptoptmztnjob(
  io_inputconfig = new /aws1/cl_bdkadvdproptmzinpcfg( |string| )
  io_outputconfig = new /aws1/cl_bdkadvdproptmzoutcfg( |string| )
  it_modelconfigurations = VALUE /aws1/cl_bdkmodelconfiguration=>tt_modelconfigurations(
    (
      new /aws1/cl_bdkmodelconfiguration(
        io_inferenceconfig = new /aws1/cl_bdkinferenceconf(
          it_stopsequences = VALUE /aws1/cl_bdknonemptystrlist_w=>tt_nonemptystringlist(
            ( new /aws1/cl_bdknonemptystrlist_w( |string| ) )
          )
          iv_maxtokens = 123
          iv_temperature = '0.1'
          iv_topp = '0.1'
        )
        it_addlmodelrequestfields = VALUE /aws1/cl_rt_document=>tt_map(
          (
            VALUE /aws1/cl_rt_document=>ts_document_maprow(
              key = |string|
              value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
            )
          )
        )
        iv_modelid = |string|
      )
    )
  )
  it_tags = VALUE /aws1/cl_bdktag=>tt_taglist(
    (
      new /aws1/cl_bdktag(
        iv_key = |string|
        iv_value = |string|
      )
    )
  )
  iv_clienttoken = |string|
  iv_encryptionkeyarn = |string|
  iv_jobdescription = |string|
  iv_jobname = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_advancedpromptoptimizat = lo_result->get_jobarn( ).
ENDIF.