Skip to main content

aws_sdk_context/operation/agentic_retrieve/
_agentic_retrieve_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// A question to answer against an agent context, and optional settings for how the answer is retrieved and returned.
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct AgenticRetrieveInput {
7    /// The agent context to retrieve from, by its ID or ARN.
8    pub agent_context_id: ::std::option::Option<::std::string::String>,
9    /// 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.
10    pub messages: ::std::option::Option<::std::vec::Vec<crate::types::Message>>,
11    /// 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.
12    pub session_id: ::std::option::Option<::std::string::String>,
13    /// Optional controls for post-call analysis of the retrieval: whether its trace is stored for analysis.
14    pub analysis_configuration: ::std::option::Option<crate::types::AnalysisConfiguration>,
15    /// Optional bounds and configuration for the agent loop.
16    pub retrieval_configuration: ::std::option::Option<crate::types::RetrievalConfiguration>,
17}
18impl AgenticRetrieveInput {
19    /// The agent context to retrieve from, by its ID or ARN.
20    pub fn agent_context_id(&self) -> ::std::option::Option<&str> {
21        self.agent_context_id.as_deref()
22    }
23    /// 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.
24    ///
25    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.messages.is_none()`.
26    pub fn messages(&self) -> &[crate::types::Message] {
27        self.messages.as_deref().unwrap_or_default()
28    }
29    /// 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.
30    pub fn session_id(&self) -> ::std::option::Option<&str> {
31        self.session_id.as_deref()
32    }
33    /// Optional controls for post-call analysis of the retrieval: whether its trace is stored for analysis.
34    pub fn analysis_configuration(&self) -> ::std::option::Option<&crate::types::AnalysisConfiguration> {
35        self.analysis_configuration.as_ref()
36    }
37    /// Optional bounds and configuration for the agent loop.
38    pub fn retrieval_configuration(&self) -> ::std::option::Option<&crate::types::RetrievalConfiguration> {
39        self.retrieval_configuration.as_ref()
40    }
41}
42impl AgenticRetrieveInput {
43    /// Creates a new builder-style object to manufacture [`AgenticRetrieveInput`](crate::operation::agentic_retrieve::AgenticRetrieveInput).
44    pub fn builder() -> crate::operation::agentic_retrieve::builders::AgenticRetrieveInputBuilder {
45        crate::operation::agentic_retrieve::builders::AgenticRetrieveInputBuilder::default()
46    }
47}
48
49/// A builder for [`AgenticRetrieveInput`](crate::operation::agentic_retrieve::AgenticRetrieveInput).
50#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
51#[non_exhaustive]
52pub struct AgenticRetrieveInputBuilder {
53    pub(crate) agent_context_id: ::std::option::Option<::std::string::String>,
54    pub(crate) messages: ::std::option::Option<::std::vec::Vec<crate::types::Message>>,
55    pub(crate) session_id: ::std::option::Option<::std::string::String>,
56    pub(crate) analysis_configuration: ::std::option::Option<crate::types::AnalysisConfiguration>,
57    pub(crate) retrieval_configuration: ::std::option::Option<crate::types::RetrievalConfiguration>,
58}
59impl AgenticRetrieveInputBuilder {
60    /// The agent context to retrieve from, by its ID or ARN.
61    /// This field is required.
62    pub fn agent_context_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
63        self.agent_context_id = ::std::option::Option::Some(input.into());
64        self
65    }
66    /// The agent context to retrieve from, by its ID or ARN.
67    pub fn set_agent_context_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
68        self.agent_context_id = input;
69        self
70    }
71    /// The agent context to retrieve from, by its ID or ARN.
72    pub fn get_agent_context_id(&self) -> &::std::option::Option<::std::string::String> {
73        &self.agent_context_id
74    }
75    /// Appends an item to `messages`.
76    ///
77    /// To override the contents of this collection use [`set_messages`](Self::set_messages).
78    ///
79    /// 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.
80    pub fn messages(mut self, input: crate::types::Message) -> Self {
81        let mut v = self.messages.unwrap_or_default();
82        v.push(input);
83        self.messages = ::std::option::Option::Some(v);
84        self
85    }
86    /// 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.
87    pub fn set_messages(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Message>>) -> Self {
88        self.messages = input;
89        self
90    }
91    /// 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.
92    pub fn get_messages(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Message>> {
93        &self.messages
94    }
95    /// 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.
96    pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
97        self.session_id = ::std::option::Option::Some(input.into());
98        self
99    }
100    /// 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.
101    pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
102        self.session_id = input;
103        self
104    }
105    /// 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.
106    pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
107        &self.session_id
108    }
109    /// Optional controls for post-call analysis of the retrieval: whether its trace is stored for analysis.
110    pub fn analysis_configuration(mut self, input: crate::types::AnalysisConfiguration) -> Self {
111        self.analysis_configuration = ::std::option::Option::Some(input);
112        self
113    }
114    /// Optional controls for post-call analysis of the retrieval: whether its trace is stored for analysis.
115    pub fn set_analysis_configuration(mut self, input: ::std::option::Option<crate::types::AnalysisConfiguration>) -> Self {
116        self.analysis_configuration = input;
117        self
118    }
119    /// Optional controls for post-call analysis of the retrieval: whether its trace is stored for analysis.
120    pub fn get_analysis_configuration(&self) -> &::std::option::Option<crate::types::AnalysisConfiguration> {
121        &self.analysis_configuration
122    }
123    /// Optional bounds and configuration for the agent loop.
124    pub fn retrieval_configuration(mut self, input: crate::types::RetrievalConfiguration) -> Self {
125        self.retrieval_configuration = ::std::option::Option::Some(input);
126        self
127    }
128    /// Optional bounds and configuration for the agent loop.
129    pub fn set_retrieval_configuration(mut self, input: ::std::option::Option<crate::types::RetrievalConfiguration>) -> Self {
130        self.retrieval_configuration = input;
131        self
132    }
133    /// Optional bounds and configuration for the agent loop.
134    pub fn get_retrieval_configuration(&self) -> &::std::option::Option<crate::types::RetrievalConfiguration> {
135        &self.retrieval_configuration
136    }
137    /// Consumes the builder and constructs a [`AgenticRetrieveInput`](crate::operation::agentic_retrieve::AgenticRetrieveInput).
138    pub fn build(
139        self,
140    ) -> ::std::result::Result<crate::operation::agentic_retrieve::AgenticRetrieveInput, ::aws_smithy_types::error::operation::BuildError> {
141        ::std::result::Result::Ok(crate::operation::agentic_retrieve::AgenticRetrieveInput {
142            agent_context_id: self.agent_context_id,
143            messages: self.messages,
144            session_id: self.session_id,
145            analysis_configuration: self.analysis_configuration,
146            retrieval_configuration: self.retrieval_configuration,
147        })
148    }
149}