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    _request_id: Option<String>,
13}
14impl InvokeModelOutput {
15    /// <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>
16    pub fn body(&self) -> &::aws_smithy_types::Blob {
17        &self.body
18    }
19    /// <p>The MIME type of the inference result.</p>
20    pub fn content_type(&self) -> &str {
21        use std::ops::Deref;
22        self.content_type.deref()
23    }
24    /// <p>Model performance settings for the request.</p>
25    pub fn performance_config_latency(&self) -> ::std::option::Option<&crate::types::PerformanceConfigLatency> {
26        self.performance_config_latency.as_ref()
27    }
28}
29impl ::std::fmt::Debug for InvokeModelOutput {
30    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
31        let mut formatter = f.debug_struct("InvokeModelOutput");
32        formatter.field("body", &"*** Sensitive Data Redacted ***");
33        formatter.field("content_type", &self.content_type);
34        formatter.field("performance_config_latency", &self.performance_config_latency);
35        formatter.field("_request_id", &self._request_id);
36        formatter.finish()
37    }
38}
39impl ::aws_types::request_id::RequestId for InvokeModelOutput {
40    fn request_id(&self) -> Option<&str> {
41        self._request_id.as_deref()
42    }
43}
44impl InvokeModelOutput {
45    /// Creates a new builder-style object to manufacture [`InvokeModelOutput`](crate::operation::invoke_model::InvokeModelOutput).
46    pub fn builder() -> crate::operation::invoke_model::builders::InvokeModelOutputBuilder {
47        crate::operation::invoke_model::builders::InvokeModelOutputBuilder::default()
48    }
49}
50
51/// A builder for [`InvokeModelOutput`](crate::operation::invoke_model::InvokeModelOutput).
52#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
53#[non_exhaustive]
54pub struct InvokeModelOutputBuilder {
55    pub(crate) body: ::std::option::Option<::aws_smithy_types::Blob>,
56    pub(crate) content_type: ::std::option::Option<::std::string::String>,
57    pub(crate) performance_config_latency: ::std::option::Option<crate::types::PerformanceConfigLatency>,
58    _request_id: Option<String>,
59}
60impl InvokeModelOutputBuilder {
61    /// <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>
62    /// This field is required.
63    pub fn body(mut self, input: ::aws_smithy_types::Blob) -> Self {
64        self.body = ::std::option::Option::Some(input);
65        self
66    }
67    /// <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>
68    pub fn set_body(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
69        self.body = input;
70        self
71    }
72    /// <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>
73    pub fn get_body(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
74        &self.body
75    }
76    /// <p>The MIME type of the inference result.</p>
77    /// This field is required.
78    pub fn content_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
79        self.content_type = ::std::option::Option::Some(input.into());
80        self
81    }
82    /// <p>The MIME type of the inference result.</p>
83    pub fn set_content_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
84        self.content_type = input;
85        self
86    }
87    /// <p>The MIME type of the inference result.</p>
88    pub fn get_content_type(&self) -> &::std::option::Option<::std::string::String> {
89        &self.content_type
90    }
91    /// <p>Model performance settings for the request.</p>
92    pub fn performance_config_latency(mut self, input: crate::types::PerformanceConfigLatency) -> Self {
93        self.performance_config_latency = ::std::option::Option::Some(input);
94        self
95    }
96    /// <p>Model performance settings for the request.</p>
97    pub fn set_performance_config_latency(mut self, input: ::std::option::Option<crate::types::PerformanceConfigLatency>) -> Self {
98        self.performance_config_latency = input;
99        self
100    }
101    /// <p>Model performance settings for the request.</p>
102    pub fn get_performance_config_latency(&self) -> &::std::option::Option<crate::types::PerformanceConfigLatency> {
103        &self.performance_config_latency
104    }
105    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
106        self._request_id = Some(request_id.into());
107        self
108    }
109
110    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
111        self._request_id = request_id;
112        self
113    }
114    /// Consumes the builder and constructs a [`InvokeModelOutput`](crate::operation::invoke_model::InvokeModelOutput).
115    /// This method will fail if any of the following fields are not set:
116    /// - [`body`](crate::operation::invoke_model::builders::InvokeModelOutputBuilder::body)
117    /// - [`content_type`](crate::operation::invoke_model::builders::InvokeModelOutputBuilder::content_type)
118    pub fn build(self) -> ::std::result::Result<crate::operation::invoke_model::InvokeModelOutput, ::aws_smithy_types::error::operation::BuildError> {
119        ::std::result::Result::Ok(crate::operation::invoke_model::InvokeModelOutput {
120            body: self.body.ok_or_else(|| {
121                ::aws_smithy_types::error::operation::BuildError::missing_field(
122                    "body",
123                    "body was not specified but it is required when building InvokeModelOutput",
124                )
125            })?,
126            content_type: self.content_type.ok_or_else(|| {
127                ::aws_smithy_types::error::operation::BuildError::missing_field(
128                    "content_type",
129                    "content_type was not specified but it is required when building InvokeModelOutput",
130                )
131            })?,
132            performance_config_latency: self.performance_config_latency,
133            _request_id: self._request_id,
134        })
135    }
136}
137impl ::std::fmt::Debug for InvokeModelOutputBuilder {
138    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
139        let mut formatter = f.debug_struct("InvokeModelOutputBuilder");
140        formatter.field("body", &"*** Sensitive Data Redacted ***");
141        formatter.field("content_type", &self.content_type);
142        formatter.field("performance_config_latency", &self.performance_config_latency);
143        formatter.field("_request_id", &self._request_id);
144        formatter.finish()
145    }
146}