Skip to content

/AWS1/IF_BDK=>CREATEAUTOMATEDREASONINGPLY()

About CreateAutomatedReasoningPolicy

Creates an Automated Reasoning policy for Amazon Bedrock Guardrails. Automated Reasoning policies use mathematical techniques to detect hallucinations, suggest corrections, and highlight unstated assumptions in the responses of your GenAI application.

To create a policy, you upload a source document that describes the rules that you're encoding. Automated Reasoning extracts important concepts from the source document that will become variables in the policy and infers policy rules.

Method Signature

METHODS /AWS1/IF_BDK~CREATEAUTOMATEDREASONINGPLY
  IMPORTING
    !IV_NAME TYPE /AWS1/BDKAUTOMATEDRSNINGPLYN00 OPTIONAL
    !IV_DESCRIPTION TYPE /AWS1/BDKAUTOMATEDRSNINGPLYDSC OPTIONAL
    !IV_CLIENTREQUESTTOKEN TYPE /AWS1/BDKIDEMPOTENCYTOKEN OPTIONAL
    !IO_POLICYDEFINITION TYPE REF TO /AWS1/CL_BDKAUTOMATEDRSNINGP00 OPTIONAL
    !IV_KMSKEYID TYPE /AWS1/BDKKMSKEYID OPTIONAL
    !IT_TAGS TYPE /AWS1/CL_BDKTAG=>TT_TAGLIST OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_bdkcreautomatedrsni05
  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_name TYPE /AWS1/BDKAUTOMATEDRSNINGPLYN00 /AWS1/BDKAUTOMATEDRSNINGPLYN00

A unique name for the Automated Reasoning policy. The name must be between 1 and 63 characters and can contain letters, numbers, hyphens, and underscores.

Optional arguments:

iv_description TYPE /AWS1/BDKAUTOMATEDRSNINGPLYDSC /AWS1/BDKAUTOMATEDRSNINGPLYDSC

A description of the Automated Reasoning policy. Use this to provide context about the policy's purpose and the types of validations it performs.

iv_clientrequesttoken TYPE /AWS1/BDKIDEMPOTENCYTOKEN /AWS1/BDKIDEMPOTENCYTOKEN

A unique, case-sensitive identifier to ensure that the operation completes no more than once. If this token matches a previous request, Amazon Bedrock ignores the request but doesn't return an error.

io_policydefinition TYPE REF TO /AWS1/CL_BDKAUTOMATEDRSNINGP00 /AWS1/CL_BDKAUTOMATEDRSNINGP00

The policy definition that contains the formal logic rules, variables, and custom variable types used to validate foundation model responses in your application.

iv_kmskeyid TYPE /AWS1/BDKKMSKEYID /AWS1/BDKKMSKEYID

The identifier of the KMS key to use for encrypting the automated reasoning policy and its associated artifacts. If you don't specify a KMS key, Amazon Bedrock uses an KMS managed key for encryption. For enhanced security and control, you can specify a customer managed KMS key.

it_tags TYPE /AWS1/CL_BDKTAG=>TT_TAGLIST TT_TAGLIST

A list of tags to associate with the Automated Reasoning policy. Tags help you organize and manage your policies.

RETURNING

oo_output TYPE REF TO /aws1/cl_bdkcreautomatedrsni05 /AWS1/CL_BDKCREAUTOMATEDRSNI05

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->createautomatedreasoningply(
  io_policydefinition = new /aws1/cl_bdkautomatedrsningp00(
    it_rules = VALUE /aws1/cl_bdkautomatedrsningp03=>tt_automatedrsningplydefnrllst(
      (
        new /aws1/cl_bdkautomatedrsningp03(
          iv_alternateexpression = |string|
          iv_expression = |string|
          iv_id = |string|
        )
      )
    )
    it_types = VALUE /aws1/cl_bdkautomatedrsningp01=>tt_automatedrsningplydeftype00(
      (
        new /aws1/cl_bdkautomatedrsningp01(
          it_values = VALUE /aws1/cl_bdkautomatedrsningp02=>tt_automatedrsningplydeftype01(
            (
              new /aws1/cl_bdkautomatedrsningp02(
                iv_description = |string|
                iv_value = |string|
              )
            )
          )
          iv_description = |string|
          iv_name = |string|
        )
      )
    )
    it_variables = VALUE /aws1/cl_bdkautomatedrsningp04=>tt_automatedrsningplydefvari00(
      (
        new /aws1/cl_bdkautomatedrsningp04(
          iv_description = |string|
          iv_name = |string|
          iv_type = |string|
        )
      )
    )
    iv_version = |string|
  )
  it_tags = VALUE /aws1/cl_bdktag=>tt_taglist(
    (
      new /aws1/cl_bdktag(
        iv_key = |string|
        iv_value = |string|
      )
    )
  )
  iv_clientrequesttoken = |string|
  iv_description = |string|
  iv_kmskeyid = |string|
  iv_name = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_automatedreasoningpolic = lo_result->get_policyarn( ).
  lv_automatedreasoningpolic_1 = lo_result->get_version( ).
  lv_automatedreasoningpolic_2 = lo_result->get_name( ).
  lv_automatedreasoningpolic_3 = lo_result->get_description( ).
  lv_automatedreasoningpolic_4 = lo_result->get_definitionhash( ).
  lv_timestamp = lo_result->get_createdat( ).
  lv_timestamp = lo_result->get_updatedat( ).
ENDIF.