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 citations for a part of an agent response.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Attribution {
    /// <p>A list of citations and related information for a part of an agent response.</p>
    pub citations: ::std::option::Option<::std::vec::Vec<crate::types::Citation>>,
}
impl Attribution {
    /// <p>A list of citations and related information for a part of an agent response.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.citations.is_none()`.
    pub fn citations(&self) -> &[crate::types::Citation] {
        self.citations.as_deref().unwrap_or_default()
    }
}
impl Attribution {
    /// Creates a new builder-style object to manufacture [`Attribution`](crate::types::Attribution).
    pub fn builder() -> crate::types::builders::AttributionBuilder {
        crate::types::builders::AttributionBuilder::default()
    }
}

/// A builder for [`Attribution`](crate::types::Attribution).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct AttributionBuilder {
    pub(crate) citations: ::std::option::Option<::std::vec::Vec<crate::types::Citation>>,
}
impl AttributionBuilder {
    /// Appends an item to `citations`.
    ///
    /// To override the contents of this collection use [`set_citations`](Self::set_citations).
    ///
    /// <p>A list of citations and related information for a part of an agent response.</p>
    pub fn citations(mut self, input: crate::types::Citation) -> Self {
        let mut v = self.citations.unwrap_or_default();
        v.push(input);
        self.citations = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of citations and related information for a part of an agent response.</p>
    pub fn set_citations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Citation>>) -> Self {
        self.citations = input;
        self
    }
    /// <p>A list of citations and related information for a part of an agent response.</p>
    pub fn get_citations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Citation>> {
        &self.citations
    }
    /// Consumes the builder and constructs a [`Attribution`](crate::types::Attribution).
    pub fn build(self) -> crate::types::Attribution {
        crate::types::Attribution { citations: self.citations }
    }
}