Published on
1 min read

Plumber R reading AWS SageMaker custom attributes

Authors

AWS SageMaker asynchronous inference supports CustomAttributes, allowing callers to pass additional information to the model outside of the inference payload.

See AWS SageMaker InvokeEndpointAsync documentation.

If you are using the Plumber R package in your custom SageMaker model, you can access the CustomAttributes value via a header:

#' Parse `CustomAttributes` header and do something with it.
#' @param req The HTTP request sent
#' @post /invocations
function(req) {
  custom_attributes <- req$HTTP_X_AMZN_SAGEMAKER_CUSTOM_ATTRIBUTES

  # Do something with it
  output = ...

  return(output)
}