aws_sdk_sagemakerruntime/client/
invoke_endpoint_with_response_stream.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2impl super::Client {
3    /// Constructs a fluent builder for the [`InvokeEndpointWithResponseStream`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder) operation.
4    ///
5    /// - The fluent builder is configurable:
6    ///   - [`endpoint_name(impl Into<String>)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::endpoint_name) / [`set_endpoint_name(Option<String>)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::set_endpoint_name):<br>required: **true**<br><p>The name of the endpoint that you specified when you created the endpoint using the <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/API_CreateEndpoint.html">CreateEndpoint</a> API.</p><br>
7    ///   - [`body(Blob)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::body) / [`set_body(Option<Blob>)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::set_body):<br>required: **true**<br><p>Provides input data, in the format specified in the <code>ContentType</code> request header. Amazon SageMaker AI passes all of the data in the body to the model.</p> <p>For information about the format of the request body, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/cdf-inference.html">Common Data Formats-Inference</a>.</p><br>
8    ///   - [`content_type(impl Into<String>)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::content_type) / [`set_content_type(Option<String>)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::set_content_type):<br>required: **false**<br><p>The MIME type of the input data in the request body.</p><br>
9    ///   - [`accept(impl Into<String>)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::accept) / [`set_accept(Option<String>)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::set_accept):<br>required: **false**<br><p>The desired MIME type of the inference response from the model container.</p><br>
10    ///   - [`custom_attributes(impl Into<String>)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::custom_attributes) / [`set_custom_attributes(Option<String>)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::set_custom_attributes):<br>required: **false**<br><p>Provides additional information about a request for an inference submitted to 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 provide an ID that you can use to track a request or to provide other metadata that a service endpoint was programmed to process. The value must consist of no more than 1024 visible US-ASCII characters as specified in <a href="https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6">Section 3.3.6. Field Value Components</a> of the Hypertext Transfer Protocol (HTTP/1.1).</p> <p>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 <code>Trace ID:</code> in your post-processing function.</p> <p>This feature is currently supported in the Amazon Web Services SDKs but not in the Amazon SageMaker AI Python SDK.</p><br>
11    ///   - [`target_variant(impl Into<String>)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::target_variant) / [`set_target_variant(Option<String>)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::set_target_variant):<br>required: **false**<br><p>Specify the production variant to send the inference request to when invoking an endpoint that is running two or more variants. Note that this parameter overrides the default behavior for the endpoint, which is to distribute the invocation traffic based on the variant weights.</p> <p>For information about how to use variant targeting to perform a/b testing, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/model-ab-testing.html">Test models in production</a></p><br>
12    ///   - [`target_container_hostname(impl Into<String>)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::target_container_hostname) / [`set_target_container_hostname(Option<String>)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::set_target_container_hostname):<br>required: **false**<br><p>If the endpoint hosts multiple containers and is configured to use direct invocation, this parameter specifies the host name of the container to invoke.</p><br>
13    ///   - [`inference_id(impl Into<String>)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::inference_id) / [`set_inference_id(Option<String>)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::set_inference_id):<br>required: **false**<br><p>An identifier that you assign to your request.</p><br>
14    ///   - [`inference_component_name(impl Into<String>)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::inference_component_name) / [`set_inference_component_name(Option<String>)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::set_inference_component_name):<br>required: **false**<br><p>If the endpoint hosts one or more inference components, this parameter specifies the name of inference component to invoke for a streaming response.</p><br>
15    ///   - [`session_id(impl Into<String>)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::session_id) / [`set_session_id(Option<String>)`](crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::set_session_id):<br>required: **false**<br><p>The ID of a stateful session to handle your request.</p> <p>You can't create a stateful session by using the <code>InvokeEndpointWithResponseStream</code> action. Instead, you can create one by using the <code> <code>InvokeEndpoint</code> </code> action. In your request, you specify <code>NEW_SESSION</code> for the <code>SessionId</code> request parameter. The response to that request provides the session ID for the <code>NewSessionId</code> response parameter.</p><br>
16    /// - On success, responds with [`InvokeEndpointWithResponseStreamOutput`](crate::operation::invoke_endpoint_with_response_stream::InvokeEndpointWithResponseStreamOutput) with field(s):
17    ///   - [`body(EventReceiver<ResponseStream, ResponseStreamError>)`](crate::operation::invoke_endpoint_with_response_stream::InvokeEndpointWithResponseStreamOutput::body): <p>A stream of payload parts. Each part contains a portion of the response for a streaming inference request.</p>
18    ///   - [`content_type(Option<String>)`](crate::operation::invoke_endpoint_with_response_stream::InvokeEndpointWithResponseStreamOutput::content_type): <p>The MIME type of the inference returned from the model container.</p>
19    ///   - [`invoked_production_variant(Option<String>)`](crate::operation::invoke_endpoint_with_response_stream::InvokeEndpointWithResponseStreamOutput::invoked_production_variant): <p>Identifies the production variant that was invoked.</p>
20    ///   - [`custom_attributes(Option<String>)`](crate::operation::invoke_endpoint_with_response_stream::InvokeEndpointWithResponseStreamOutput::custom_attributes): <p>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 <code>CustomAttributes</code> 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 <a href="https://tools.ietf.org/html/rfc7230#section-3.2.6">Section 3.3.6. Field Value Components</a> 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.</p> <p>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 <code>Trace ID:</code> in your post-processing function.</p> <p>This feature is currently supported in the Amazon Web Services SDKs but not in the Amazon SageMaker AI Python SDK.</p>
21    /// - On failure, responds with [`SdkError<InvokeEndpointWithResponseStreamError>`](crate::operation::invoke_endpoint_with_response_stream::InvokeEndpointWithResponseStreamError)
22    pub fn invoke_endpoint_with_response_stream(
23        &self,
24    ) -> crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder {
25        crate::operation::invoke_endpoint_with_response_stream::builders::InvokeEndpointWithResponseStreamFluentBuilder::new(self.handle.clone())
26    }
27}