aws-sdk-context 1.0.0

AWS SDK for AWS Context
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::agentic_retrieve::_agentic_retrieve_input::AgenticRetrieveInputBuilder;

pub use crate::operation::agentic_retrieve::_agentic_retrieve_output::AgenticRetrieveOutputBuilder;

impl crate::operation::agentic_retrieve::builders::AgenticRetrieveInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::agentic_retrieve::AgenticRetrieveOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::agentic_retrieve::AgenticRetrieveError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.agentic_retrieve();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `AgenticRetrieve`.
///
/// Retrieves ranked context from an agent context for a natural-language question, in a single response. Send the question as a user message in `messages` and read the ranked `retrievedContext`. AWS Context searches and traverses the agent context for you until it has gathered enough context or reaches `maxIterations`. Prefer this over SearchAgentContext when finding the context needs more than one search or hop. To stream progress and receive a generated answer, use AgenticRetrieveStream.
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct AgenticRetrieveFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::agentic_retrieve::builders::AgenticRetrieveInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::agentic_retrieve::AgenticRetrieveOutput,
        crate::operation::agentic_retrieve::AgenticRetrieveError,
    > for AgenticRetrieveFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::agentic_retrieve::AgenticRetrieveOutput,
            crate::operation::agentic_retrieve::AgenticRetrieveError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl AgenticRetrieveFluentBuilder {
    /// Creates a new `AgenticRetrieveFluentBuilder`.
    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 AgenticRetrieve as a reference.
    pub fn as_input(&self) -> &crate::operation::agentic_retrieve::builders::AgenticRetrieveInputBuilder {
        &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::agentic_retrieve::AgenticRetrieveOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::agentic_retrieve::AgenticRetrieveError,
            ::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::agentic_retrieve::AgenticRetrieve::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::agentic_retrieve::AgenticRetrieve::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::agentic_retrieve::AgenticRetrieveOutput,
        crate::operation::agentic_retrieve::AgenticRetrieveError,
        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
    }
    /// The agent context to retrieve from, by its ID or ARN.
    pub fn agent_context_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.agent_context_id(input.into());
        self
    }
    /// The agent context to retrieve from, by its ID or ARN.
    pub fn set_agent_context_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_agent_context_id(input);
        self
    }
    /// The agent context to retrieve from, by its ID or ARN.
    pub fn get_agent_context_id(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_agent_context_id()
    }
    ///
    /// Appends an item to `messages`.
    ///
    /// To override the contents of this collection use [`set_messages`](Self::set_messages).
    ///
    /// The conversation, as an ordered list of turns. A single-question caller sends one user message. The list carries multi-turn history so a follow-up resolves against earlier turns.
    pub fn messages(mut self, input: crate::types::Message) -> Self {
        self.inner = self.inner.messages(input);
        self
    }
    /// The conversation, as an ordered list of turns. A single-question caller sends one user message. The list carries multi-turn history so a follow-up resolves against earlier turns.
    pub fn set_messages(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Message>>) -> Self {
        self.inner = self.inner.set_messages(input);
        self
    }
    /// The conversation, as an ordered list of turns. A single-question caller sends one user message. The list carries multi-turn history so a follow-up resolves against earlier turns.
    pub fn get_messages(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Message>> {
        self.inner.get_messages()
    }
    /// Optional. A key that you supply to group related calls, for example the turns of one conversation, for trace storage and analysis. Grouping is per account, across agent contexts, so use a value that is unique to each conversation.
    pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.session_id(input.into());
        self
    }
    /// Optional. A key that you supply to group related calls, for example the turns of one conversation, for trace storage and analysis. Grouping is per account, across agent contexts, so use a value that is unique to each conversation.
    pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_session_id(input);
        self
    }
    /// Optional. A key that you supply to group related calls, for example the turns of one conversation, for trace storage and analysis. Grouping is per account, across agent contexts, so use a value that is unique to each conversation.
    pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_session_id()
    }
    /// Optional controls for post-call analysis of the retrieval: whether its trace is stored for analysis.
    pub fn analysis_configuration(mut self, input: crate::types::AnalysisConfiguration) -> Self {
        self.inner = self.inner.analysis_configuration(input);
        self
    }
    /// Optional controls for post-call analysis of the retrieval: whether its trace is stored for analysis.
    pub fn set_analysis_configuration(mut self, input: ::std::option::Option<crate::types::AnalysisConfiguration>) -> Self {
        self.inner = self.inner.set_analysis_configuration(input);
        self
    }
    /// Optional controls for post-call analysis of the retrieval: whether its trace is stored for analysis.
    pub fn get_analysis_configuration(&self) -> &::std::option::Option<crate::types::AnalysisConfiguration> {
        self.inner.get_analysis_configuration()
    }
    /// Optional bounds and configuration for the agent loop.
    pub fn retrieval_configuration(mut self, input: crate::types::RetrievalConfiguration) -> Self {
        self.inner = self.inner.retrieval_configuration(input);
        self
    }
    /// Optional bounds and configuration for the agent loop.
    pub fn set_retrieval_configuration(mut self, input: ::std::option::Option<crate::types::RetrievalConfiguration>) -> Self {
        self.inner = self.inner.set_retrieval_configuration(input);
        self
    }
    /// Optional bounds and configuration for the agent loop.
    pub fn get_retrieval_configuration(&self) -> &::std::option::Option<crate::types::RetrievalConfiguration> {
        self.inner.get_retrieval_configuration()
    }
}