// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::retrieve::_retrieve_output::RetrieveOutputBuilder;
pub use crate::operation::retrieve::_retrieve_input::RetrieveInputBuilder;
impl crate::operation::retrieve::builders::RetrieveInputBuilder {
/// Sends a request with this input using the given client.
pub async fn send_with(
self,
client: &crate::Client,
) -> ::std::result::Result<
crate::operation::retrieve::RetrieveOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::retrieve::RetrieveError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let mut fluent_builder = client.retrieve();
fluent_builder.inner = self;
fluent_builder.send().await
}
}
/// Fluent builder constructing a request to `Retrieve`.
///
/// <p>Retrieves relevant passages or text excerpts given an input query.</p>
/// <p>This API is similar to the <a href="https://docs.aws.amazon.com/kendra/latest/APIReference/API_Query.html">Query</a> API. However, by default, the <code>Query</code> API only returns excerpt passages of up to 100 token words. With the <code>Retrieve</code> API, you can retrieve longer passages of up to 200 token words and up to 100 semantically relevant passages. This doesn't include question-answer or FAQ type responses from your index. The passages are text excerpts that can be semantically extracted from multiple documents and multiple parts of the same document. If in extreme cases your documents produce zero passages using the <code>Retrieve</code> API, you can alternatively use the <code>Query</code> API and its types of responses.</p>
/// <p>You can also do the following:</p>
/// <ul>
/// <li>
/// <p>Override boosting at the index level</p></li>
/// <li>
/// <p>Filter based on document fields or attributes</p></li>
/// <li>
/// <p>Filter based on the user or their group access to documents</p></li>
/// <li>
/// <p>View the confidence score bucket for a retrieved passage result. The confidence bucket provides a relative ranking that indicates how confident Amazon Kendra is that the response is relevant to the query.</p><note>
/// <p>Confidence score buckets are currently available only for English.</p>
/// </note></li>
/// </ul>
/// <p>You can also include certain fields in the response that might provide useful additional information.</p>
/// <p>The <code>Retrieve</code> API shares the number of <a href="https://docs.aws.amazon.com/kendra/latest/APIReference/API_CapacityUnitsConfiguration.html">query capacity units</a> that you set for your index. For more information on what's included in a single capacity unit and the default base capacity for an index, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/adjusting-capacity.html">Adjusting capacity</a>.</p><important>
/// <p>If you're using an Amazon Kendra Gen AI Enterprise Edition index, you can only use <code>ATTRIBUTE_FILTER</code> to filter search results by user context. If you're using an Amazon Kendra Gen AI Enterprise Edition index and you try to use <code>USER_TOKEN</code> to configure user context policy, Amazon Kendra returns a <code>ValidationException</code> error.</p>
/// </important>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct RetrieveFluentBuilder {
handle: ::std::sync::Arc<crate::client::Handle>,
inner: crate::operation::retrieve::builders::RetrieveInputBuilder,
config_override: ::std::option::Option<crate::config::Builder>,
}
impl crate::client::customize::internal::CustomizableSend<crate::operation::retrieve::RetrieveOutput, crate::operation::retrieve::RetrieveError>
for RetrieveFluentBuilder
{
fn send(
self,
config_override: crate::config::Builder,
) -> crate::client::customize::internal::BoxFuture<
crate::client::customize::internal::SendResult<crate::operation::retrieve::RetrieveOutput, crate::operation::retrieve::RetrieveError>,
> {
::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
}
}
impl RetrieveFluentBuilder {
/// Creates a new `RetrieveFluentBuilder`.
pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
Self {
handle,
inner: ::std::default::Default::default(),
config_override: ::std::option::Option::None,
}
}
/// Access the Retrieve as a reference.
pub fn as_input(&self) -> &crate::operation::retrieve::builders::RetrieveInputBuilder {
&self.inner
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> ::std::result::Result<
crate::operation::retrieve::RetrieveOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::retrieve::RetrieveError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let input = self
.inner
.build()
.map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
let runtime_plugins = crate::operation::retrieve::Retrieve::operation_runtime_plugins(
self.handle.runtime_plugins.clone(),
&self.handle.conf,
self.config_override,
);
crate::operation::retrieve::Retrieve::orchestrate(&runtime_plugins, input).await
}
/// Consumes this builder, creating a customizable operation that can be modified before being sent.
pub fn customize(
self,
) -> crate::client::customize::CustomizableOperation<crate::operation::retrieve::RetrieveOutput, crate::operation::retrieve::RetrieveError, Self>
{
crate::client::customize::CustomizableOperation::new(self)
}
pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
self.set_config_override(::std::option::Option::Some(config_override.into()));
self
}
pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
self.config_override = config_override;
self
}
/// <p>The identifier of the index to retrieve relevant passages for the search.</p>
pub fn index_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.index_id(input.into());
self
}
/// <p>The identifier of the index to retrieve relevant passages for the search.</p>
pub fn set_index_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_index_id(input);
self
}
/// <p>The identifier of the index to retrieve relevant passages for the search.</p>
pub fn get_index_id(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_index_id()
}
/// <p>The input query text to retrieve relevant passages for the search. Amazon Kendra truncates queries at 30 token words, which excludes punctuation and stop words. Truncation still applies if you use Boolean or more advanced, complex queries. For example, <code>Timeoff AND October AND Category:HR</code> is counted as 3 tokens: <code>timeoff</code>, <code>october</code>, <code>hr</code>. For more information, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/searching-example.html#searching-index-query-syntax">Searching with advanced query syntax</a> in the Amazon Kendra Developer Guide.</p>
pub fn query_text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.query_text(input.into());
self
}
/// <p>The input query text to retrieve relevant passages for the search. Amazon Kendra truncates queries at 30 token words, which excludes punctuation and stop words. Truncation still applies if you use Boolean or more advanced, complex queries. For example, <code>Timeoff AND October AND Category:HR</code> is counted as 3 tokens: <code>timeoff</code>, <code>october</code>, <code>hr</code>. For more information, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/searching-example.html#searching-index-query-syntax">Searching with advanced query syntax</a> in the Amazon Kendra Developer Guide.</p>
pub fn set_query_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_query_text(input);
self
}
/// <p>The input query text to retrieve relevant passages for the search. Amazon Kendra truncates queries at 30 token words, which excludes punctuation and stop words. Truncation still applies if you use Boolean or more advanced, complex queries. For example, <code>Timeoff AND October AND Category:HR</code> is counted as 3 tokens: <code>timeoff</code>, <code>october</code>, <code>hr</code>. For more information, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/searching-example.html#searching-index-query-syntax">Searching with advanced query syntax</a> in the Amazon Kendra Developer Guide.</p>
pub fn get_query_text(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_query_text()
}
/// <p>Filters search results by document fields/attributes. You can only provide one attribute filter; however, the <code>AndAllFilters</code>, <code>NotFilter</code>, and <code>OrAllFilters</code> parameters contain a list of other filters.</p>
/// <p>The <code>AttributeFilter</code> parameter means you can create a set of filtering rules that a document must satisfy to be included in the query results.</p><note>
/// <p>For Amazon Kendra Gen AI Enterprise Edition indices use <code>AttributeFilter</code> to enable document filtering for end users using <code>_email_id</code> or include public documents (<code>_email_id=null</code>).</p>
/// </note>
pub fn attribute_filter(mut self, input: crate::types::AttributeFilter) -> Self {
self.inner = self.inner.attribute_filter(input);
self
}
/// <p>Filters search results by document fields/attributes. You can only provide one attribute filter; however, the <code>AndAllFilters</code>, <code>NotFilter</code>, and <code>OrAllFilters</code> parameters contain a list of other filters.</p>
/// <p>The <code>AttributeFilter</code> parameter means you can create a set of filtering rules that a document must satisfy to be included in the query results.</p><note>
/// <p>For Amazon Kendra Gen AI Enterprise Edition indices use <code>AttributeFilter</code> to enable document filtering for end users using <code>_email_id</code> or include public documents (<code>_email_id=null</code>).</p>
/// </note>
pub fn set_attribute_filter(mut self, input: ::std::option::Option<crate::types::AttributeFilter>) -> Self {
self.inner = self.inner.set_attribute_filter(input);
self
}
/// <p>Filters search results by document fields/attributes. You can only provide one attribute filter; however, the <code>AndAllFilters</code>, <code>NotFilter</code>, and <code>OrAllFilters</code> parameters contain a list of other filters.</p>
/// <p>The <code>AttributeFilter</code> parameter means you can create a set of filtering rules that a document must satisfy to be included in the query results.</p><note>
/// <p>For Amazon Kendra Gen AI Enterprise Edition indices use <code>AttributeFilter</code> to enable document filtering for end users using <code>_email_id</code> or include public documents (<code>_email_id=null</code>).</p>
/// </note>
pub fn get_attribute_filter(&self) -> &::std::option::Option<crate::types::AttributeFilter> {
self.inner.get_attribute_filter()
}
///
/// Appends an item to `RequestedDocumentAttributes`.
///
/// To override the contents of this collection use [`set_requested_document_attributes`](Self::set_requested_document_attributes).
///
/// <p>A list of document fields/attributes to include in the response. You can limit the response to include certain document fields. By default, all document fields are included in the response.</p>
pub fn requested_document_attributes(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.requested_document_attributes(input.into());
self
}
/// <p>A list of document fields/attributes to include in the response. You can limit the response to include certain document fields. By default, all document fields are included in the response.</p>
pub fn set_requested_document_attributes(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
self.inner = self.inner.set_requested_document_attributes(input);
self
}
/// <p>A list of document fields/attributes to include in the response. You can limit the response to include certain document fields. By default, all document fields are included in the response.</p>
pub fn get_requested_document_attributes(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
self.inner.get_requested_document_attributes()
}
///
/// Appends an item to `DocumentRelevanceOverrideConfigurations`.
///
/// To override the contents of this collection use [`set_document_relevance_override_configurations`](Self::set_document_relevance_override_configurations).
///
/// <p>Overrides relevance tuning configurations of fields/attributes set at the index level.</p>
/// <p>If you use this API to override the relevance tuning configured at the index level, but there is no relevance tuning configured at the index level, then Amazon Kendra does not apply any relevance tuning.</p>
/// <p>If there is relevance tuning configured for fields at the index level, and you use this API to override only some of these fields, then for the fields you did not override, the importance is set to 1.</p>
pub fn document_relevance_override_configurations(mut self, input: crate::types::DocumentRelevanceConfiguration) -> Self {
self.inner = self.inner.document_relevance_override_configurations(input);
self
}
/// <p>Overrides relevance tuning configurations of fields/attributes set at the index level.</p>
/// <p>If you use this API to override the relevance tuning configured at the index level, but there is no relevance tuning configured at the index level, then Amazon Kendra does not apply any relevance tuning.</p>
/// <p>If there is relevance tuning configured for fields at the index level, and you use this API to override only some of these fields, then for the fields you did not override, the importance is set to 1.</p>
pub fn set_document_relevance_override_configurations(
mut self,
input: ::std::option::Option<::std::vec::Vec<crate::types::DocumentRelevanceConfiguration>>,
) -> Self {
self.inner = self.inner.set_document_relevance_override_configurations(input);
self
}
/// <p>Overrides relevance tuning configurations of fields/attributes set at the index level.</p>
/// <p>If you use this API to override the relevance tuning configured at the index level, but there is no relevance tuning configured at the index level, then Amazon Kendra does not apply any relevance tuning.</p>
/// <p>If there is relevance tuning configured for fields at the index level, and you use this API to override only some of these fields, then for the fields you did not override, the importance is set to 1.</p>
pub fn get_document_relevance_override_configurations(
&self,
) -> &::std::option::Option<::std::vec::Vec<crate::types::DocumentRelevanceConfiguration>> {
self.inner.get_document_relevance_override_configurations()
}
/// <p>Retrieved relevant passages are returned in pages the size of the <code>PageSize</code> parameter. By default, Amazon Kendra returns the first page of results. Use this parameter to get result pages after the first one.</p>
pub fn page_number(mut self, input: i32) -> Self {
self.inner = self.inner.page_number(input);
self
}
/// <p>Retrieved relevant passages are returned in pages the size of the <code>PageSize</code> parameter. By default, Amazon Kendra returns the first page of results. Use this parameter to get result pages after the first one.</p>
pub fn set_page_number(mut self, input: ::std::option::Option<i32>) -> Self {
self.inner = self.inner.set_page_number(input);
self
}
/// <p>Retrieved relevant passages are returned in pages the size of the <code>PageSize</code> parameter. By default, Amazon Kendra returns the first page of results. Use this parameter to get result pages after the first one.</p>
pub fn get_page_number(&self) -> &::std::option::Option<i32> {
self.inner.get_page_number()
}
/// <p>Sets the number of retrieved relevant passages that are returned in each page of results. The default page size is 10. The maximum number of results returned is 100. If you ask for more than 100 results, only 100 are returned.</p>
pub fn page_size(mut self, input: i32) -> Self {
self.inner = self.inner.page_size(input);
self
}
/// <p>Sets the number of retrieved relevant passages that are returned in each page of results. The default page size is 10. The maximum number of results returned is 100. If you ask for more than 100 results, only 100 are returned.</p>
pub fn set_page_size(mut self, input: ::std::option::Option<i32>) -> Self {
self.inner = self.inner.set_page_size(input);
self
}
/// <p>Sets the number of retrieved relevant passages that are returned in each page of results. The default page size is 10. The maximum number of results returned is 100. If you ask for more than 100 results, only 100 are returned.</p>
pub fn get_page_size(&self) -> &::std::option::Option<i32> {
self.inner.get_page_size()
}
/// <p>The user context token or user and group information.</p>
pub fn user_context(mut self, input: crate::types::UserContext) -> Self {
self.inner = self.inner.user_context(input);
self
}
/// <p>The user context token or user and group information.</p>
pub fn set_user_context(mut self, input: ::std::option::Option<crate::types::UserContext>) -> Self {
self.inner = self.inner.set_user_context(input);
self
}
/// <p>The user context token or user and group information.</p>
pub fn get_user_context(&self) -> &::std::option::Option<crate::types::UserContext> {
self.inner.get_user_context()
}
}