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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>An object containing a segment of the generated response that is based on a source in the knowledge base, alongside information about the source.</p>
/// <p>This data type is used in the following API operations:</p>
/// <ul>
/// <li>
/// <p><a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html#API_agent-runtime_InvokeAgent_ResponseSyntax">InvokeAgent response</a> – in the <code>citations</code> field</p></li>
/// <li>
/// <p><a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_ResponseSyntax">RetrieveAndGenerate response</a> – in the <code>citations</code> field</p></li>
/// </ul>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Citation {
/// <p>Contains the generated response and metadata</p>
pub generated_response_part: ::std::option::Option<crate::types::GeneratedResponsePart>,
/// <p>Contains metadata about the sources cited for the generated response.</p>
pub retrieved_references: ::std::option::Option<::std::vec::Vec<crate::types::RetrievedReference>>,
}
impl Citation {
/// <p>Contains the generated response and metadata</p>
pub fn generated_response_part(&self) -> ::std::option::Option<&crate::types::GeneratedResponsePart> {
self.generated_response_part.as_ref()
}
/// <p>Contains metadata about the sources cited for the generated response.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.retrieved_references.is_none()`.
pub fn retrieved_references(&self) -> &[crate::types::RetrievedReference] {
self.retrieved_references.as_deref().unwrap_or_default()
}
}
impl Citation {
/// Creates a new builder-style object to manufacture [`Citation`](crate::types::Citation).
pub fn builder() -> crate::types::builders::CitationBuilder {
crate::types::builders::CitationBuilder::default()
}
}
/// A builder for [`Citation`](crate::types::Citation).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct CitationBuilder {
pub(crate) generated_response_part: ::std::option::Option<crate::types::GeneratedResponsePart>,
pub(crate) retrieved_references: ::std::option::Option<::std::vec::Vec<crate::types::RetrievedReference>>,
}
impl CitationBuilder {
/// <p>Contains the generated response and metadata</p>
pub fn generated_response_part(mut self, input: crate::types::GeneratedResponsePart) -> Self {
self.generated_response_part = ::std::option::Option::Some(input);
self
}
/// <p>Contains the generated response and metadata</p>
pub fn set_generated_response_part(mut self, input: ::std::option::Option<crate::types::GeneratedResponsePart>) -> Self {
self.generated_response_part = input;
self
}
/// <p>Contains the generated response and metadata</p>
pub fn get_generated_response_part(&self) -> &::std::option::Option<crate::types::GeneratedResponsePart> {
&self.generated_response_part
}
/// Appends an item to `retrieved_references`.
///
/// To override the contents of this collection use [`set_retrieved_references`](Self::set_retrieved_references).
///
/// <p>Contains metadata about the sources cited for the generated response.</p>
pub fn retrieved_references(mut self, input: crate::types::RetrievedReference) -> Self {
let mut v = self.retrieved_references.unwrap_or_default();
v.push(input);
self.retrieved_references = ::std::option::Option::Some(v);
self
}
/// <p>Contains metadata about the sources cited for the generated response.</p>
pub fn set_retrieved_references(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RetrievedReference>>) -> Self {
self.retrieved_references = input;
self
}
/// <p>Contains metadata about the sources cited for the generated response.</p>
pub fn get_retrieved_references(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RetrievedReference>> {
&self.retrieved_references
}
/// Consumes the builder and constructs a [`Citation`](crate::types::Citation).
pub fn build(self) -> crate::types::Citation {
crate::types::Citation {
generated_response_part: self.generated_response_part,
retrieved_references: self.retrieved_references,
}
}
}