sampleWithResponseStream
abstract suspend fun <T> sampleWithResponseStream(input: SampleWithResponseStreamRequest, block: suspend (SampleWithResponseStreamResponse) -> T): T
Sends a streaming inference request to the model during a job execution. Returns the response as a stream of payload chunks. Each turn is captured for later use.
Samples
// Sends a streaming inference request and receives the response as a stream of payload chunks.
sagemakerJobRuntimeClient.sampleWithResponseStream {
jobArn = "arn:aws:sagemaker:us-east-1:123456789012:job/AgentRFT/my-training-job"
trajectoryId = "trajectory-001"
body = "eyJtb2RlbCI6Im15LW1vZGVsIiwibWVzc2FnZXMiOlt7InJvbGUiOiJ1c2VyIiwiY29udGVudCI6IkhlbGxvIn1dfQ==".encodeAsByteArray()
}Content copied to clipboard