Skip to content

/AWS1/IF_SGJ=>UPDATEREWARD()

About UpdateReward

Updates the reward values for a trajectory and transitions it to reward-received status, signaling that it is eligible for processing. Call this operation after CompleteRollout to provide the computed reward scores.

Method Signature

METHODS /AWS1/IF_SGJ~UPDATEREWARD
  IMPORTING
    !IV_JOBARN TYPE /AWS1/SGJJOBARN OPTIONAL
    !IV_TRAJECTORYID TYPE /AWS1/SGJTRAJECTORYID OPTIONAL
    !IT_REWARDS TYPE /AWS1/CL_SGJDOUBLELIST_W=>TT_DOUBLELIST OPTIONAL
    !IV_CLIENTTOKEN TYPE /AWS1/SGJSTRING OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_sgjupdaterewardrsp
  RAISING
    /AWS1/CX_SGJACCESSDENIEDEX
    /AWS1/CX_SGJCONFLICTEXCEPTION
    /AWS1/CX_SGJINTSERVICEERROR
    /AWS1/CX_SGJRESOURCENOTFOUNDEX
    /AWS1/CX_SGJSERVICEQUOTAEXCDEX
    /AWS1/CX_SGJTHROTTLINGEX
    /AWS1/CX_SGJVLDTNEXCEPTION
    /AWS1/CX_SGJCLIENTEXC
    /AWS1/CX_SGJSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_jobarn TYPE /AWS1/SGJJOBARN /AWS1/SGJJOBARN

The job ARN.

iv_trajectoryid TYPE /AWS1/SGJTRAJECTORYID /AWS1/SGJTRAJECTORYID

The trajectory ID to update with reward values.

it_rewards TYPE /AWS1/CL_SGJDOUBLELIST_W=>TT_DOUBLELIST TT_DOUBLELIST

The list of reward values to assign to this trajectory. Provide one reward value per turn in the trajectory.

Optional arguments:

iv_clienttoken TYPE /AWS1/SGJSTRING /AWS1/SGJSTRING

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

RETURNING

oo_output TYPE REF TO /aws1/cl_sgjupdaterewardrsp /AWS1/CL_SGJUPDATEREWARDRSP

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->updatereward(
  it_rewards = VALUE /aws1/cl_sgjdoublelist_w=>tt_doublelist(
    ( new /aws1/cl_sgjdoublelist_w( |0.1| ) )
  )
  iv_clienttoken = |string|
  iv_jobarn = |string|
  iv_trajectoryid = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
ENDIF.

Invoke UpdateReward

Updates the reward values for a completed trajectory.

DATA(lo_result) = lo_client->updatereward(
  it_rewards = VALUE /aws1/cl_sgjdoublelist_w=>tt_doublelist(
    ( new /aws1/cl_sgjdoublelist_w( |0.85| ) )
    ( new /aws1/cl_sgjdoublelist_w( |0.92| ) )
    ( new /aws1/cl_sgjdoublelist_w( |0.78| ) )
  )
  iv_jobarn = |arn:aws:sagemaker:us-east-1:123456789012:job/AgentRFT/my-training-job|
  iv_trajectoryid = |trajectory-001|
).