/AWS1/CL_BDZ=>RETRIEVE()
¶
About Retrieve¶
Queries a knowledge base and retrieves information from it.
Method Signature¶
IMPORTING¶
Required arguments:¶
iv_knowledgebaseid
TYPE /AWS1/BDZKNOWLEDGEBASEID
/AWS1/BDZKNOWLEDGEBASEID
¶
The unique identifier of the knowledge base to query.
io_retrievalquery
TYPE REF TO /AWS1/CL_BDZKNOWLEDGEBASEQUERY
/AWS1/CL_BDZKNOWLEDGEBASEQUERY
¶
Contains the query to send the knowledge base.
Optional arguments:¶
io_retrievalconfiguration
TYPE REF TO /AWS1/CL_BDZKNOWLEDGEBASERET01
/AWS1/CL_BDZKNOWLEDGEBASERET01
¶
Contains configurations for the knowledge base query and retrieval process. For more information, see Query configurations.
io_guardrailconfiguration
TYPE REF TO /AWS1/CL_BDZGUARDRAILCONF
/AWS1/CL_BDZGUARDRAILCONF
¶
Guardrail settings.
iv_nexttoken
TYPE /AWS1/BDZNEXTTOKEN
/AWS1/BDZNEXTTOKEN
¶
If there are more results than can fit in the response, the response returns a
nextToken
. Use this token in thenextToken
field of another request to retrieve the next batch of results.
RETURNING¶
oo_output
TYPE REF TO /aws1/cl_bdzretrieveresponse
/AWS1/CL_BDZRETRIEVERESPONSE
¶
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_bdz~retrieve(
io_guardrailconfiguration = new /aws1/cl_bdzguardrailconf(
iv_guardrailid = |string|
iv_guardrailversion = |string|
)
io_retrievalconfiguration = new /aws1/cl_bdzknowledgebaseret01(
io_vectorsearchconfiguration = new /aws1/cl_bdzknowledgebasevec00(
io_filter = new /aws1/cl_bdzretrievalfilter(
io_equals = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_greaterthan = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_greaterthanorequals = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_in = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_lessthan = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_lessthanorequals = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_listcontains = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_notequals = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_notin = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_startswith = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_stringcontains = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
it_andall = VALUE /aws1/cl_bdzretrievalfilter=>tt_retrievalfilterlist(
(
new /aws1/cl_bdzretrievalfilter(
io_equals = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_greaterthan = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_greaterthanorequals = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_in = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_lessthan = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_lessthanorequals = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_listcontains = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_notequals = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_notin = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_startswith = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_stringcontains = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
it_orall = VALUE /aws1/cl_bdzretrievalfilter=>tt_retrievalfilterlist(
)
)
)
)
it_orall = VALUE /aws1/cl_bdzretrievalfilter=>tt_retrievalfilterlist(
(
new /aws1/cl_bdzretrievalfilter(
io_equals = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_greaterthan = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_greaterthanorequals = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_in = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_lessthan = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_lessthanorequals = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_listcontains = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_notequals = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_notin = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_startswith = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
io_stringcontains = new /aws1/cl_bdzfilterattribute(
io_value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
iv_key = |string|
)
it_andall = VALUE /aws1/cl_bdzretrievalfilter=>tt_retrievalfilterlist(
)
)
)
)
)
io_implicitfilterconf = new /aws1/cl_bdzimplicitfilterconf(
it_metadataattributes = VALUE /aws1/cl_bdzmetadataattrschema=>tt_metadataattributeschemalist(
(
new /aws1/cl_bdzmetadataattrschema(
iv_description = |string|
iv_key = |string|
iv_type = |string|
)
)
)
iv_modelarn = |string|
)
io_rerankingconfiguration = new /aws1/cl_bdzvectorsrchrerank00(
io_bedrockrerankingconf = new /aws1/cl_bdzvectorsrchbedroc00(
io_metadataconfiguration = new /aws1/cl_bdzmetconfforrerank00(
io_selectivemodeconf = new /aws1/cl_bdzrerankingmetseli00(
it_fieldstoexclude = VALUE /aws1/cl_bdzfieldforreranking=>tt_fieldsforreranking(
( new /aws1/cl_bdzfieldforreranking( |string| ) )
)
it_fieldstoinclude = VALUE /aws1/cl_bdzfieldforreranking=>tt_fieldsforreranking(
( new /aws1/cl_bdzfieldforreranking( |string| ) )
)
)
iv_selectionmode = |string|
)
io_modelconfiguration = new /aws1/cl_bdzvectorsrchbedroc01(
it_addlmodelrequestfields = VALUE /aws1/cl_rt_document=>tt_map(
(
VALUE /aws1/cl_rt_document=>ts_document_maprow(
value = /AWS1/CL_RT_DOCUMENT=>FROM_JSON_STR( |\{"foo":"this is a JSON object..."\}| )
key = |string|
)
)
)
iv_modelarn = |string|
)
iv_numberofrerankedresults = 123
)
iv_type = |string|
)
iv_numberofresults = 123
iv_overridesearchtype = |string|
)
)
io_retrievalquery = new /aws1/cl_bdzknowledgebasequery( |string| )
iv_knowledgebaseid = |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_retrievalresults( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lo_retrievalresultcontent = lo_row_1->get_content( ).
IF lo_retrievalresultcontent IS NOT INITIAL.
lv_retrievalresultcontentt = lo_retrievalresultcontent->get_type( ).
lv_string = lo_retrievalresultcontent->get_text( ).
lv_string = lo_retrievalresultcontent->get_bytecontent( ).
LOOP AT lo_retrievalresultcontent->get_row( ) into lo_row_2.
lo_row_3 = lo_row_2.
IF lo_row_3 IS NOT INITIAL.
lv_string = lo_row_3->get_columnname( ).
lv_string = lo_row_3->get_columnvalue( ).
lv_retrievalresultcontentc = lo_row_3->get_type( ).
ENDIF.
ENDLOOP.
ENDIF.
lo_retrievalresultlocation = lo_row_1->get_location( ).
IF lo_retrievalresultlocation IS NOT INITIAL.
lv_retrievalresultlocation_1 = lo_retrievalresultlocation->get_type( ).
lo_retrievalresults3locati = lo_retrievalresultlocation->get_s3location( ).
IF lo_retrievalresults3locati IS NOT INITIAL.
lv_string = lo_retrievalresults3locati->get_uri( ).
ENDIF.
lo_retrievalresultweblocat = lo_retrievalresultlocation->get_weblocation( ).
IF lo_retrievalresultweblocat IS NOT INITIAL.
lv_string = lo_retrievalresultweblocat->get_url( ).
ENDIF.
lo_retrievalresultconfluen = lo_retrievalresultlocation->get_confluencelocation( ).
IF lo_retrievalresultconfluen IS NOT INITIAL.
lv_string = lo_retrievalresultconfluen->get_url( ).
ENDIF.
lo_retrievalresultsalesfor = lo_retrievalresultlocation->get_salesforcelocation( ).
IF lo_retrievalresultsalesfor IS NOT INITIAL.
lv_string = lo_retrievalresultsalesfor->get_url( ).
ENDIF.
lo_retrievalresultsharepoi = lo_retrievalresultlocation->get_sharepointlocation( ).
IF lo_retrievalresultsharepoi IS NOT INITIAL.
lv_string = lo_retrievalresultsharepoi->get_url( ).
ENDIF.
lo_retrievalresultcustomdo = lo_retrievalresultlocation->get_customdocumentlocation( ).
IF lo_retrievalresultcustomdo IS NOT INITIAL.
lv_string = lo_retrievalresultcustomdo->get_id( ).
ENDIF.
lo_retrievalresultkendrado = lo_retrievalresultlocation->get_kendradocumentlocation( ).
IF lo_retrievalresultkendrado IS NOT INITIAL.
lv_string = lo_retrievalresultkendrado->get_uri( ).
ENDIF.
lo_retrievalresultsqllocat = lo_retrievalresultlocation->get_sqllocation( ).
IF lo_retrievalresultsqllocat IS NOT INITIAL.
lv_string = lo_retrievalresultsqllocat->get_query( ).
ENDIF.
ENDIF.
lv_double = lo_row_1->get_score( ).
LOOP AT lo_row_1->get_metadata( ) into ls_row_4.
lv_key = ls_row_4-key.
lo_value = ls_row_4-value.
IF lo_value IS NOT INITIAL.
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
lv_guadrailaction = lo_result->get_guardrailaction( ).
lv_nexttoken = lo_result->get_nexttoken( ).
ENDIF.