SagemakerJobRuntimeService / Client / sample
sample¶
- SagemakerJobRuntimeService.Client.sample(**kwargs)¶
Sends an inference request to the model during a job execution. The request and response bodies are forwarded to and from the model without modification. Each turn (prompt and response) is captured for later use.
See also: AWS API Documentation
Request Syntax
response = client.sample( JobArn='string', TrajectoryId='string', Body=b'bytes'|file )
- Parameters:
JobArn (string) –
[REQUIRED]
The job ARN that identifies which model session to route the inference request to.
TrajectoryId (string) –
[REQUIRED]
The trajectory ID for grouping turns into a single rollout. Each turn (prompt and response) is captured for later use.
Body (bytes or seekable file-like object) –
[REQUIRED]
The raw inference request body in OpenAI-compatible JSON format.
- Return type:
dict
- Returns:
Response Syntax
{ 'ContentType': 'string', 'Body': StreamingBody() }
Response Structure
(dict) –
ContentType (string) –
MIME type of the inference result.
Body (
StreamingBody) –The raw inference response body from the model.
Exceptions
SagemakerJobRuntimeService.Client.exceptions.ResourceNotFoundExceptionSagemakerJobRuntimeService.Client.exceptions.InternalServiceErrorSagemakerJobRuntimeService.Client.exceptions.ValidationExceptionSagemakerJobRuntimeService.Client.exceptions.ServiceQuotaExceededExceptionSagemakerJobRuntimeService.Client.exceptions.ThrottlingExceptionSagemakerJobRuntimeService.Client.exceptions.AccessDeniedException