/AWS1/CL_QQC=>GETRECOMMENDATIONS()
¶
About GetRecommendations¶
This API will be discontinued starting June 1, 2024. To receive generative responses after March 1, 2024, you will need to create a new Assistant in the Amazon Connect console and integrate the Amazon Q in Connect JavaScript library (amazon-q-connectjs) into your applications.
Retrieves recommendations for the specified session. To avoid retrieving the same recommendations in subsequent calls, use NotifyRecommendationsReceived. This API supports long-polling behavior with the waitTimeSeconds
parameter. Short poll is the default behavior and only returns recommendations already available. To perform a manual query against an assistant, use QueryAssistant.
Method Signature¶
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.
iv_sessionid
TYPE /AWS1/QQCUUIDORARN
/AWS1/QQCUUIDORARN
¶
The identifier of the session. Can be either the ID or the ARN. URLs cannot contain the ARN.
Optional arguments:¶
iv_maxresults
TYPE /AWS1/QQCMAXRESULTS
/AWS1/QQCMAXRESULTS
¶
The maximum number of results to return per page.
iv_waittimeseconds
TYPE /AWS1/QQCWAITTIMESECONDS
/AWS1/QQCWAITTIMESECONDS
¶
The duration (in seconds) for which the call waits for a recommendation to be made available before returning. If a recommendation is available, the call returns sooner than
WaitTimeSeconds
. If no messages are available and the wait time expires, the call returns successfully with an empty list.
iv_nextchunktoken
TYPE /AWS1/QQCNEXTTOKEN
/AWS1/QQCNEXTTOKEN
¶
The token for the next set of chunks. Use the value returned in the previous response in the next request to retrieve the next set of chunks.
RETURNING¶
oo_output
TYPE REF TO /aws1/cl_qqcgetrecommendatio01
/AWS1/CL_QQCGETRECOMMENDATIO01
¶
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_qqc~getrecommendations(
iv_assistantid = |string|
iv_maxresults = 123
iv_nextchunktoken = |string|
iv_sessionid = |string|
iv_waittimeseconds = 123
).
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_recommendations( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lv_recommendationid = lo_row_1->get_recommendationid( ).
lo_document = lo_row_1->get_document( ).
IF lo_document IS NOT INITIAL.
lo_contentreference = lo_document->get_contentreference( ).
IF lo_contentreference IS NOT INITIAL.
lv_arn = lo_contentreference->get_knowledgebasearn( ).
lv_uuid = lo_contentreference->get_knowledgebaseid( ).
lv_arn = lo_contentreference->get_contentarn( ).
lv_uuid = lo_contentreference->get_contentid( ).
lv_string = lo_contentreference->get_sourceurl( ).
lv_referencetype = lo_contentreference->get_referencetype( ).
ENDIF.
lo_documenttext = lo_document->get_title( ).
IF lo_documenttext IS NOT INITIAL.
lv_sensitivestring = lo_documenttext->get_text( ).
LOOP AT lo_documenttext->get_highlights( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_highlightoffset = lo_row_3->get_beginoffsetinclusive( ).
lv_highlightoffset = lo_row_3->get_endoffsetexclusive( ).
ENDIF.
ENDLOOP.
ENDIF.
lo_documenttext = lo_document->get_excerpt( ).
IF lo_documenttext IS NOT INITIAL.
lv_sensitivestring = lo_documenttext->get_text( ).
LOOP AT lo_documenttext->get_highlights( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_highlightoffset = lo_row_3->get_beginoffsetinclusive( ).
lv_highlightoffset = lo_row_3->get_endoffsetexclusive( ).
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
lv_relevancescore = lo_row_1->get_relevancescore( ).
lv_relevancelevel = lo_row_1->get_relevancelevel( ).
lv_recommendationtype = lo_row_1->get_type( ).
lo_datasummary = lo_row_1->get_data( ).
IF lo_datasummary IS NOT INITIAL.
lo_datareference = lo_datasummary->get_reference( ).
IF lo_datareference IS NOT INITIAL.
lo_contentreference = lo_datareference->get_contentreference( ).
IF lo_contentreference IS NOT INITIAL.
lv_arn = lo_contentreference->get_knowledgebasearn( ).
lv_uuid = lo_contentreference->get_knowledgebaseid( ).
lv_arn = lo_contentreference->get_contentarn( ).
lv_uuid = lo_contentreference->get_contentid( ).
lv_string = lo_contentreference->get_sourceurl( ).
lv_referencetype = lo_contentreference->get_referencetype( ).
ENDIF.
lo_generativereference = lo_datareference->get_generativereference( ).
IF lo_generativereference IS NOT INITIAL.
lv_llmmodelid = lo_generativereference->get_modelid( ).
lv_uuid = lo_generativereference->get_generationid( ).
ENDIF.
ENDIF.
lo_datadetails = lo_datasummary->get_details( ).
IF lo_datadetails IS NOT INITIAL.
lo_contentdatadetails = lo_datadetails->get_contentdata( ).
IF lo_contentdatadetails IS NOT INITIAL.
lo_textdata = lo_contentdatadetails->get_textdata( ).
IF lo_textdata IS NOT INITIAL.
lo_documenttext = lo_textdata->get_title( ).
IF lo_documenttext IS NOT INITIAL.
lv_sensitivestring = lo_documenttext->get_text( ).
LOOP AT lo_documenttext->get_highlights( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_highlightoffset = lo_row_3->get_beginoffsetinclusive( ).
lv_highlightoffset = lo_row_3->get_endoffsetexclusive( ).
ENDIF.
ENDLOOP.
ENDIF.
lo_documenttext = lo_textdata->get_excerpt( ).
IF lo_documenttext IS NOT INITIAL.
lv_sensitivestring = lo_documenttext->get_text( ).
LOOP AT lo_documenttext->get_highlights( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_highlightoffset = lo_row_3->get_beginoffsetinclusive( ).
lv_highlightoffset = lo_row_3->get_endoffsetexclusive( ).
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
lo_rankingdata = lo_contentdatadetails->get_rankingdata( ).
IF lo_rankingdata IS NOT INITIAL.
lv_relevancescore = lo_rankingdata->get_relevancescore( ).
lv_relevancelevel = lo_rankingdata->get_relevancelevel( ).
ENDIF.
ENDIF.
lo_generativedatadetails = lo_datadetails->get_generativedata( ).
IF lo_generativedatadetails IS NOT INITIAL.
lv_sensitivestring = lo_generativedatadetails->get_completion( ).
LOOP AT lo_generativedatadetails->get_references( ) into lo_row_4.
lo_row_5 = lo_row_4.
IF lo_row_5 IS NOT INITIAL.
lo_datareference = lo_row_5->get_reference( ).
IF lo_datareference IS NOT INITIAL.
lo_contentreference = lo_datareference->get_contentreference( ).
IF lo_contentreference IS NOT INITIAL.
lv_arn = lo_contentreference->get_knowledgebasearn( ).
lv_uuid = lo_contentreference->get_knowledgebaseid( ).
lv_arn = lo_contentreference->get_contentarn( ).
lv_uuid = lo_contentreference->get_contentid( ).
lv_string = lo_contentreference->get_sourceurl( ).
lv_referencetype = lo_contentreference->get_referencetype( ).
ENDIF.
lo_generativereference = lo_datareference->get_generativereference( ).
IF lo_generativereference IS NOT INITIAL.
lv_llmmodelid = lo_generativereference->get_modelid( ).
lv_uuid = lo_generativereference->get_generationid( ).
ENDIF.
ENDIF.
" Skipping lo_row_4 to avoid recursion
ENDIF.
ENDLOOP.
lo_rankingdata = lo_generativedatadetails->get_rankingdata( ).
IF lo_rankingdata IS NOT INITIAL.
lv_relevancescore = lo_rankingdata->get_relevancescore( ).
lv_relevancelevel = lo_rankingdata->get_relevancelevel( ).
ENDIF.
ENDIF.
lo_intentdetecteddatadetai = lo_datadetails->get_intentdetecteddata( ).
IF lo_intentdetecteddatadetai IS NOT INITIAL.
lv_sensitivestring = lo_intentdetecteddatadetai->get_intent( ).
lv_uuid = lo_intentdetecteddatadetai->get_intentid( ).
ENDIF.
lo_sourcecontentdatadetail = lo_datadetails->get_sourcecontentdata( ).
IF lo_sourcecontentdatadetail IS NOT INITIAL.
lv_uuid = lo_sourcecontentdatadetail->get_id( ).
lv_sourcecontenttype = lo_sourcecontentdatadetail->get_type( ).
lo_textdata = lo_sourcecontentdatadetail->get_textdata( ).
IF lo_textdata IS NOT INITIAL.
lo_documenttext = lo_textdata->get_title( ).
IF lo_documenttext IS NOT INITIAL.
lv_sensitivestring = lo_documenttext->get_text( ).
LOOP AT lo_documenttext->get_highlights( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_highlightoffset = lo_row_3->get_beginoffsetinclusive( ).
lv_highlightoffset = lo_row_3->get_endoffsetexclusive( ).
ENDIF.
ENDLOOP.
ENDIF.
lo_documenttext = lo_textdata->get_excerpt( ).
IF lo_documenttext IS NOT INITIAL.
lv_sensitivestring = lo_documenttext->get_text( ).
LOOP AT lo_documenttext->get_highlights( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_highlightoffset = lo_row_3->get_beginoffsetinclusive( ).
lv_highlightoffset = lo_row_3->get_endoffsetexclusive( ).
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
lo_rankingdata = lo_sourcecontentdatadetail->get_rankingdata( ).
IF lo_rankingdata IS NOT INITIAL.
lv_relevancescore = lo_rankingdata->get_relevancescore( ).
lv_relevancelevel = lo_rankingdata->get_relevancelevel( ).
ENDIF.
lo_citationspan = lo_sourcecontentdatadetail->get_citationspan( ).
IF lo_citationspan IS NOT INITIAL.
lv_citationspanoffset = lo_citationspan->get_beginoffsetinclusive( ).
lv_citationspanoffset = lo_citationspan->get_endoffsetexclusive( ).
ENDIF.
ENDIF.
lo_generativechunkdatadeta = lo_datadetails->get_generativechunkdata( ).
IF lo_generativechunkdatadeta IS NOT INITIAL.
lv_sensitivestring = lo_generativechunkdatadeta->get_completion( ).
LOOP AT lo_generativechunkdatadeta->get_references( ) into lo_row_4.
lo_row_5 = lo_row_4.
IF lo_row_5 IS NOT INITIAL.
lo_datareference = lo_row_5->get_reference( ).
IF lo_datareference IS NOT INITIAL.
lo_contentreference = lo_datareference->get_contentreference( ).
IF lo_contentreference IS NOT INITIAL.
lv_arn = lo_contentreference->get_knowledgebasearn( ).
lv_uuid = lo_contentreference->get_knowledgebaseid( ).
lv_arn = lo_contentreference->get_contentarn( ).
lv_uuid = lo_contentreference->get_contentid( ).
lv_string = lo_contentreference->get_sourceurl( ).
lv_referencetype = lo_contentreference->get_referencetype( ).
ENDIF.
lo_generativereference = lo_datareference->get_generativereference( ).
IF lo_generativereference IS NOT INITIAL.
lv_llmmodelid = lo_generativereference->get_modelid( ).
lv_uuid = lo_generativereference->get_generationid( ).
ENDIF.
ENDIF.
" Skipping lo_row_4 to avoid recursion
ENDIF.
ENDLOOP.
lv_nexttoken = lo_generativechunkdatadeta->get_nextchunktoken( ).
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
LOOP AT lo_result->get_triggers( ) into lo_row_6.
lo_row_7 = lo_row_6.
IF lo_row_7 IS NOT INITIAL.
lv_uuid = lo_row_7->get_id( ).
lv_recommendationtriggerty = lo_row_7->get_type( ).
lv_recommendationsourcetyp = lo_row_7->get_source( ).
lo_recommendationtriggerda = lo_row_7->get_data( ).
IF lo_recommendationtriggerda IS NOT INITIAL.
lo_queryrecommendationtrig = lo_recommendationtriggerda->get_query( ).
IF lo_queryrecommendationtrig IS NOT INITIAL.
lv_querytext = lo_queryrecommendationtrig->get_text( ).
ENDIF.
ENDIF.
LOOP AT lo_row_7->get_recommendationids( ) into lo_row_8.
lo_row_9 = lo_row_8.
IF lo_row_9 IS NOT INITIAL.
lv_recommendationid = lo_row_9->get_value( ).
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDIF.