Module Values.InvokeEndpointWithResponseStreamOutputSource

Invokes a model at the specified endpoint to return the inference response as a stream. The inference stream provides the response payload incrementally as a series of parts. Before you can get an inference stream, you must have access to a model that's deployed using Amazon SageMaker AI hosting services, and the container for that model must support inference streaming. For more information that can help you use this API, see the following sections in the Amazon SageMaker AI Developer Guide: For information about how to add streaming support to a model, see How Containers Serve Requests. For information about how to process the streaming response, see Invoke real-time endpoints. Before you can use this operation, your IAM permissions must allow the sagemaker:InvokeEndpoint action. For more information about Amazon SageMaker AI actions for IAM policies, see Actions, resources, and condition keys for Amazon SageMaker AI in the IAM Service Authorization Reference. Amazon SageMaker AI strips all POST headers except those supported by the API. Amazon SageMaker AI might add additional headers. You should not rely on the behavior of headers outside those enumerated in the request syntax. Calls to InvokeEndpointWithResponseStream 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.

Sourcetype nonrec t = {
  1. body : ResponseStream.t option;
  2. contentType : Header.t option;
    (*

    The MIME type of the inference returned from the model container.

    *)
  3. invokedProductionVariant : Header.t option;
    (*

    Identifies the production variant that was invoked.

    *)
  4. customAttributes : CustomAttributesHeader.t option;
    (*

    Provides additional information in the response about the inference returned by a model hosted at an Amazon SageMaker AI endpoint. The information is an opaque value that is forwarded verbatim. You could use this value, for example, to return an ID received in the CustomAttributes header of a request or other metadata that a service endpoint was programmed to produce. The value must consist of no more than 1024 visible US-ASCII characters as specified in Section 3.3.6. Field Value Components of the Hypertext Transfer Protocol (HTTP/1.1). If the customer wants the custom attribute returned, the model must set the custom attribute to be included on the way back. The code in your model is responsible for setting or updating any custom attributes in the response. If your code does not set this value in the response, an empty value is returned. For example, if a custom attribute represents the trace ID, your model can prepend the custom attribute with Trace ID: in your post-processing function. This feature is currently supported in the Amazon Web Services SDKs but not in the Amazon SageMaker AI Python SDK.

    *)
}
Sourcetype nonrec error = [
  1. | `InternalFailure of InternalFailure.t
  2. | `InternalStreamFailure of InternalStreamFailure.t
  3. | `ModelError of ModelError.t
  4. | `ModelStreamError of ModelStreamError.t
  5. | `ServiceUnavailable of ServiceUnavailable.t
  6. | `ValidationError of ValidationError.t
  7. | `Unknown_operation_error of string * string option
]
Sourceval make : ?body:??? -> ?contentType:??? -> ?invokedProductionVariant:??? -> ?customAttributes:??? -> unit -> t
Sourceval error_of_json : string -> Yojson.Safe.t -> [> `InternalFailure of InternalFailure.t | `InternalStreamFailure of InternalStreamFailure.t | `ModelError of ModelError.t | `ModelStreamError of ModelStreamError.t | `ServiceUnavailable of ServiceUnavailable.t | `Unknown_operation_error of string * string option | `ValidationError of ValidationError.t ]
Sourceval error_of_xml : string -> Awso.Xml.t -> [> `InternalFailure of InternalFailure.t | `InternalStreamFailure of InternalStreamFailure.t | `ModelError of ModelError.t | `ModelStreamError of ModelStreamError.t | `ServiceUnavailable of ServiceUnavailable.t | `Unknown_operation_error of string * string option | `ValidationError of ValidationError.t ]
Sourceval error_to_json : error -> Yojson.Safe.t
Sourceval of_header_and_body : ((string, Header.t) Awso.Import.List.Assoc.t * ResponseStream.t) -> t
Sourceval to_value : t -> [> `Structure of (string * [> `String of Header.t | `Structure of (string * [> `Structure of (string * [> `Blob of PartBlob.t | `String of Message.t ]) list ]) list ]) list ]
Sourceval to_query : t -> Awso.Client.Query.t
Sourceval of_xml : Awso.Xml.t -> t
Sourceval of_string : string -> t
Sourceval of_json : Yojson.Safe.t -> t
Sourceval to_json : t -> Yojson.Safe.t