aws_sdk_bedrockruntime/operation/invoke_model/
_invoke_model_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
5pub struct InvokeModelOutput {
6    /// <p>Inference response from the model in the format specified in the <code>contentType</code> header. To see the format and content of the request and response bodies for different models, refer to <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters</a>.</p>
7    pub body: ::aws_smithy_types::Blob,
8    /// <p>The MIME type of the inference result.</p>
9    pub content_type: ::std::string::String,
10    /// <p>Model performance settings for the request.</p>
11    pub performance_config_latency: ::std::option::Option<crate::types::PerformanceConfigLatency>,
12    /// <p>Specifies the processing tier type used for serving the request.</p>
13    pub service_tier: ::std::option::Option<crate::types::ServiceTierType>,
14    _request_id: Option<String>,
15}
16impl InvokeModelOutput {
17    /// <p>Inference response from the model in the format specified in the <code>contentType</code> header. To see the format and content of the request and response bodies for different models, refer to <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters</a>.</p>
18    pub fn body(&self) -> &::aws_smithy_types::Blob {
19        &self.body
20    }
21    /// <p>The MIME type of the inference result.</p>
22    pub fn content_type(&self) -> &str {
23        use std::ops::Deref;
24        self.content_type.deref()
25    }
26    /// <p>Model performance settings for the request.</p>
27    pub fn performance_config_latency(&self) -> ::std::option::Option<&crate::types::PerformanceConfigLatency> {
28        self.performance_config_latency.as_ref()
29    }
30    /// <p>Specifies the processing tier type used for serving the request.</p>
31    pub fn service_tier(&self) -> ::std::option::Option<&crate::types::ServiceTierType> {
32        self.service_tier.as_ref()
33    }
34}
35impl ::std::fmt::Debug for InvokeModelOutput {
36    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
37        let mut formatter = f.debug_struct("InvokeModelOutput");
38        formatter.field("body", &"*** Sensitive Data Redacted ***");
39        formatter.field("content_type", &self.content_type);
40        formatter.field("performance_config_latency", &self.performance_config_latency);
41        formatter.field("service_tier", &self.service_tier);
42        formatter.field("_request_id", &self._request_id);
43        formatter.finish()
44    }
45}
46impl ::aws_types::request_id::RequestId for InvokeModelOutput {
47    fn request_id(&self) -> Option<&str> {
48        self._request_id.as_deref()
49    }
50}
51impl InvokeModelOutput {
52    /// Creates a new builder-style object to manufacture [`InvokeModelOutput`](crate::operation::invoke_model::InvokeModelOutput).
53    pub fn builder() -> crate::operation::invoke_model::builders::InvokeModelOutputBuilder {
54        crate::operation::invoke_model::builders::InvokeModelOutputBuilder::default()
55    }
56}
57
58/// A builder for [`InvokeModelOutput`](crate::operation::invoke_model::InvokeModelOutput).
59#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
60#[non_exhaustive]
61pub struct InvokeModelOutputBuilder {
62    pub(crate) body: ::std::option::Option<::aws_smithy_types::Blob>,
63    pub(crate) content_type: ::std::option::Option<::std::string::String>,
64    pub(crate) performance_config_latency: ::std::option::Option<crate::types::PerformanceConfigLatency>,
65    pub(crate) service_tier: ::std::option::Option<crate::types::ServiceTierType>,
66    _request_id: Option<String>,
67}
68impl InvokeModelOutputBuilder {
69    /// <p>Inference response from the model in the format specified in the <code>contentType</code> header. To see the format and content of the request and response bodies for different models, refer to <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters</a>.</p>
70    /// This field is required.
71    pub fn body(mut self, input: ::aws_smithy_types::Blob) -> Self {
72        self.body = ::std::option::Option::Some(input);
73        self
74    }
75    /// <p>Inference response from the model in the format specified in the <code>contentType</code> header. To see the format and content of the request and response bodies for different models, refer to <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters</a>.</p>
76    pub fn set_body(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
77        self.body = input;
78        self
79    }
80    /// <p>Inference response from the model in the format specified in the <code>contentType</code> header. To see the format and content of the request and response bodies for different models, refer to <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters</a>.</p>
81    pub fn get_body(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
82        &self.body
83    }
84    /// <p>The MIME type of the inference result.</p>
85    /// This field is required.
86    pub fn content_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
87        self.content_type = ::std::option::Option::Some(input.into());
88        self
89    }
90    /// <p>The MIME type of the inference result.</p>
91    pub fn set_content_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
92        self.content_type = input;
93        self
94    }
95    /// <p>The MIME type of the inference result.</p>
96    pub fn get_content_type(&self) -> &::std::option::Option<::std::string::String> {
97        &self.content_type
98    }
99    /// <p>Model performance settings for the request.</p>
100    pub fn performance_config_latency(mut self, input: crate::types::PerformanceConfigLatency) -> Self {
101        self.performance_config_latency = ::std::option::Option::Some(input);
102        self
103    }
104    /// <p>Model performance settings for the request.</p>
105    pub fn set_performance_config_latency(mut self, input: ::std::option::Option<crate::types::PerformanceConfigLatency>) -> Self {
106        self.performance_config_latency = input;
107        self
108    }
109    /// <p>Model performance settings for the request.</p>
110    pub fn get_performance_config_latency(&self) -> &::std::option::Option<crate::types::PerformanceConfigLatency> {
111        &self.performance_config_latency
112    }
113    /// <p>Specifies the processing tier type used for serving the request.</p>
114    pub fn service_tier(mut self, input: crate::types::ServiceTierType) -> Self {
115        self.service_tier = ::std::option::Option::Some(input);
116        self
117    }
118    /// <p>Specifies the processing tier type used for serving the request.</p>
119    pub fn set_service_tier(mut self, input: ::std::option::Option<crate::types::ServiceTierType>) -> Self {
120        self.service_tier = input;
121        self
122    }
123    /// <p>Specifies the processing tier type used for serving the request.</p>
124    pub fn get_service_tier(&self) -> &::std::option::Option<crate::types::ServiceTierType> {
125        &self.service_tier
126    }
127    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
128        self._request_id = Some(request_id.into());
129        self
130    }
131
132    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
133        self._request_id = request_id;
134        self
135    }
136    /// Consumes the builder and constructs a [`InvokeModelOutput`](crate::operation::invoke_model::InvokeModelOutput).
137    /// This method will fail if any of the following fields are not set:
138    /// - [`body`](crate::operation::invoke_model::builders::InvokeModelOutputBuilder::body)
139    /// - [`content_type`](crate::operation::invoke_model::builders::InvokeModelOutputBuilder::content_type)
140    pub fn build(self) -> ::std::result::Result<crate::operation::invoke_model::InvokeModelOutput, ::aws_smithy_types::error::operation::BuildError> {
141        ::std::result::Result::Ok(crate::operation::invoke_model::InvokeModelOutput {
142            body: self.body.ok_or_else(|| {
143                ::aws_smithy_types::error::operation::BuildError::missing_field(
144                    "body",
145                    "body was not specified but it is required when building InvokeModelOutput",
146                )
147            })?,
148            content_type: self.content_type.ok_or_else(|| {
149                ::aws_smithy_types::error::operation::BuildError::missing_field(
150                    "content_type",
151                    "content_type was not specified but it is required when building InvokeModelOutput",
152                )
153            })?,
154            performance_config_latency: self.performance_config_latency,
155            service_tier: self.service_tier,
156            _request_id: self._request_id,
157        })
158    }
159}
160impl ::std::fmt::Debug for InvokeModelOutputBuilder {
161    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
162        let mut formatter = f.debug_struct("InvokeModelOutputBuilder");
163        formatter.field("body", &"*** Sensitive Data Redacted ***");
164        formatter.field("content_type", &self.content_type);
165        formatter.field("performance_config_latency", &self.performance_config_latency);
166        formatter.field("service_tier", &self.service_tier);
167        formatter.field("_request_id", &self._request_id);
168        formatter.finish()
169    }
170}