/AWS1/CL_QQC=>QUERYASSISTANT()
¶
About QueryAssistant¶
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.
Performs a manual search against the specified assistant. To retrieve recommendations for an assistant, use GetRecommendations.
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.
Optional arguments:¶
iv_querytext
TYPE /AWS1/QQCQUERYTEXT
/AWS1/QQCQUERYTEXT
¶
The text to search for.
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.
iv_sessionid
TYPE /AWS1/QQCUUIDORARN
/AWS1/QQCUUIDORARN
¶
The identifier of the Amazon Q in Connect session. Can be either the ID or the ARN. URLs cannot contain the ARN.
it_querycondition
TYPE /AWS1/CL_QQCQUERYCONDITION=>TT_QUERYCONDITIONEXPRESSION
TT_QUERYCONDITIONEXPRESSION
¶
Information about how to query content.
io_queryinputdata
TYPE REF TO /AWS1/CL_QQCQUERYINPUTDATA
/AWS1/CL_QQCQUERYINPUTDATA
¶
Information about the query.
iv_overrideknowledgebasesr00
TYPE /AWS1/QQCKNOWLEDGEBASESRCHTYPE
/AWS1/QQCKNOWLEDGEBASESRCHTYPE
¶
The search type to be used against the Knowledge Base for this request. The values can be
SEMANTIC
which uses vector embeddings orHYBRID
which use vector embeddings and raw text.
RETURNING¶
oo_output
TYPE REF TO /aws1/cl_qqcqueryassistantrsp
/AWS1/CL_QQCQUERYASSISTANTRSP
¶
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~queryassistant(
io_queryinputdata = new /aws1/cl_qqcqueryinputdata(
io_intentinputdata = new /aws1/cl_qqcintentinputdata( |string| )
io_querytextinputdata = new /aws1/cl_qqcquerytextinputdata( |string| )
)
it_querycondition = VALUE /aws1/cl_qqcquerycondition=>tt_queryconditionexpression(
(
new /aws1/cl_qqcquerycondition(
io_single = new /aws1/cl_qqcqueryconditionitem(
iv_comparator = |string|
iv_field = |string|
iv_value = |string|
)
)
)
)
iv_assistantid = |string|
iv_maxresults = 123
iv_nexttoken = |string|
iv_overrideknowledgebasesr00 = |string|
iv_querytext = |string|
iv_sessionid = |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_results( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lv_uuid = lo_row_1->get_resultid( ).
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( ).
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.
lv_queryresulttype = lo_row_1->get_type( ).
ENDIF.
ENDLOOP.
lv_nexttoken = lo_result->get_nexttoken( ).
ENDIF.