aws_sdk_bedrockagentruntime/operation/rerank/
_rerank_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 RerankInput {
6    /// <p>An array of objects, each of which contains information about a query to submit to the reranker model.</p>
7    pub queries: ::std::option::Option<::std::vec::Vec<crate::types::RerankQuery>>,
8    /// <p>An array of objects, each of which contains information about the sources to rerank.</p>
9    pub sources: ::std::option::Option<::std::vec::Vec<crate::types::RerankSource>>,
10    /// <p>Contains configurations for reranking.</p>
11    pub reranking_configuration: ::std::option::Option<crate::types::RerankingConfiguration>,
12    /// <p>If the total number of results was greater than could fit in a response, a token is returned in the <code>nextToken</code> field. You can enter that token in this field to return the next batch of results.</p>
13    pub next_token: ::std::option::Option<::std::string::String>,
14}
15impl RerankInput {
16    /// <p>An array of objects, each of which contains information about a query to submit to the reranker model.</p>
17    ///
18    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.queries.is_none()`.
19    pub fn queries(&self) -> &[crate::types::RerankQuery] {
20        self.queries.as_deref().unwrap_or_default()
21    }
22    /// <p>An array of objects, each of which contains information about the sources to rerank.</p>
23    ///
24    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.sources.is_none()`.
25    pub fn sources(&self) -> &[crate::types::RerankSource] {
26        self.sources.as_deref().unwrap_or_default()
27    }
28    /// <p>Contains configurations for reranking.</p>
29    pub fn reranking_configuration(&self) -> ::std::option::Option<&crate::types::RerankingConfiguration> {
30        self.reranking_configuration.as_ref()
31    }
32    /// <p>If the total number of results was greater than could fit in a response, a token is returned in the <code>nextToken</code> field. You can enter that token in this field to return the next batch of results.</p>
33    pub fn next_token(&self) -> ::std::option::Option<&str> {
34        self.next_token.as_deref()
35    }
36}
37impl ::std::fmt::Debug for RerankInput {
38    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
39        let mut formatter = f.debug_struct("RerankInput");
40        formatter.field("queries", &"*** Sensitive Data Redacted ***");
41        formatter.field("sources", &"*** Sensitive Data Redacted ***");
42        formatter.field("reranking_configuration", &self.reranking_configuration);
43        formatter.field("next_token", &self.next_token);
44        formatter.finish()
45    }
46}
47impl RerankInput {
48    /// Creates a new builder-style object to manufacture [`RerankInput`](crate::operation::rerank::RerankInput).
49    pub fn builder() -> crate::operation::rerank::builders::RerankInputBuilder {
50        crate::operation::rerank::builders::RerankInputBuilder::default()
51    }
52}
53
54/// A builder for [`RerankInput`](crate::operation::rerank::RerankInput).
55#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
56#[non_exhaustive]
57pub struct RerankInputBuilder {
58    pub(crate) queries: ::std::option::Option<::std::vec::Vec<crate::types::RerankQuery>>,
59    pub(crate) sources: ::std::option::Option<::std::vec::Vec<crate::types::RerankSource>>,
60    pub(crate) reranking_configuration: ::std::option::Option<crate::types::RerankingConfiguration>,
61    pub(crate) next_token: ::std::option::Option<::std::string::String>,
62}
63impl RerankInputBuilder {
64    /// Appends an item to `queries`.
65    ///
66    /// To override the contents of this collection use [`set_queries`](Self::set_queries).
67    ///
68    /// <p>An array of objects, each of which contains information about a query to submit to the reranker model.</p>
69    pub fn queries(mut self, input: crate::types::RerankQuery) -> Self {
70        let mut v = self.queries.unwrap_or_default();
71        v.push(input);
72        self.queries = ::std::option::Option::Some(v);
73        self
74    }
75    /// <p>An array of objects, each of which contains information about a query to submit to the reranker model.</p>
76    pub fn set_queries(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RerankQuery>>) -> Self {
77        self.queries = input;
78        self
79    }
80    /// <p>An array of objects, each of which contains information about a query to submit to the reranker model.</p>
81    pub fn get_queries(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RerankQuery>> {
82        &self.queries
83    }
84    /// Appends an item to `sources`.
85    ///
86    /// To override the contents of this collection use [`set_sources`](Self::set_sources).
87    ///
88    /// <p>An array of objects, each of which contains information about the sources to rerank.</p>
89    pub fn sources(mut self, input: crate::types::RerankSource) -> Self {
90        let mut v = self.sources.unwrap_or_default();
91        v.push(input);
92        self.sources = ::std::option::Option::Some(v);
93        self
94    }
95    /// <p>An array of objects, each of which contains information about the sources to rerank.</p>
96    pub fn set_sources(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RerankSource>>) -> Self {
97        self.sources = input;
98        self
99    }
100    /// <p>An array of objects, each of which contains information about the sources to rerank.</p>
101    pub fn get_sources(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RerankSource>> {
102        &self.sources
103    }
104    /// <p>Contains configurations for reranking.</p>
105    /// This field is required.
106    pub fn reranking_configuration(mut self, input: crate::types::RerankingConfiguration) -> Self {
107        self.reranking_configuration = ::std::option::Option::Some(input);
108        self
109    }
110    /// <p>Contains configurations for reranking.</p>
111    pub fn set_reranking_configuration(mut self, input: ::std::option::Option<crate::types::RerankingConfiguration>) -> Self {
112        self.reranking_configuration = input;
113        self
114    }
115    /// <p>Contains configurations for reranking.</p>
116    pub fn get_reranking_configuration(&self) -> &::std::option::Option<crate::types::RerankingConfiguration> {
117        &self.reranking_configuration
118    }
119    /// <p>If the total number of results was greater than could fit in a response, a token is returned in the <code>nextToken</code> field. You can enter that token in this field to return the next batch of results.</p>
120    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
121        self.next_token = ::std::option::Option::Some(input.into());
122        self
123    }
124    /// <p>If the total number of results was greater than could fit in a response, a token is returned in the <code>nextToken</code> field. You can enter that token in this field to return the next batch of results.</p>
125    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
126        self.next_token = input;
127        self
128    }
129    /// <p>If the total number of results was greater than could fit in a response, a token is returned in the <code>nextToken</code> field. You can enter that token in this field to return the next batch of results.</p>
130    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
131        &self.next_token
132    }
133    /// Consumes the builder and constructs a [`RerankInput`](crate::operation::rerank::RerankInput).
134    pub fn build(self) -> ::std::result::Result<crate::operation::rerank::RerankInput, ::aws_smithy_types::error::operation::BuildError> {
135        ::std::result::Result::Ok(crate::operation::rerank::RerankInput {
136            queries: self.queries,
137            sources: self.sources,
138            reranking_configuration: self.reranking_configuration,
139            next_token: self.next_token,
140        })
141    }
142}
143impl ::std::fmt::Debug for RerankInputBuilder {
144    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
145        let mut formatter = f.debug_struct("RerankInputBuilder");
146        formatter.field("queries", &"*** Sensitive Data Redacted ***");
147        formatter.field("sources", &"*** Sensitive Data Redacted ***");
148        formatter.field("reranking_configuration", &self.reranking_configuration);
149        formatter.field("next_token", &self.next_token);
150        formatter.finish()
151    }
152}