Skip to main content

aws_sdk_bedrockagent/types/
_prompt_variant.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Contains details about a variant of the prompt.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
6pub struct PromptVariant {
7    /// <p>The name of the prompt variant.</p>
8    pub name: ::std::string::String,
9    /// <p>The type of prompt template to use.</p>
10    pub template_type: crate::types::PromptTemplateType,
11    /// <p>Contains configurations for the prompt template.</p>
12    pub template_configuration: ::std::option::Option<crate::types::PromptTemplateConfiguration>,
13    /// <p>The unique identifier of the model or <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html">inference profile</a> with which to run inference on the prompt.</p>
14    pub model_id: ::std::option::Option<::std::string::String>,
15    /// <p>Contains inference configurations for the prompt variant.</p>
16    pub inference_configuration: ::std::option::Option<crate::types::PromptInferenceConfiguration>,
17    /// <p>An array of objects, each containing a key-value pair that defines a metadata tag and value to attach to a prompt variant.</p>
18    pub metadata: ::std::option::Option<::std::vec::Vec<crate::types::PromptMetadataEntry>>,
19    /// <p>Contains model-specific inference configurations that aren't in the <code>inferenceConfiguration</code> field. To see model-specific inference parameters, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference request parameters and response fields for foundation models</a>.</p>
20    pub additional_model_request_fields: ::std::option::Option<::aws_smithy_types::Document>,
21    /// <p>Specifies a generative AI resource with which to use the prompt.</p>
22    pub gen_ai_resource: ::std::option::Option<crate::types::PromptGenAiResource>,
23}
24impl PromptVariant {
25    /// <p>The name of the prompt variant.</p>
26    pub fn name(&self) -> &str {
27        use std::ops::Deref;
28        self.name.deref()
29    }
30    /// <p>The type of prompt template to use.</p>
31    pub fn template_type(&self) -> &crate::types::PromptTemplateType {
32        &self.template_type
33    }
34    /// <p>Contains configurations for the prompt template.</p>
35    pub fn template_configuration(&self) -> ::std::option::Option<&crate::types::PromptTemplateConfiguration> {
36        self.template_configuration.as_ref()
37    }
38    /// <p>The unique identifier of the model or <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html">inference profile</a> with which to run inference on the prompt.</p>
39    pub fn model_id(&self) -> ::std::option::Option<&str> {
40        self.model_id.as_deref()
41    }
42    /// <p>Contains inference configurations for the prompt variant.</p>
43    pub fn inference_configuration(&self) -> ::std::option::Option<&crate::types::PromptInferenceConfiguration> {
44        self.inference_configuration.as_ref()
45    }
46    /// <p>An array of objects, each containing a key-value pair that defines a metadata tag and value to attach to a prompt variant.</p>
47    ///
48    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.metadata.is_none()`.
49    pub fn metadata(&self) -> &[crate::types::PromptMetadataEntry] {
50        self.metadata.as_deref().unwrap_or_default()
51    }
52    /// <p>Contains model-specific inference configurations that aren't in the <code>inferenceConfiguration</code> field. To see model-specific inference parameters, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference request parameters and response fields for foundation models</a>.</p>
53    pub fn additional_model_request_fields(&self) -> ::std::option::Option<&::aws_smithy_types::Document> {
54        self.additional_model_request_fields.as_ref()
55    }
56    /// <p>Specifies a generative AI resource with which to use the prompt.</p>
57    pub fn gen_ai_resource(&self) -> ::std::option::Option<&crate::types::PromptGenAiResource> {
58        self.gen_ai_resource.as_ref()
59    }
60}
61impl ::std::fmt::Debug for PromptVariant {
62    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
63        let mut formatter = f.debug_struct("PromptVariant");
64        formatter.field("name", &"*** Sensitive Data Redacted ***");
65        formatter.field("template_type", &"*** Sensitive Data Redacted ***");
66        formatter.field("template_configuration", &"*** Sensitive Data Redacted ***");
67        formatter.field("model_id", &"*** Sensitive Data Redacted ***");
68        formatter.field("inference_configuration", &"*** Sensitive Data Redacted ***");
69        formatter.field("metadata", &"*** Sensitive Data Redacted ***");
70        formatter.field("additional_model_request_fields", &"*** Sensitive Data Redacted ***");
71        formatter.field("gen_ai_resource", &"*** Sensitive Data Redacted ***");
72        formatter.finish()
73    }
74}
75impl PromptVariant {
76    /// Creates a new builder-style object to manufacture [`PromptVariant`](crate::types::PromptVariant).
77    pub fn builder() -> crate::types::builders::PromptVariantBuilder {
78        crate::types::builders::PromptVariantBuilder::default()
79    }
80}
81
82/// A builder for [`PromptVariant`](crate::types::PromptVariant).
83#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
84#[non_exhaustive]
85pub struct PromptVariantBuilder {
86    pub(crate) name: ::std::option::Option<::std::string::String>,
87    pub(crate) template_type: ::std::option::Option<crate::types::PromptTemplateType>,
88    pub(crate) template_configuration: ::std::option::Option<crate::types::PromptTemplateConfiguration>,
89    pub(crate) model_id: ::std::option::Option<::std::string::String>,
90    pub(crate) inference_configuration: ::std::option::Option<crate::types::PromptInferenceConfiguration>,
91    pub(crate) metadata: ::std::option::Option<::std::vec::Vec<crate::types::PromptMetadataEntry>>,
92    pub(crate) additional_model_request_fields: ::std::option::Option<::aws_smithy_types::Document>,
93    pub(crate) gen_ai_resource: ::std::option::Option<crate::types::PromptGenAiResource>,
94}
95impl PromptVariantBuilder {
96    /// <p>The name of the prompt variant.</p>
97    /// This field is required.
98    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
99        self.name = ::std::option::Option::Some(input.into());
100        self
101    }
102    /// <p>The name of the prompt variant.</p>
103    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
104        self.name = input;
105        self
106    }
107    /// <p>The name of the prompt variant.</p>
108    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
109        &self.name
110    }
111    /// <p>The type of prompt template to use.</p>
112    /// This field is required.
113    pub fn template_type(mut self, input: crate::types::PromptTemplateType) -> Self {
114        self.template_type = ::std::option::Option::Some(input);
115        self
116    }
117    /// <p>The type of prompt template to use.</p>
118    pub fn set_template_type(mut self, input: ::std::option::Option<crate::types::PromptTemplateType>) -> Self {
119        self.template_type = input;
120        self
121    }
122    /// <p>The type of prompt template to use.</p>
123    pub fn get_template_type(&self) -> &::std::option::Option<crate::types::PromptTemplateType> {
124        &self.template_type
125    }
126    /// <p>Contains configurations for the prompt template.</p>
127    /// This field is required.
128    pub fn template_configuration(mut self, input: crate::types::PromptTemplateConfiguration) -> Self {
129        self.template_configuration = ::std::option::Option::Some(input);
130        self
131    }
132    /// <p>Contains configurations for the prompt template.</p>
133    pub fn set_template_configuration(mut self, input: ::std::option::Option<crate::types::PromptTemplateConfiguration>) -> Self {
134        self.template_configuration = input;
135        self
136    }
137    /// <p>Contains configurations for the prompt template.</p>
138    pub fn get_template_configuration(&self) -> &::std::option::Option<crate::types::PromptTemplateConfiguration> {
139        &self.template_configuration
140    }
141    /// <p>The unique identifier of the model or <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html">inference profile</a> with which to run inference on the prompt.</p>
142    pub fn model_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
143        self.model_id = ::std::option::Option::Some(input.into());
144        self
145    }
146    /// <p>The unique identifier of the model or <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html">inference profile</a> with which to run inference on the prompt.</p>
147    pub fn set_model_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
148        self.model_id = input;
149        self
150    }
151    /// <p>The unique identifier of the model or <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html">inference profile</a> with which to run inference on the prompt.</p>
152    pub fn get_model_id(&self) -> &::std::option::Option<::std::string::String> {
153        &self.model_id
154    }
155    /// <p>Contains inference configurations for the prompt variant.</p>
156    pub fn inference_configuration(mut self, input: crate::types::PromptInferenceConfiguration) -> Self {
157        self.inference_configuration = ::std::option::Option::Some(input);
158        self
159    }
160    /// <p>Contains inference configurations for the prompt variant.</p>
161    pub fn set_inference_configuration(mut self, input: ::std::option::Option<crate::types::PromptInferenceConfiguration>) -> Self {
162        self.inference_configuration = input;
163        self
164    }
165    /// <p>Contains inference configurations for the prompt variant.</p>
166    pub fn get_inference_configuration(&self) -> &::std::option::Option<crate::types::PromptInferenceConfiguration> {
167        &self.inference_configuration
168    }
169    /// Appends an item to `metadata`.
170    ///
171    /// To override the contents of this collection use [`set_metadata`](Self::set_metadata).
172    ///
173    /// <p>An array of objects, each containing a key-value pair that defines a metadata tag and value to attach to a prompt variant.</p>
174    pub fn metadata(mut self, input: crate::types::PromptMetadataEntry) -> Self {
175        let mut v = self.metadata.unwrap_or_default();
176        v.push(input);
177        self.metadata = ::std::option::Option::Some(v);
178        self
179    }
180    /// <p>An array of objects, each containing a key-value pair that defines a metadata tag and value to attach to a prompt variant.</p>
181    pub fn set_metadata(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::PromptMetadataEntry>>) -> Self {
182        self.metadata = input;
183        self
184    }
185    /// <p>An array of objects, each containing a key-value pair that defines a metadata tag and value to attach to a prompt variant.</p>
186    pub fn get_metadata(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PromptMetadataEntry>> {
187        &self.metadata
188    }
189    /// <p>Contains model-specific inference configurations that aren't in the <code>inferenceConfiguration</code> field. To see model-specific inference parameters, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference request parameters and response fields for foundation models</a>.</p>
190    pub fn additional_model_request_fields(mut self, input: ::aws_smithy_types::Document) -> Self {
191        self.additional_model_request_fields = ::std::option::Option::Some(input);
192        self
193    }
194    /// <p>Contains model-specific inference configurations that aren't in the <code>inferenceConfiguration</code> field. To see model-specific inference parameters, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference request parameters and response fields for foundation models</a>.</p>
195    pub fn set_additional_model_request_fields(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self {
196        self.additional_model_request_fields = input;
197        self
198    }
199    /// <p>Contains model-specific inference configurations that aren't in the <code>inferenceConfiguration</code> field. To see model-specific inference parameters, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference request parameters and response fields for foundation models</a>.</p>
200    pub fn get_additional_model_request_fields(&self) -> &::std::option::Option<::aws_smithy_types::Document> {
201        &self.additional_model_request_fields
202    }
203    /// <p>Specifies a generative AI resource with which to use the prompt.</p>
204    pub fn gen_ai_resource(mut self, input: crate::types::PromptGenAiResource) -> Self {
205        self.gen_ai_resource = ::std::option::Option::Some(input);
206        self
207    }
208    /// <p>Specifies a generative AI resource with which to use the prompt.</p>
209    pub fn set_gen_ai_resource(mut self, input: ::std::option::Option<crate::types::PromptGenAiResource>) -> Self {
210        self.gen_ai_resource = input;
211        self
212    }
213    /// <p>Specifies a generative AI resource with which to use the prompt.</p>
214    pub fn get_gen_ai_resource(&self) -> &::std::option::Option<crate::types::PromptGenAiResource> {
215        &self.gen_ai_resource
216    }
217    /// Consumes the builder and constructs a [`PromptVariant`](crate::types::PromptVariant).
218    /// This method will fail if any of the following fields are not set:
219    /// - [`name`](crate::types::builders::PromptVariantBuilder::name)
220    /// - [`template_type`](crate::types::builders::PromptVariantBuilder::template_type)
221    pub fn build(self) -> ::std::result::Result<crate::types::PromptVariant, ::aws_smithy_types::error::operation::BuildError> {
222        ::std::result::Result::Ok(crate::types::PromptVariant {
223            name: self.name.ok_or_else(|| {
224                ::aws_smithy_types::error::operation::BuildError::missing_field(
225                    "name",
226                    "name was not specified but it is required when building PromptVariant",
227                )
228            })?,
229            template_type: self.template_type.ok_or_else(|| {
230                ::aws_smithy_types::error::operation::BuildError::missing_field(
231                    "template_type",
232                    "template_type was not specified but it is required when building PromptVariant",
233                )
234            })?,
235            template_configuration: self.template_configuration,
236            model_id: self.model_id,
237            inference_configuration: self.inference_configuration,
238            metadata: self.metadata,
239            additional_model_request_fields: self.additional_model_request_fields,
240            gen_ai_resource: self.gen_ai_resource,
241        })
242    }
243}
244impl ::std::fmt::Debug for PromptVariantBuilder {
245    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
246        let mut formatter = f.debug_struct("PromptVariantBuilder");
247        formatter.field("name", &"*** Sensitive Data Redacted ***");
248        formatter.field("template_type", &"*** Sensitive Data Redacted ***");
249        formatter.field("template_configuration", &"*** Sensitive Data Redacted ***");
250        formatter.field("model_id", &"*** Sensitive Data Redacted ***");
251        formatter.field("inference_configuration", &"*** Sensitive Data Redacted ***");
252        formatter.field("metadata", &"*** Sensitive Data Redacted ***");
253        formatter.field("additional_model_request_fields", &"*** Sensitive Data Redacted ***");
254        formatter.field("gen_ai_resource", &"*** Sensitive Data Redacted ***");
255        formatter.finish()
256    }
257}