aws-sdk-bedrockagent 1.23.0

AWS SDK for Agents for Amazon Bedrock
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::create_agent::_create_agent_output::CreateAgentOutputBuilder;

pub use crate::operation::create_agent::_create_agent_input::CreateAgentInputBuilder;

impl crate::operation::create_agent::builders::CreateAgentInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::create_agent::CreateAgentOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::create_agent::CreateAgentError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.create_agent();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `CreateAgent`.
///
/// <p>Creates an agent that orchestrates interactions between foundation models, data sources, software applications, user conversations, and APIs to carry out tasks to help customers.</p>
/// <ul>
/// <li>
/// <p>Specify the following fields for security purposes.</p>
/// <ul>
/// <li>
/// <p><code>agentResourceRoleArn</code> – The Amazon Resource Name (ARN) of the role with permissions to invoke API operations on an agent.</p></li>
/// <li>
/// <p>(Optional) <code>customerEncryptionKeyArn</code> – The Amazon Resource Name (ARN) of a KMS key to encrypt the creation of the agent.</p></li>
/// <li>
/// <p>(Optional) <code>idleSessionTTLinSeconds</code> – Specify the number of seconds for which the agent should maintain session information. After this time expires, the subsequent <code>InvokeAgent</code> request begins a new session.</p></li>
/// </ul></li>
/// <li>
/// <p>To override the default prompt behavior for agent orchestration and to use advanced prompts, include a <code>promptOverrideConfiguration</code> object. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/advanced-prompts.html">Advanced prompts</a>.</p></li>
/// <li>
/// <p>If you agent fails to be created, the response returns a list of <code>failureReasons</code> alongside a list of <code>recommendedActions</code> for you to troubleshoot.</p></li>
/// </ul>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct CreateAgentFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::create_agent::builders::CreateAgentInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::create_agent::CreateAgentOutput,
        crate::operation::create_agent::CreateAgentError,
    > for CreateAgentFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::create_agent::CreateAgentOutput,
            crate::operation::create_agent::CreateAgentError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl CreateAgentFluentBuilder {
    /// Creates a new `CreateAgentFluentBuilder`.
    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 CreateAgent as a reference.
    pub fn as_input(&self) -> &crate::operation::create_agent::builders::CreateAgentInputBuilder {
        &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::create_agent::CreateAgentOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::create_agent::CreateAgentError,
            ::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::create_agent::CreateAgent::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::create_agent::CreateAgent::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::create_agent::CreateAgentOutput,
        crate::operation::create_agent::CreateAgentError,
        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>A name for the agent that you create.</p>
    pub fn agent_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.agent_name(input.into());
        self
    }
    /// <p>A name for the agent that you create.</p>
    pub fn set_agent_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_agent_name(input);
        self
    }
    /// <p>A name for the agent that you create.</p>
    pub fn get_agent_name(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_agent_name()
    }
    /// <p>A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a>.</p>
    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.client_token(input.into());
        self
    }
    /// <p>A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a>.</p>
    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_client_token(input);
        self
    }
    /// <p>A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a>.</p>
    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_client_token()
    }
    /// <p>Instructions that tell the agent what it should do and how it should interact with users.</p>
    pub fn instruction(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.instruction(input.into());
        self
    }
    /// <p>Instructions that tell the agent what it should do and how it should interact with users.</p>
    pub fn set_instruction(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_instruction(input);
        self
    }
    /// <p>Instructions that tell the agent what it should do and how it should interact with users.</p>
    pub fn get_instruction(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_instruction()
    }
    /// <p>The foundation model to be used for orchestration by the agent you create.</p>
    pub fn foundation_model(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.foundation_model(input.into());
        self
    }
    /// <p>The foundation model to be used for orchestration by the agent you create.</p>
    pub fn set_foundation_model(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_foundation_model(input);
        self
    }
    /// <p>The foundation model to be used for orchestration by the agent you create.</p>
    pub fn get_foundation_model(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_foundation_model()
    }
    /// <p>A description of the agent.</p>
    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.description(input.into());
        self
    }
    /// <p>A description of the agent.</p>
    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_description(input);
        self
    }
    /// <p>A description of the agent.</p>
    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_description()
    }
    /// <p>The number of seconds for which Amazon Bedrock keeps information about a user's conversation with the agent.</p>
    /// <p>A user interaction remains active for the amount of time specified. If no conversation occurs during this time, the session expires and Amazon Bedrock deletes any data provided before the timeout.</p>
    pub fn idle_session_ttl_in_seconds(mut self, input: i32) -> Self {
        self.inner = self.inner.idle_session_ttl_in_seconds(input);
        self
    }
    /// <p>The number of seconds for which Amazon Bedrock keeps information about a user's conversation with the agent.</p>
    /// <p>A user interaction remains active for the amount of time specified. If no conversation occurs during this time, the session expires and Amazon Bedrock deletes any data provided before the timeout.</p>
    pub fn set_idle_session_ttl_in_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
        self.inner = self.inner.set_idle_session_ttl_in_seconds(input);
        self
    }
    /// <p>The number of seconds for which Amazon Bedrock keeps information about a user's conversation with the agent.</p>
    /// <p>A user interaction remains active for the amount of time specified. If no conversation occurs during this time, the session expires and Amazon Bedrock deletes any data provided before the timeout.</p>
    pub fn get_idle_session_ttl_in_seconds(&self) -> &::std::option::Option<i32> {
        self.inner.get_idle_session_ttl_in_seconds()
    }
    /// <p>The Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the agent.</p>
    pub fn agent_resource_role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.agent_resource_role_arn(input.into());
        self
    }
    /// <p>The Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the agent.</p>
    pub fn set_agent_resource_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_agent_resource_role_arn(input);
        self
    }
    /// <p>The Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the agent.</p>
    pub fn get_agent_resource_role_arn(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_agent_resource_role_arn()
    }
    /// <p>The Amazon Resource Name (ARN) of the KMS key with which to encrypt the agent.</p>
    pub fn customer_encryption_key_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.customer_encryption_key_arn(input.into());
        self
    }
    /// <p>The Amazon Resource Name (ARN) of the KMS key with which to encrypt the agent.</p>
    pub fn set_customer_encryption_key_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_customer_encryption_key_arn(input);
        self
    }
    /// <p>The Amazon Resource Name (ARN) of the KMS key with which to encrypt the agent.</p>
    pub fn get_customer_encryption_key_arn(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_customer_encryption_key_arn()
    }
    ///
    /// Adds a key-value pair to `tags`.
    ///
    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
    ///
    /// <p>Any tags that you want to attach to the agent.</p>
    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.tags(k.into(), v.into());
        self
    }
    /// <p>Any tags that you want to attach to the agent.</p>
    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
        self.inner = self.inner.set_tags(input);
        self
    }
    /// <p>Any tags that you want to attach to the agent.</p>
    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
        self.inner.get_tags()
    }
    /// <p>Contains configurations to override prompts in different parts of an agent sequence. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/advanced-prompts.html">Advanced prompts</a>.</p>
    pub fn prompt_override_configuration(mut self, input: crate::types::PromptOverrideConfiguration) -> Self {
        self.inner = self.inner.prompt_override_configuration(input);
        self
    }
    /// <p>Contains configurations to override prompts in different parts of an agent sequence. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/advanced-prompts.html">Advanced prompts</a>.</p>
    pub fn set_prompt_override_configuration(mut self, input: ::std::option::Option<crate::types::PromptOverrideConfiguration>) -> Self {
        self.inner = self.inner.set_prompt_override_configuration(input);
        self
    }
    /// <p>Contains configurations to override prompts in different parts of an agent sequence. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/advanced-prompts.html">Advanced prompts</a>.</p>
    pub fn get_prompt_override_configuration(&self) -> &::std::option::Option<crate::types::PromptOverrideConfiguration> {
        self.inner.get_prompt_override_configuration()
    }
}