/AWS1/CL_BDA=>GETPROMPT()
¶
About GetPrompt¶
Retrieves information about the working draft (DRAFT
version) of a prompt or a version of it, depending on whether you include the promptVersion
field or not. For more information, see View information about prompts using Prompt management and View information about a version of your prompt in the Amazon Bedrock User Guide.
Method Signature¶
IMPORTING¶
Required arguments:¶
iv_promptidentifier
TYPE /AWS1/BDAPROMPTIDENTIFIER
/AWS1/BDAPROMPTIDENTIFIER
¶
The unique identifier of the prompt.
Optional arguments:¶
iv_promptversion
TYPE /AWS1/BDAVERSION
/AWS1/BDAVERSION
¶
The version of the prompt about which you want to retrieve information. Omit this field to return information about the working draft of the prompt.
RETURNING¶
oo_output
TYPE REF TO /aws1/cl_bdagetpromptresponse
/AWS1/CL_BDAGETPROMPTRESPONSE
¶
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_bda~getprompt(
iv_promptidentifier = |string|
iv_promptversion = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lv_promptname = lo_result->get_name( ).
lv_promptdescription = lo_result->get_description( ).
lv_kmskeyarn = lo_result->get_customerencryptionkeyarn( ).
lv_promptvariantname = lo_result->get_defaultvariant( ).
LOOP AT lo_result->get_variants( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lv_promptvariantname = lo_row_1->get_name( ).
lv_prompttemplatetype = lo_row_1->get_templatetype( ).
lo_prompttemplateconfigura = lo_row_1->get_templateconfiguration( ).
IF lo_prompttemplateconfigura IS NOT INITIAL.
lo_textprompttemplateconfi = lo_prompttemplateconfigura->get_text( ).
IF lo_textprompttemplateconfi IS NOT INITIAL.
lv_textprompt = lo_textprompttemplateconfi->get_text( ).
lo_cachepointblock = lo_textprompttemplateconfi->get_cachepoint( ).
IF lo_cachepointblock IS NOT INITIAL.
lv_cachepointtype = lo_cachepointblock->get_type( ).
ENDIF.
LOOP AT lo_textprompttemplateconfi->get_inputvariables( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_promptinputvariablename = lo_row_3->get_name( ).
ENDIF.
ENDLOOP.
ENDIF.
lo_chatprompttemplateconfi = lo_prompttemplateconfigura->get_chat( ).
IF lo_chatprompttemplateconfi IS NOT INITIAL.
LOOP AT lo_chatprompttemplateconfi->get_messages( ) into lo_row_4.
lo_row_5 = lo_row_4.
IF lo_row_5 IS NOT INITIAL.
lv_conversationrole = lo_row_5->get_role( ).
LOOP AT lo_row_5->get_content( ) into lo_row_6.
lo_row_7 = lo_row_6.
IF lo_row_7 IS NOT INITIAL.
lv_string = lo_row_7->get_text( ).
lo_cachepointblock = lo_row_7->get_cachepoint( ).
IF lo_cachepointblock IS NOT INITIAL.
lv_cachepointtype = lo_cachepointblock->get_type( ).
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
LOOP AT lo_chatprompttemplateconfi->get_system( ) into lo_row_8.
lo_row_9 = lo_row_8.
IF lo_row_9 IS NOT INITIAL.
lv_nonemptystring = lo_row_9->get_text( ).
lo_cachepointblock = lo_row_9->get_cachepoint( ).
IF lo_cachepointblock IS NOT INITIAL.
lv_cachepointtype = lo_cachepointblock->get_type( ).
ENDIF.
ENDIF.
ENDLOOP.
LOOP AT lo_chatprompttemplateconfi->get_inputvariables( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_promptinputvariablename = lo_row_3->get_name( ).
ENDIF.
ENDLOOP.
lo_toolconfiguration = lo_chatprompttemplateconfi->get_toolconfiguration( ).
IF lo_toolconfiguration IS NOT INITIAL.
LOOP AT lo_toolconfiguration->get_tools( ) into lo_row_10.
lo_row_11 = lo_row_10.
IF lo_row_11 IS NOT INITIAL.
lo_toolspecification = lo_row_11->get_toolspec( ).
IF lo_toolspecification IS NOT INITIAL.
lv_toolname = lo_toolspecification->get_name( ).
lv_nonemptystring = lo_toolspecification->get_description( ).
lo_toolinputschema = lo_toolspecification->get_inputschema( ).
IF lo_toolinputschema IS NOT INITIAL.
lo_value = lo_toolinputschema->get_json( ).
IF lo_value IS NOT INITIAL.
ENDIF.
ENDIF.
ENDIF.
lo_cachepointblock = lo_row_11->get_cachepoint( ).
IF lo_cachepointblock IS NOT INITIAL.
lv_cachepointtype = lo_cachepointblock->get_type( ).
ENDIF.
ENDIF.
ENDLOOP.
lo_toolchoice = lo_toolconfiguration->get_toolchoice( ).
IF lo_toolchoice IS NOT INITIAL.
lo_autotoolchoice = lo_toolchoice->get_auto( ).
IF lo_autotoolchoice IS NOT INITIAL.
ENDIF.
lo_anytoolchoice = lo_toolchoice->get_any( ).
IF lo_anytoolchoice IS NOT INITIAL.
ENDIF.
lo_specifictoolchoice = lo_toolchoice->get_tool( ).
IF lo_specifictoolchoice IS NOT INITIAL.
lv_toolname = lo_specifictoolchoice->get_name( ).
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
lv_promptmodelidentifier = lo_row_1->get_modelid( ).
lo_promptinferenceconfigur = lo_row_1->get_inferenceconfiguration( ).
IF lo_promptinferenceconfigur IS NOT INITIAL.
lo_promptmodelinferencecon = lo_promptinferenceconfigur->get_text( ).
IF lo_promptmodelinferencecon IS NOT INITIAL.
lv_temperature = lo_promptmodelinferencecon->get_temperature( ).
lv_topp = lo_promptmodelinferencecon->get_topp( ).
lv_maximumlength = lo_promptmodelinferencecon->get_maxtokens( ).
LOOP AT lo_promptmodelinferencecon->get_stopsequences( ) into lo_row_12.
lo_row_13 = lo_row_12.
IF lo_row_13 IS NOT INITIAL.
lv_string = lo_row_13->get_value( ).
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
LOOP AT lo_row_1->get_metadata( ) into lo_row_14.
lo_row_15 = lo_row_14.
IF lo_row_15 IS NOT INITIAL.
lv_promptmetadatakey = lo_row_15->get_key( ).
lv_promptmetadatavalue = lo_row_15->get_value( ).
ENDIF.
ENDLOOP.
lo_value = lo_row_1->get_addlmodelrequestfields( ).
IF lo_value IS NOT INITIAL.
ENDIF.
lo_promptgenairesource = lo_row_1->get_genairesource( ).
IF lo_promptgenairesource IS NOT INITIAL.
lo_promptagentresource = lo_promptgenairesource->get_agent( ).
IF lo_promptagentresource IS NOT INITIAL.
lv_agentaliasarn = lo_promptagentresource->get_agentidentifier( ).
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
lv_promptid = lo_result->get_id( ).
lv_promptarn = lo_result->get_arn( ).
lv_version = lo_result->get_version( ).
lv_datetimestamp = lo_result->get_createdat( ).
lv_datetimestamp = lo_result->get_updatedat( ).
ENDIF.