aws-sdk-bedrockagentruntime 1.126.0

AWS SDK for Agents for Amazon Bedrock Runtime
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Contains one part of the agent's reasoning process and results from calling API actions and querying knowledge bases. You can use the trace to understand how the agent arrived at the response it provided the customer. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/agents-test.html#trace-enablement">Trace enablement</a>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub enum Trace {
    /// <p>Details about the custom orchestration step in which the agent determines the order in which actions are executed.</p>
    CustomOrchestrationTrace(crate::types::CustomOrchestrationTrace),
    /// <p>Contains information about the failure of the interaction.</p>
    FailureTrace(crate::types::FailureTrace),
    /// <p>The trace details for a trace defined in the Guardrail filter.</p>
    GuardrailTrace(crate::types::GuardrailTrace),
    /// <p>Details about the orchestration step, in which the agent determines the order in which actions are executed and which knowledge bases are retrieved.</p>
    OrchestrationTrace(crate::types::OrchestrationTrace),
    /// <p>Details about the post-processing step, in which the agent shapes the response..</p>
    PostProcessingTrace(crate::types::PostProcessingTrace),
    /// <p>Details about the pre-processing step, in which the agent contextualizes and categorizes user inputs.</p>
    PreProcessingTrace(crate::types::PreProcessingTrace),
    /// <p>A routing classifier's trace.</p>
    RoutingClassifierTrace(crate::types::RoutingClassifierTrace),
    /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
    /// An unknown enum variant
    ///
    /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._
    /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized
    /// by the client. This can happen when the server adds new functionality, but the client has not been updated.
    /// To investigate this, consider turning on debug logging to print the raw HTTP response.
    #[non_exhaustive]
    Unknown,
}
impl Trace {
    /// Tries to convert the enum instance into [`CustomOrchestrationTrace`](crate::types::Trace::CustomOrchestrationTrace), extracting the inner [`CustomOrchestrationTrace`](crate::types::CustomOrchestrationTrace).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_custom_orchestration_trace(&self) -> ::std::result::Result<&crate::types::CustomOrchestrationTrace, &Self> {
        if let Trace::CustomOrchestrationTrace(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`CustomOrchestrationTrace`](crate::types::Trace::CustomOrchestrationTrace).
    pub fn is_custom_orchestration_trace(&self) -> bool {
        self.as_custom_orchestration_trace().is_ok()
    }
    /// Tries to convert the enum instance into [`FailureTrace`](crate::types::Trace::FailureTrace), extracting the inner [`FailureTrace`](crate::types::FailureTrace).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_failure_trace(&self) -> ::std::result::Result<&crate::types::FailureTrace, &Self> {
        if let Trace::FailureTrace(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`FailureTrace`](crate::types::Trace::FailureTrace).
    pub fn is_failure_trace(&self) -> bool {
        self.as_failure_trace().is_ok()
    }
    /// Tries to convert the enum instance into [`GuardrailTrace`](crate::types::Trace::GuardrailTrace), extracting the inner [`GuardrailTrace`](crate::types::GuardrailTrace).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_guardrail_trace(&self) -> ::std::result::Result<&crate::types::GuardrailTrace, &Self> {
        if let Trace::GuardrailTrace(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`GuardrailTrace`](crate::types::Trace::GuardrailTrace).
    pub fn is_guardrail_trace(&self) -> bool {
        self.as_guardrail_trace().is_ok()
    }
    /// Tries to convert the enum instance into [`OrchestrationTrace`](crate::types::Trace::OrchestrationTrace), extracting the inner [`OrchestrationTrace`](crate::types::OrchestrationTrace).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_orchestration_trace(&self) -> ::std::result::Result<&crate::types::OrchestrationTrace, &Self> {
        if let Trace::OrchestrationTrace(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`OrchestrationTrace`](crate::types::Trace::OrchestrationTrace).
    pub fn is_orchestration_trace(&self) -> bool {
        self.as_orchestration_trace().is_ok()
    }
    /// Tries to convert the enum instance into [`PostProcessingTrace`](crate::types::Trace::PostProcessingTrace), extracting the inner [`PostProcessingTrace`](crate::types::PostProcessingTrace).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_post_processing_trace(&self) -> ::std::result::Result<&crate::types::PostProcessingTrace, &Self> {
        if let Trace::PostProcessingTrace(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`PostProcessingTrace`](crate::types::Trace::PostProcessingTrace).
    pub fn is_post_processing_trace(&self) -> bool {
        self.as_post_processing_trace().is_ok()
    }
    /// Tries to convert the enum instance into [`PreProcessingTrace`](crate::types::Trace::PreProcessingTrace), extracting the inner [`PreProcessingTrace`](crate::types::PreProcessingTrace).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_pre_processing_trace(&self) -> ::std::result::Result<&crate::types::PreProcessingTrace, &Self> {
        if let Trace::PreProcessingTrace(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`PreProcessingTrace`](crate::types::Trace::PreProcessingTrace).
    pub fn is_pre_processing_trace(&self) -> bool {
        self.as_pre_processing_trace().is_ok()
    }
    /// Tries to convert the enum instance into [`RoutingClassifierTrace`](crate::types::Trace::RoutingClassifierTrace), extracting the inner [`RoutingClassifierTrace`](crate::types::RoutingClassifierTrace).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_routing_classifier_trace(&self) -> ::std::result::Result<&crate::types::RoutingClassifierTrace, &Self> {
        if let Trace::RoutingClassifierTrace(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`RoutingClassifierTrace`](crate::types::Trace::RoutingClassifierTrace).
    pub fn is_routing_classifier_trace(&self) -> bool {
        self.as_routing_classifier_trace().is_ok()
    }
    /// Returns true if the enum instance is the `Unknown` variant.
    pub fn is_unknown(&self) -> bool {
        matches!(self, Self::Unknown)
    }
}
impl ::std::fmt::Debug for Trace {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        ::std::write!(f, "*** Sensitive Data Redacted ***")
    }
}