AWSSageMakerRuntime

Objective-C

@interface AWSSageMakerRuntime

Swift

class AWSSageMakerRuntime

The Amazon SageMaker runtime API.

  • The service configuration used to instantiate this service client.

    Warning

    Once the client is instantiated, do not modify the configuration object. It may cause unspecified behaviors.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) AWSServiceConfiguration *configuration
  • Returns the singleton service client. If the singleton object does not exist, the SDK instantiates the default service client with defaultServiceConfiguration from [AWSServiceManager defaultServiceManager]. The reference to this object is maintained by the SDK, and you do not need to retain it manually.

    For example, set the default service configuration in - application:didFinishLaunchingWithOptions:

    Swift

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
       let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
       let configuration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: credentialProvider)
       AWSServiceManager.default().defaultServiceConfiguration = configuration
    
       return true
    

    }

    Objective-C

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
         AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
                                                                                                         identityPoolId:@"YourIdentityPoolId"];
         AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSEast1
                                                                              credentialsProvider:credentialsProvider];
         [AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;
    
         return YES;
     }
    

    Then call the following to get the default service client:

    Swift

    let SageMakerRuntime = AWSSageMakerRuntime.default()
    

    Objective-C

    AWSSageMakerRuntime *SageMakerRuntime = [AWSSageMakerRuntime defaultSageMakerRuntime];
    

    Declaration

    Objective-C

    + (nonnull instancetype)defaultSageMakerRuntime;

    Swift

    class func `default`() -> Self

    Return Value

    The default service client.

  • Creates a service client with the given service configuration and registers it for the key.

    For example, set the default service configuration in - application:didFinishLaunchingWithOptions:

    Swift

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
       let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
       let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
       AWSSageMakerRuntime.register(with: configuration!, forKey: "USWest2SageMakerRuntime")
    
       return true
    

    }

    Objective-C

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
                                                                                                        identityPoolId:@"YourIdentityPoolId"];
        AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
                                                                             credentialsProvider:credentialsProvider];
    
        [AWSSageMakerRuntime registerSageMakerRuntimeWithConfiguration:configuration forKey:@"USWest2SageMakerRuntime"];
    
        return YES;
    }
    

    Then call the following to get the service client:

    Swift

    let SageMakerRuntime = AWSSageMakerRuntime(forKey: "USWest2SageMakerRuntime")
    

    Objective-C

    AWSSageMakerRuntime *SageMakerRuntime = [AWSSageMakerRuntime SageMakerRuntimeForKey:@"USWest2SageMakerRuntime"];
    

    Warning

    After calling this method, do not modify the configuration object. It may cause unspecified behaviors.

    Declaration

    Objective-C

    + (void)registerSageMakerRuntimeWithConfiguration:(id)configuration
                                               forKey:(nonnull NSString *)key;

    Swift

    class func register(withConfiguration configuration: Any!, forKey key: String)

    Parameters

    configuration

    A service configuration object.

    key

    A string to identify the service client.

  • Retrieves the service client associated with the key. You need to call + registerSageMakerRuntimeWithConfiguration:forKey: before invoking this method.

    For example, set the default service configuration in - application:didFinishLaunchingWithOptions:

    Swift

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
       let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
       let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
       AWSSageMakerRuntime.register(with: configuration!, forKey: "USWest2SageMakerRuntime")
    
       return true
    

    }

    Objective-C

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
                                                                                                        identityPoolId:@"YourIdentityPoolId"];
        AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
                                                                             credentialsProvider:credentialsProvider];
    
        [AWSSageMakerRuntime registerSageMakerRuntimeWithConfiguration:configuration forKey:@"USWest2SageMakerRuntime"];
    
        return YES;
    }
    

    Then call the following to get the service client:

    Swift

    let SageMakerRuntime = AWSSageMakerRuntime(forKey: "USWest2SageMakerRuntime")
    

    Objective-C

    AWSSageMakerRuntime *SageMakerRuntime = [AWSSageMakerRuntime SageMakerRuntimeForKey:@"USWest2SageMakerRuntime"];
    

    Declaration

    Objective-C

    + (nonnull instancetype)SageMakerRuntimeForKey:(nonnull NSString *)key;

    Swift

    convenience init(forKey key: String)

    Parameters

    key

    A string to identify the service client.

    Return Value

    An instance of the service client.

  • Removes the service client associated with the key and release it.

    Warning

    Before calling this method, make sure no method is running on this client.

    Declaration

    Objective-C

    + (void)removeSageMakerRuntimeForKey:(nonnull NSString *)key;

    Swift

    class func remove(forKey key: String)

    Parameters

    key

    A string to identify the service client.

  • After you deploy a model into production using Amazon SageMaker hosting services, your client applications use this API to get inferences from the model hosted at the specified endpoint.

    For an overview of Amazon SageMaker, see How It Works.

    Amazon SageMaker strips all POST headers except those supported by the API. Amazon SageMaker might add additional headers. You should not rely on the behavior of headers outside those enumerated in the request syntax.

    Calls to InvokeEndpoint are authenticated by using Amazon Web Services Signature Version 4. For information, see Authenticating Requests (Amazon Web Services Signature Version 4) in the Amazon S3 API Reference.

    A customer’s model containers must respond to requests within 60 seconds. The model itself can have a maximum processing time of 60 seconds before responding to invocations. If your model is going to take 50-60 seconds of processing time, the SDK socket timeout should be set to be 70 seconds.

    Endpoints are scoped to an individual account, and are not public. The URL does not contain the account ID, but Amazon SageMaker determines the account ID from the authentication token that is supplied by the caller.

    See

    AWSSageMakerRuntimeInvokeEndpointInput

    See

    AWSSageMakerRuntimeInvokeEndpointOutput

    Declaration

    Objective-C

    - (id)invokeEndpoint:(nonnull AWSSageMakerRuntimeInvokeEndpointInput *)request;

    Swift

    func invokeEndpoint(_ request: AWSSageMakerRuntimeInvokeEndpointInput) -> Any!

    Parameters

    request

    A container for the necessary parameters to execute the InvokeEndpoint service method.

    Return Value

    An instance of AWSTask. On successful execution, task.result will contain an instance of AWSSageMakerRuntimeInvokeEndpointOutput. On failed execution, task.error may contain an NSError with AWSSageMakerRuntimeErrorDomain domain and the following error code: AWSSageMakerRuntimeErrorInternalFailure, AWSSageMakerRuntimeErrorServiceUnavailable, AWSSageMakerRuntimeErrorValidation, AWSSageMakerRuntimeErrorModel, AWSSageMakerRuntimeErrorInternalDependency, AWSSageMakerRuntimeErrorModelNotReady.

  • After you deploy a model into production using Amazon SageMaker hosting services, your client applications use this API to get inferences from the model hosted at the specified endpoint.

    For an overview of Amazon SageMaker, see How It Works.

    Amazon SageMaker strips all POST headers except those supported by the API. Amazon SageMaker might add additional headers. You should not rely on the behavior of headers outside those enumerated in the request syntax.

    Calls to InvokeEndpoint are authenticated by using Amazon Web Services Signature Version 4. For information, see Authenticating Requests (Amazon Web Services Signature Version 4) in the Amazon S3 API Reference.

    A customer’s model containers must respond to requests within 60 seconds. The model itself can have a maximum processing time of 60 seconds before responding to invocations. If your model is going to take 50-60 seconds of processing time, the SDK socket timeout should be set to be 70 seconds.

    Endpoints are scoped to an individual account, and are not public. The URL does not contain the account ID, but Amazon SageMaker determines the account ID from the authentication token that is supplied by the caller.

    See

    AWSSageMakerRuntimeInvokeEndpointInput

    See

    AWSSageMakerRuntimeInvokeEndpointOutput

    Declaration

    Objective-C

    - (void)invokeEndpoint:(nonnull AWSSageMakerRuntimeInvokeEndpointInput *)request
         completionHandler:
             (void (^_Nullable)(AWSSageMakerRuntimeInvokeEndpointOutput *_Nullable,
                                NSError *_Nullable))completionHandler;

    Swift

    func invokeEndpoint(_ request: AWSSageMakerRuntimeInvokeEndpointInput) async throws -> AWSSageMakerRuntimeInvokeEndpointOutput

    Parameters

    request

    A container for the necessary parameters to execute the InvokeEndpoint service method.

    completionHandler

    The completion handler to call when the load request is complete. response - A response object, or nil if the request failed. error - An error object that indicates why the request failed, or nil if the request was successful. On failed execution, error may contain an NSError with AWSSageMakerRuntimeErrorDomain domain and the following error code: AWSSageMakerRuntimeErrorInternalFailure, AWSSageMakerRuntimeErrorServiceUnavailable, AWSSageMakerRuntimeErrorValidation, AWSSageMakerRuntimeErrorModel, AWSSageMakerRuntimeErrorInternalDependency, AWSSageMakerRuntimeErrorModelNotReady.

  • After you deploy a model into production using Amazon SageMaker hosting services, your client applications use this API to get inferences from the model hosted at the specified endpoint in an asynchronous manner.

    Inference requests sent to this API are enqueued for asynchronous processing. The processing of the inference request may or may not complete before you receive a response from this API. The response from this API will not contain the result of the inference request but contain information about where you can locate it.

    Amazon SageMaker strips all POST headers except those supported by the API. Amazon SageMaker might add additional headers. You should not rely on the behavior of headers outside those enumerated in the request syntax.

    Calls to InvokeEndpointAsync are authenticated by using Amazon Web Services Signature Version 4. For information, see Authenticating Requests (Amazon Web Services Signature Version 4) in the Amazon S3 API Reference.

    See

    AWSSageMakerRuntimeInvokeEndpointAsyncInput

    See

    AWSSageMakerRuntimeInvokeEndpointAsyncOutput

    Declaration

    Objective-C

    - (id)invokeEndpointAsync:
        (nonnull AWSSageMakerRuntimeInvokeEndpointAsyncInput *)request;

    Swift

    func invokeEndpointAsync(_ request: AWSSageMakerRuntimeInvokeEndpointAsyncInput) -> Any!

    Parameters

    request

    A container for the necessary parameters to execute the InvokeEndpointAsync service method.

    Return Value

    An instance of AWSTask. On successful execution, task.result will contain an instance of AWSSageMakerRuntimeInvokeEndpointAsyncOutput. On failed execution, task.error may contain an NSError with AWSSageMakerRuntimeErrorDomain domain and the following error code: AWSSageMakerRuntimeErrorInternalFailure, AWSSageMakerRuntimeErrorServiceUnavailable, AWSSageMakerRuntimeErrorValidation.

  • After you deploy a model into production using Amazon SageMaker hosting services, your client applications use this API to get inferences from the model hosted at the specified endpoint in an asynchronous manner.

    Inference requests sent to this API are enqueued for asynchronous processing. The processing of the inference request may or may not complete before you receive a response from this API. The response from this API will not contain the result of the inference request but contain information about where you can locate it.

    Amazon SageMaker strips all POST headers except those supported by the API. Amazon SageMaker might add additional headers. You should not rely on the behavior of headers outside those enumerated in the request syntax.

    Calls to InvokeEndpointAsync are authenticated by using Amazon Web Services Signature Version 4. For information, see Authenticating Requests (Amazon Web Services Signature Version 4) in the Amazon S3 API Reference.

    See

    AWSSageMakerRuntimeInvokeEndpointAsyncInput

    See

    AWSSageMakerRuntimeInvokeEndpointAsyncOutput

    Declaration

    Objective-C

    - (void)invokeEndpointAsync:
                (nonnull AWSSageMakerRuntimeInvokeEndpointAsyncInput *)request
              completionHandler:
                  (void (^_Nullable)(
                      AWSSageMakerRuntimeInvokeEndpointAsyncOutput *_Nullable,
                      NSError *_Nullable))completionHandler;

    Swift

    func invokeEndpointAsync(_ request: AWSSageMakerRuntimeInvokeEndpointAsyncInput) async throws -> AWSSageMakerRuntimeInvokeEndpointAsyncOutput

    Parameters

    request

    A container for the necessary parameters to execute the InvokeEndpointAsync service method.

    completionHandler

    The completion handler to call when the load request is complete. response - A response object, or nil if the request failed. error - An error object that indicates why the request failed, or nil if the request was successful. On failed execution, error may contain an NSError with AWSSageMakerRuntimeErrorDomain domain and the following error code: AWSSageMakerRuntimeErrorInternalFailure, AWSSageMakerRuntimeErrorServiceUnavailable, AWSSageMakerRuntimeErrorValidation.