aws_sdk_bedrockagentruntime/operation/invoke_agent/
_invoke_agent_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::fmt::Debug)]
5pub struct InvokeAgentOutput {
6    /// <p>The agent's response to the user prompt.</p>
7    pub completion: crate::event_receiver::EventReceiver<crate::types::ResponseStream, crate::types::error::ResponseStreamError>,
8    /// <p>The MIME type of the input data in the request. The default value is <code>application/json</code>.</p>
9    pub content_type: ::std::string::String,
10    /// <p>The unique identifier of the session with the agent.</p>
11    pub session_id: ::std::string::String,
12    /// <p>The unique identifier of the agent memory.</p>
13    pub memory_id: ::std::option::Option<::std::string::String>,
14    _request_id: Option<String>,
15}
16impl InvokeAgentOutput {
17    /// <p>The agent's response to the user prompt.</p>
18    pub fn completion(&self) -> &crate::event_receiver::EventReceiver<crate::types::ResponseStream, crate::types::error::ResponseStreamError> {
19        &self.completion
20    }
21    /// <p>The MIME type of the input data in the request. The default value is <code>application/json</code>.</p>
22    pub fn content_type(&self) -> &str {
23        use std::ops::Deref;
24        self.content_type.deref()
25    }
26    /// <p>The unique identifier of the session with the agent.</p>
27    pub fn session_id(&self) -> &str {
28        use std::ops::Deref;
29        self.session_id.deref()
30    }
31    /// <p>The unique identifier of the agent memory.</p>
32    pub fn memory_id(&self) -> ::std::option::Option<&str> {
33        self.memory_id.as_deref()
34    }
35}
36impl ::aws_types::request_id::RequestId for InvokeAgentOutput {
37    fn request_id(&self) -> Option<&str> {
38        self._request_id.as_deref()
39    }
40}
41impl InvokeAgentOutput {
42    /// Creates a new builder-style object to manufacture [`InvokeAgentOutput`](crate::operation::invoke_agent::InvokeAgentOutput).
43    pub fn builder() -> crate::operation::invoke_agent::builders::InvokeAgentOutputBuilder {
44        crate::operation::invoke_agent::builders::InvokeAgentOutputBuilder::default()
45    }
46}
47
48/// A builder for [`InvokeAgentOutput`](crate::operation::invoke_agent::InvokeAgentOutput).
49#[derive(::std::default::Default, ::std::fmt::Debug)]
50#[non_exhaustive]
51pub struct InvokeAgentOutputBuilder {
52    pub(crate) completion:
53        ::std::option::Option<crate::event_receiver::EventReceiver<crate::types::ResponseStream, crate::types::error::ResponseStreamError>>,
54    pub(crate) content_type: ::std::option::Option<::std::string::String>,
55    pub(crate) session_id: ::std::option::Option<::std::string::String>,
56    pub(crate) memory_id: ::std::option::Option<::std::string::String>,
57    _request_id: Option<String>,
58}
59impl InvokeAgentOutputBuilder {
60    /// <p>The agent's response to the user prompt.</p>
61    /// This field is required.
62    pub fn completion(
63        mut self,
64        input: crate::event_receiver::EventReceiver<crate::types::ResponseStream, crate::types::error::ResponseStreamError>,
65    ) -> Self {
66        self.completion = ::std::option::Option::Some(input);
67        self
68    }
69    /// <p>The agent's response to the user prompt.</p>
70    pub fn set_completion(
71        mut self,
72        input: ::std::option::Option<crate::event_receiver::EventReceiver<crate::types::ResponseStream, crate::types::error::ResponseStreamError>>,
73    ) -> Self {
74        self.completion = input;
75        self
76    }
77    /// <p>The agent's response to the user prompt.</p>
78    pub fn get_completion(
79        &self,
80    ) -> &::std::option::Option<crate::event_receiver::EventReceiver<crate::types::ResponseStream, crate::types::error::ResponseStreamError>> {
81        &self.completion
82    }
83    /// <p>The MIME type of the input data in the request. The default value is <code>application/json</code>.</p>
84    /// This field is required.
85    pub fn content_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
86        self.content_type = ::std::option::Option::Some(input.into());
87        self
88    }
89    /// <p>The MIME type of the input data in the request. The default value is <code>application/json</code>.</p>
90    pub fn set_content_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
91        self.content_type = input;
92        self
93    }
94    /// <p>The MIME type of the input data in the request. The default value is <code>application/json</code>.</p>
95    pub fn get_content_type(&self) -> &::std::option::Option<::std::string::String> {
96        &self.content_type
97    }
98    /// <p>The unique identifier of the session with the agent.</p>
99    /// This field is required.
100    pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
101        self.session_id = ::std::option::Option::Some(input.into());
102        self
103    }
104    /// <p>The unique identifier of the session with the agent.</p>
105    pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
106        self.session_id = input;
107        self
108    }
109    /// <p>The unique identifier of the session with the agent.</p>
110    pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
111        &self.session_id
112    }
113    /// <p>The unique identifier of the agent memory.</p>
114    pub fn memory_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115        self.memory_id = ::std::option::Option::Some(input.into());
116        self
117    }
118    /// <p>The unique identifier of the agent memory.</p>
119    pub fn set_memory_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.memory_id = input;
121        self
122    }
123    /// <p>The unique identifier of the agent memory.</p>
124    pub fn get_memory_id(&self) -> &::std::option::Option<::std::string::String> {
125        &self.memory_id
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 [`InvokeAgentOutput`](crate::operation::invoke_agent::InvokeAgentOutput).
137    /// This method will fail if any of the following fields are not set:
138    /// - [`completion`](crate::operation::invoke_agent::builders::InvokeAgentOutputBuilder::completion)
139    /// - [`content_type`](crate::operation::invoke_agent::builders::InvokeAgentOutputBuilder::content_type)
140    /// - [`session_id`](crate::operation::invoke_agent::builders::InvokeAgentOutputBuilder::session_id)
141    pub fn build(self) -> ::std::result::Result<crate::operation::invoke_agent::InvokeAgentOutput, ::aws_smithy_types::error::operation::BuildError> {
142        ::std::result::Result::Ok(crate::operation::invoke_agent::InvokeAgentOutput {
143            completion: self.completion.ok_or_else(|| {
144                ::aws_smithy_types::error::operation::BuildError::missing_field(
145                    "completion",
146                    "completion was not specified but it is required when building InvokeAgentOutput",
147                )
148            })?,
149            content_type: self.content_type.ok_or_else(|| {
150                ::aws_smithy_types::error::operation::BuildError::missing_field(
151                    "content_type",
152                    "content_type was not specified but it is required when building InvokeAgentOutput",
153                )
154            })?,
155            session_id: self.session_id.ok_or_else(|| {
156                ::aws_smithy_types::error::operation::BuildError::missing_field(
157                    "session_id",
158                    "session_id was not specified but it is required when building InvokeAgentOutput",
159                )
160            })?,
161            memory_id: self.memory_id,
162            _request_id: self._request_id,
163        })
164    }
165}