1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// The result of a retrieval. `retrievedContext` is always present. A response that only asks for authorization carries `authorizationRequired` beside an empty `retrievedContext`.
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct AgenticRetrieveOutput {
/// The ranked, structured context that the agent assembled across all iterations, without duplicates. Always present. Each entry is a graph node, a graph edge, or a document.
pub retrieved_context: ::std::vec::Vec<crate::types::RetrievedContext>,
/// The synthesized natural-language answer, when one was generated.
pub answer: ::std::option::Option<::std::string::String>,
/// Maps spans of answer to the supporting entities, when an answer was generated.
pub citations: ::std::option::Option<::std::vec::Vec<crate::types::Citation>>,
/// Present when you must authorize access to a third-party resource. If `retrievedContext` is empty, no result was retrieved. Otherwise, the result leaves out one or more resources that you have not authorized. Show `authorizationUrl` to the user and retry after they consent.
pub authorization_required: ::std::option::Option<crate::types::AuthorizationRequired>,
_request_id: Option<String>,
}
impl AgenticRetrieveOutput {
/// The ranked, structured context that the agent assembled across all iterations, without duplicates. Always present. Each entry is a graph node, a graph edge, or a document.
pub fn retrieved_context(&self) -> &[crate::types::RetrievedContext] {
use std::ops::Deref;
self.retrieved_context.deref()
}
/// The synthesized natural-language answer, when one was generated.
pub fn answer(&self) -> ::std::option::Option<&str> {
self.answer.as_deref()
}
/// Maps spans of answer to the supporting entities, when an answer was generated.
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.citations.is_none()`.
pub fn citations(&self) -> &[crate::types::Citation] {
self.citations.as_deref().unwrap_or_default()
}
/// Present when you must authorize access to a third-party resource. If `retrievedContext` is empty, no result was retrieved. Otherwise, the result leaves out one or more resources that you have not authorized. Show `authorizationUrl` to the user and retry after they consent.
pub fn authorization_required(&self) -> ::std::option::Option<&crate::types::AuthorizationRequired> {
self.authorization_required.as_ref()
}
}
impl ::std::fmt::Debug for AgenticRetrieveOutput {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
let mut formatter = f.debug_struct("AgenticRetrieveOutput");
formatter.field("retrieved_context", &self.retrieved_context);
formatter.field("answer", &"*** Sensitive Data Redacted ***");
formatter.field("citations", &self.citations);
formatter.field("authorization_required", &self.authorization_required);
formatter.field("_request_id", &self._request_id);
formatter.finish()
}
}
impl ::aws_types::request_id::RequestId for AgenticRetrieveOutput {
fn request_id(&self) -> Option<&str> {
self._request_id.as_deref()
}
}
impl AgenticRetrieveOutput {
/// Creates a new builder-style object to manufacture [`AgenticRetrieveOutput`](crate::operation::agentic_retrieve::AgenticRetrieveOutput).
pub fn builder() -> crate::operation::agentic_retrieve::builders::AgenticRetrieveOutputBuilder {
crate::operation::agentic_retrieve::builders::AgenticRetrieveOutputBuilder::default()
}
}
/// A builder for [`AgenticRetrieveOutput`](crate::operation::agentic_retrieve::AgenticRetrieveOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct AgenticRetrieveOutputBuilder {
pub(crate) retrieved_context: ::std::option::Option<::std::vec::Vec<crate::types::RetrievedContext>>,
pub(crate) answer: ::std::option::Option<::std::string::String>,
pub(crate) citations: ::std::option::Option<::std::vec::Vec<crate::types::Citation>>,
pub(crate) authorization_required: ::std::option::Option<crate::types::AuthorizationRequired>,
_request_id: Option<String>,
}
impl AgenticRetrieveOutputBuilder {
/// Appends an item to `retrieved_context`.
///
/// To override the contents of this collection use [`set_retrieved_context`](Self::set_retrieved_context).
///
/// The ranked, structured context that the agent assembled across all iterations, without duplicates. Always present. Each entry is a graph node, a graph edge, or a document.
pub fn retrieved_context(mut self, input: crate::types::RetrievedContext) -> Self {
let mut v = self.retrieved_context.unwrap_or_default();
v.push(input);
self.retrieved_context = ::std::option::Option::Some(v);
self
}
/// The ranked, structured context that the agent assembled across all iterations, without duplicates. Always present. Each entry is a graph node, a graph edge, or a document.
pub fn set_retrieved_context(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RetrievedContext>>) -> Self {
self.retrieved_context = input;
self
}
/// The ranked, structured context that the agent assembled across all iterations, without duplicates. Always present. Each entry is a graph node, a graph edge, or a document.
pub fn get_retrieved_context(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RetrievedContext>> {
&self.retrieved_context
}
/// The synthesized natural-language answer, when one was generated.
pub fn answer(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.answer = ::std::option::Option::Some(input.into());
self
}
/// The synthesized natural-language answer, when one was generated.
pub fn set_answer(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.answer = input;
self
}
/// The synthesized natural-language answer, when one was generated.
pub fn get_answer(&self) -> &::std::option::Option<::std::string::String> {
&self.answer
}
/// Appends an item to `citations`.
///
/// To override the contents of this collection use [`set_citations`](Self::set_citations).
///
/// Maps spans of answer to the supporting entities, when an answer was generated.
pub fn citations(mut self, input: crate::types::Citation) -> Self {
let mut v = self.citations.unwrap_or_default();
v.push(input);
self.citations = ::std::option::Option::Some(v);
self
}
/// Maps spans of answer to the supporting entities, when an answer was generated.
pub fn set_citations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Citation>>) -> Self {
self.citations = input;
self
}
/// Maps spans of answer to the supporting entities, when an answer was generated.
pub fn get_citations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Citation>> {
&self.citations
}
/// Present when you must authorize access to a third-party resource. If `retrievedContext` is empty, no result was retrieved. Otherwise, the result leaves out one or more resources that you have not authorized. Show `authorizationUrl` to the user and retry after they consent.
pub fn authorization_required(mut self, input: crate::types::AuthorizationRequired) -> Self {
self.authorization_required = ::std::option::Option::Some(input);
self
}
/// Present when you must authorize access to a third-party resource. If `retrievedContext` is empty, no result was retrieved. Otherwise, the result leaves out one or more resources that you have not authorized. Show `authorizationUrl` to the user and retry after they consent.
pub fn set_authorization_required(mut self, input: ::std::option::Option<crate::types::AuthorizationRequired>) -> Self {
self.authorization_required = input;
self
}
/// Present when you must authorize access to a third-party resource. If `retrievedContext` is empty, no result was retrieved. Otherwise, the result leaves out one or more resources that you have not authorized. Show `authorizationUrl` to the user and retry after they consent.
pub fn get_authorization_required(&self) -> &::std::option::Option<crate::types::AuthorizationRequired> {
&self.authorization_required
}
pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
self._request_id = Some(request_id.into());
self
}
pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
self._request_id = request_id;
self
}
/// Consumes the builder and constructs a [`AgenticRetrieveOutput`](crate::operation::agentic_retrieve::AgenticRetrieveOutput).
/// This method will fail if any of the following fields are not set:
/// - [`retrieved_context`](crate::operation::agentic_retrieve::builders::AgenticRetrieveOutputBuilder::retrieved_context)
pub fn build(
self,
) -> ::std::result::Result<crate::operation::agentic_retrieve::AgenticRetrieveOutput, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::operation::agentic_retrieve::AgenticRetrieveOutput {
retrieved_context: self.retrieved_context.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"retrieved_context",
"retrieved_context was not specified but it is required when building AgenticRetrieveOutput",
)
})?,
answer: self.answer,
citations: self.citations,
authorization_required: self.authorization_required,
_request_id: self._request_id,
})
}
}
impl ::std::fmt::Debug for AgenticRetrieveOutputBuilder {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
let mut formatter = f.debug_struct("AgenticRetrieveOutputBuilder");
formatter.field("retrieved_context", &self.retrieved_context);
formatter.field("answer", &"*** Sensitive Data Redacted ***");
formatter.field("citations", &self.citations);
formatter.field("authorization_required", &self.authorization_required);
formatter.field("_request_id", &self._request_id);
formatter.finish()
}
}