View a markdown version of this page

ExecuteSamplingOperation - Amazon SageMaker

ExecuteSamplingOperation

Submits an asynchronous sampling operation to generate text or compute log-probabilities from the model associated with the specified training session. The session must be in Running or Blocked state. Use GetSamplingOperationResult to poll for the result.

Request Syntax

POST /v1/training-sessions/trainingSessionName/sampling-operations HTTP/1.1 Content-type: application/json { "operationConfig": { ... } }

URI Request Parameters

The request uses the following URI parameters.

trainingSessionName

The name of the training session to sample from.

Length Constraints: Minimum length of 1. Maximum length of 64.

Pattern: [a-zA-Z0-9-]+

Required: Yes

Request Body

The request accepts the following data in JSON format.

operationConfig

The configuration for the sample operation. Specify either a sample configuration to generate text or a computeLogprobs configuration to compute token log-probabilities.

Type: SampleOperationConfig object

Note: This object is a Union. Only one member of this object can be specified or returned.

Required: Yes

Response Syntax

HTTP/1.1 200 Content-type: application/json { "operationId": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

operationId

The unique identifier for the submitted sample operation. Use this identifier with GetSamplingOperationResult to retrieve the operation status and result.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 64.

Pattern: [a-zA-Z0-9-]+

Errors

For information about the errors that are common to all actions, see Common Error Types.

ConflictException

The training session is in a state that cannot accept new operations. The session must be in Running or Blocked state to accept requests.

HTTP Status Code: 409

InternalServerException

An internal service error occurred. Retry the request using exponential backoff.

HTTP Status Code: 500

ResourceNotFoundException

The specified training session or operation does not exist, or the operation does not belong to the specified training session.

HTTP Status Code: 404

ThrottlingException

The request was throttled. Retry the request after a brief wait using exponential backoff.

HTTP Status Code: 429

ValidationException

The request is not valid. Check the request syntax and parameters. Examples include invalid sequence numbers, malformed client tokens, missing required fields, or invalid operation configuration.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: