Skip to content

/AWS1/IF_QQC=>LISTMODELS()

About ListModels

Lists the models available to an Amazon Q in Connect assistant in the assistant's Amazon Web Services Region. The available models are determined by the region of the specified assistant.

Method Signature

METHODS /AWS1/IF_QQC~LISTMODELS
  IMPORTING
    !IV_ASSISTANTID TYPE /AWS1/QQCUUIDORARN OPTIONAL
    !IV_AIPROMPTTYPE TYPE /AWS1/QQCAIPROMPTTYPE OPTIONAL
    !IV_MODELLIFECYCLE TYPE /AWS1/QQCMODELLIFECYCLE OPTIONAL
    !IV_NEXTTOKEN TYPE /AWS1/QQCNEXTTOKEN OPTIONAL
    !IV_MAXRESULTS TYPE /AWS1/QQCMAXRESULTS OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_qqclistmodelsresponse
  RAISING
    /AWS1/CX_QQCACCESSDENIEDEX
    /AWS1/CX_QQCCONFLICTEXCEPTION
    /AWS1/CX_QQCRESOURCENOTFOUNDEX
    /AWS1/CX_QQCTHROTTLINGEX
    /AWS1/CX_QQCUNAUTHORIZEDEX
    /AWS1/CX_QQCVALIDATIONEX
    /AWS1/CX_QQCCLIENTEXC
    /AWS1/CX_QQCSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_assistantid TYPE /AWS1/QQCUUIDORARN /AWS1/QQCUUIDORARN

The identifier of the Amazon Q in Connect assistant. Can be either the ID or the ARN. URLs cannot contain the ARN. The assistant's region determines which models are available.

Optional arguments:

iv_aiprompttype TYPE /AWS1/QQCAIPROMPTTYPE /AWS1/QQCAIPROMPTTYPE

The type of the AI Prompt to filter models by. When specified, only models that support the given AI Prompt type are returned.

iv_modellifecycle TYPE /AWS1/QQCMODELLIFECYCLE /AWS1/QQCMODELLIFECYCLE

The lifecycle status of models to filter by. When specified, only models with the given lifecycle status are returned.

iv_nexttoken TYPE /AWS1/QQCNEXTTOKEN /AWS1/QQCNEXTTOKEN

The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

iv_maxresults TYPE /AWS1/QQCMAXRESULTS /AWS1/QQCMAXRESULTS

The maximum number of results to return per page.

RETURNING

oo_output TYPE REF TO /aws1/cl_qqclistmodelsresponse /AWS1/CL_QQCLISTMODELSRESPONSE

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->listmodels(
  iv_aiprompttype = |string|
  iv_assistantid = |string|
  iv_maxresults = 123
  iv_modellifecycle = |string|
  iv_nexttoken = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  LOOP AT lo_result->get_modelsummaries( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_modelid = lo_row_1->get_modelid( ).
      lv_modeldisplayname = lo_row_1->get_displayname( ).
      lv_crossregionstatus = lo_row_1->get_crossregionstatus( ).
      lv_boolean = lo_row_1->get_supportspromptcaching( ).
      LOOP AT lo_row_1->get_supportedaiprompttypes( ) into lo_row_2.
        lo_row_3 = lo_row_2.
        IF lo_row_3 IS NOT INITIAL.
          lv_aiprompttype = lo_row_3->get_value( ).
        ENDIF.
      ENDLOOP.
      lv_modellifecycle = lo_row_1->get_modellifecycle( ).
      lv_timestamp = lo_row_1->get_legacytimestamp( ).
      lv_timestamp = lo_row_1->get_endoflifetimestamp( ).
    ENDIF.
  ENDLOOP.
  lv_nexttoken = lo_result->get_nexttoken( ).
ENDIF.