/AWS1/IF_SGI=>SAMPLETRNSESSWITHRSPSTREAM()¶
About SampleTrainingSessionWithResponseStream¶
Streams inference responses from the model associated with the specified training session. Use this operation for real-time token-by-token generation. The service passes the request body to the model without modification.
Method Signature¶
METHODS /AWS1/IF_SGI~SAMPLETRNSESSWITHRSPSTREAM
IMPORTING
!IV_TRAININGSESSIONNAME TYPE /AWS1/SGITRAININGSESSIONNAME OPTIONAL
!IV_CONTENTTYPE TYPE /AWS1/SGISTRING OPTIONAL
!IV_ACCEPT TYPE /AWS1/SGISTRING OPTIONAL
!IV_MODELPACKAGEARN TYPE /AWS1/SGISTRING OPTIONAL
!IV_BODY TYPE /AWS1/SGIINFERENCEBODY OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_sgismptrnsesswrspst01
RAISING
/AWS1/CX_SGICONFLICTEXCEPTION
/AWS1/CX_SGIINTERNALSERVEREX
/AWS1/CX_SGIRESOURCENOTFOUNDEX
/AWS1/CX_SGITHROTTLINGEX
/AWS1/CX_SGIVLDTNEXCEPTION
/AWS1/CX_SGICLIENTEXC
/AWS1/CX_SGISERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_trainingsessionname TYPE /AWS1/SGITRAININGSESSIONNAME /AWS1/SGITRAININGSESSIONNAME¶
The name of the training session whose model to invoke.
Optional arguments:¶
iv_contenttype TYPE /AWS1/SGISTRING /AWS1/SGISTRING¶
The MIME type of the input data in the request body.
iv_accept TYPE /AWS1/SGISTRING /AWS1/SGISTRING¶
The desired MIME type of the inference body in the response.
iv_modelpackagearn TYPE /AWS1/SGISTRING /AWS1/SGISTRING¶
The ARN of the model package whose checkpoint to invoke.
iv_body TYPE /AWS1/SGIINFERENCEBODY /AWS1/SGIINFERENCEBODY¶
The raw inference request body.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_sgismptrnsesswrspst01 /AWS1/CL_SGISMPTRNSESSWRSPST01¶
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->sampletrnsesswithrspstream(
iv_accept = |string|
iv_body = '5347567362473873563239796247513D'
iv_contenttype = |string|
iv_modelpackagearn = |string|
iv_trainingsessionname = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lv_string = lo_result->get_contenttype( ).
lv_sampleresponsestream = lo_result->get_body( ).
ENDIF.
Stream samples from a training session¶
Sends a chat completion request to the session's current weights and receives the response as a stream of payload chunks.
DATA(lo_result) = lo_client->sampletrnsesswithrspstream(
iv_accept = |application/json|
iv_body = '65794A745A584E7A5957646C6379493657337369636D39735A534936496E567A5A5849694C434A6A623235305A573530496A6F69563268686443427063794230614755675932467761585268624342765A694247636D46755932552F496E31644C434A7459586866644739725A57357A496A6F784D6A6773496E4E30636D56686253493664484A315A58303D'
iv_contenttype = |application/json|
iv_trainingsessionname = |my-training-session|
).