aws_sdk_bedrockagentruntime/operation/retrieve/
_retrieve_input.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 RetrieveInput {
6    /// <p>The unique identifier of the knowledge base to query.</p>
7    pub knowledge_base_id: ::std::option::Option<::std::string::String>,
8    /// <p>Contains the query to send the knowledge base.</p>
9    pub retrieval_query: ::std::option::Option<crate::types::KnowledgeBaseQuery>,
10    /// <p>Contains configurations for the knowledge base query and retrieval process. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.</p>
11    pub retrieval_configuration: ::std::option::Option<crate::types::KnowledgeBaseRetrievalConfiguration>,
12    /// <p>Guardrail settings.</p>
13    pub guardrail_configuration: ::std::option::Option<crate::types::GuardrailConfiguration>,
14    /// <p>If there are more results than can fit in the response, the response returns a <code>nextToken</code>. Use this token in the <code>nextToken</code> field of another request to retrieve the next batch of results.</p>
15    pub next_token: ::std::option::Option<::std::string::String>,
16}
17impl RetrieveInput {
18    /// <p>The unique identifier of the knowledge base to query.</p>
19    pub fn knowledge_base_id(&self) -> ::std::option::Option<&str> {
20        self.knowledge_base_id.as_deref()
21    }
22    /// <p>Contains the query to send the knowledge base.</p>
23    pub fn retrieval_query(&self) -> ::std::option::Option<&crate::types::KnowledgeBaseQuery> {
24        self.retrieval_query.as_ref()
25    }
26    /// <p>Contains configurations for the knowledge base query and retrieval process. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.</p>
27    pub fn retrieval_configuration(&self) -> ::std::option::Option<&crate::types::KnowledgeBaseRetrievalConfiguration> {
28        self.retrieval_configuration.as_ref()
29    }
30    /// <p>Guardrail settings.</p>
31    pub fn guardrail_configuration(&self) -> ::std::option::Option<&crate::types::GuardrailConfiguration> {
32        self.guardrail_configuration.as_ref()
33    }
34    /// <p>If there are more results than can fit in the response, the response returns a <code>nextToken</code>. Use this token in the <code>nextToken</code> field of another request to retrieve the next batch of results.</p>
35    pub fn next_token(&self) -> ::std::option::Option<&str> {
36        self.next_token.as_deref()
37    }
38}
39impl ::std::fmt::Debug for RetrieveInput {
40    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
41        let mut formatter = f.debug_struct("RetrieveInput");
42        formatter.field("knowledge_base_id", &self.knowledge_base_id);
43        formatter.field("retrieval_query", &"*** Sensitive Data Redacted ***");
44        formatter.field("retrieval_configuration", &self.retrieval_configuration);
45        formatter.field("guardrail_configuration", &self.guardrail_configuration);
46        formatter.field("next_token", &self.next_token);
47        formatter.finish()
48    }
49}
50impl RetrieveInput {
51    /// Creates a new builder-style object to manufacture [`RetrieveInput`](crate::operation::retrieve::RetrieveInput).
52    pub fn builder() -> crate::operation::retrieve::builders::RetrieveInputBuilder {
53        crate::operation::retrieve::builders::RetrieveInputBuilder::default()
54    }
55}
56
57/// A builder for [`RetrieveInput`](crate::operation::retrieve::RetrieveInput).
58#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
59#[non_exhaustive]
60pub struct RetrieveInputBuilder {
61    pub(crate) knowledge_base_id: ::std::option::Option<::std::string::String>,
62    pub(crate) retrieval_query: ::std::option::Option<crate::types::KnowledgeBaseQuery>,
63    pub(crate) retrieval_configuration: ::std::option::Option<crate::types::KnowledgeBaseRetrievalConfiguration>,
64    pub(crate) guardrail_configuration: ::std::option::Option<crate::types::GuardrailConfiguration>,
65    pub(crate) next_token: ::std::option::Option<::std::string::String>,
66}
67impl RetrieveInputBuilder {
68    /// <p>The unique identifier of the knowledge base to query.</p>
69    /// This field is required.
70    pub fn knowledge_base_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
71        self.knowledge_base_id = ::std::option::Option::Some(input.into());
72        self
73    }
74    /// <p>The unique identifier of the knowledge base to query.</p>
75    pub fn set_knowledge_base_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
76        self.knowledge_base_id = input;
77        self
78    }
79    /// <p>The unique identifier of the knowledge base to query.</p>
80    pub fn get_knowledge_base_id(&self) -> &::std::option::Option<::std::string::String> {
81        &self.knowledge_base_id
82    }
83    /// <p>Contains the query to send the knowledge base.</p>
84    /// This field is required.
85    pub fn retrieval_query(mut self, input: crate::types::KnowledgeBaseQuery) -> Self {
86        self.retrieval_query = ::std::option::Option::Some(input);
87        self
88    }
89    /// <p>Contains the query to send the knowledge base.</p>
90    pub fn set_retrieval_query(mut self, input: ::std::option::Option<crate::types::KnowledgeBaseQuery>) -> Self {
91        self.retrieval_query = input;
92        self
93    }
94    /// <p>Contains the query to send the knowledge base.</p>
95    pub fn get_retrieval_query(&self) -> &::std::option::Option<crate::types::KnowledgeBaseQuery> {
96        &self.retrieval_query
97    }
98    /// <p>Contains configurations for the knowledge base query and retrieval process. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.</p>
99    pub fn retrieval_configuration(mut self, input: crate::types::KnowledgeBaseRetrievalConfiguration) -> Self {
100        self.retrieval_configuration = ::std::option::Option::Some(input);
101        self
102    }
103    /// <p>Contains configurations for the knowledge base query and retrieval process. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.</p>
104    pub fn set_retrieval_configuration(mut self, input: ::std::option::Option<crate::types::KnowledgeBaseRetrievalConfiguration>) -> Self {
105        self.retrieval_configuration = input;
106        self
107    }
108    /// <p>Contains configurations for the knowledge base query and retrieval process. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.</p>
109    pub fn get_retrieval_configuration(&self) -> &::std::option::Option<crate::types::KnowledgeBaseRetrievalConfiguration> {
110        &self.retrieval_configuration
111    }
112    /// <p>Guardrail settings.</p>
113    pub fn guardrail_configuration(mut self, input: crate::types::GuardrailConfiguration) -> Self {
114        self.guardrail_configuration = ::std::option::Option::Some(input);
115        self
116    }
117    /// <p>Guardrail settings.</p>
118    pub fn set_guardrail_configuration(mut self, input: ::std::option::Option<crate::types::GuardrailConfiguration>) -> Self {
119        self.guardrail_configuration = input;
120        self
121    }
122    /// <p>Guardrail settings.</p>
123    pub fn get_guardrail_configuration(&self) -> &::std::option::Option<crate::types::GuardrailConfiguration> {
124        &self.guardrail_configuration
125    }
126    /// <p>If there are more results than can fit in the response, the response returns a <code>nextToken</code>. Use this token in the <code>nextToken</code> field of another request to retrieve the next batch of results.</p>
127    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.next_token = ::std::option::Option::Some(input.into());
129        self
130    }
131    /// <p>If there are more results than can fit in the response, the response returns a <code>nextToken</code>. Use this token in the <code>nextToken</code> field of another request to retrieve the next batch of results.</p>
132    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
133        self.next_token = input;
134        self
135    }
136    /// <p>If there are more results than can fit in the response, the response returns a <code>nextToken</code>. Use this token in the <code>nextToken</code> field of another request to retrieve the next batch of results.</p>
137    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
138        &self.next_token
139    }
140    /// Consumes the builder and constructs a [`RetrieveInput`](crate::operation::retrieve::RetrieveInput).
141    pub fn build(self) -> ::std::result::Result<crate::operation::retrieve::RetrieveInput, ::aws_smithy_types::error::operation::BuildError> {
142        ::std::result::Result::Ok(crate::operation::retrieve::RetrieveInput {
143            knowledge_base_id: self.knowledge_base_id,
144            retrieval_query: self.retrieval_query,
145            retrieval_configuration: self.retrieval_configuration,
146            guardrail_configuration: self.guardrail_configuration,
147            next_token: self.next_token,
148        })
149    }
150}
151impl ::std::fmt::Debug for RetrieveInputBuilder {
152    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
153        let mut formatter = f.debug_struct("RetrieveInputBuilder");
154        formatter.field("knowledge_base_id", &self.knowledge_base_id);
155        formatter.field("retrieval_query", &"*** Sensitive Data Redacted ***");
156        formatter.field("retrieval_configuration", &self.retrieval_configuration);
157        formatter.field("guardrail_configuration", &self.guardrail_configuration);
158        formatter.field("next_token", &self.next_token);
159        formatter.finish()
160    }
161}