aws_sdk_bedrockruntime/operation/converse/_converse_input.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
5pub struct ConverseInput {
6 /// <p>Specifies the model or throughput with which to run inference, or the prompt resource to use in inference. The value depends on the resource that you use:</p>
7 /// <ul>
8 /// <li>
9 /// <p>If you use a base model, specify the model ID or its ARN. For a list of model IDs for base models, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns">Amazon Bedrock base model IDs (on-demand throughput)</a> in the Amazon Bedrock User Guide.</p></li>
10 /// <li>
11 /// <p>If you use an inference profile, specify the inference profile ID or its ARN. For a list of inference profile IDs, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference-support.html">Supported Regions and models for cross-region inference</a> in the Amazon Bedrock User Guide.</p></li>
12 /// <li>
13 /// <p>If you use a provisioned model, specify the ARN of the Provisioned Throughput. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prov-thru-use.html">Run inference using a Provisioned Throughput</a> in the Amazon Bedrock User Guide.</p></li>
14 /// <li>
15 /// <p>If you use a custom model, first purchase Provisioned Throughput for it. Then specify the ARN of the resulting provisioned model. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-use.html">Use a custom model in Amazon Bedrock</a> in the Amazon Bedrock User Guide.</p></li>
16 /// <li>
17 /// <p>To include a prompt that was defined in <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management.html">Prompt management</a>, specify the ARN of the prompt version to use.</p></li>
18 /// </ul>
19 /// <p>The Converse API doesn't support <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-import-model.html">imported models</a>.</p>
20 pub model_id: ::std::option::Option<::std::string::String>,
21 /// <p>The messages that you want to send to the model.</p>
22 pub messages: ::std::option::Option<::std::vec::Vec<crate::types::Message>>,
23 /// <p>A prompt that provides instructions or context to the model about the task it should perform, or the persona it should adopt during the conversation.</p>
24 pub system: ::std::option::Option<::std::vec::Vec<crate::types::SystemContentBlock>>,
25 /// <p>Inference parameters to pass to the model. <code>Converse</code> and <code>ConverseStream</code> support a base set of inference parameters. If you need to pass additional parameters that the model supports, use the <code>additionalModelRequestFields</code> request field.</p>
26 pub inference_config: ::std::option::Option<crate::types::InferenceConfiguration>,
27 /// <p>Configuration information for the tools that the model can use when generating a response.</p>
28 /// <p>For information about models that support tool use, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html#conversation-inference-supported-models-features">Supported models and model features</a>.</p>
29 pub tool_config: ::std::option::Option<crate::types::ToolConfiguration>,
30 /// <p>Configuration information for a guardrail that you want to use in the request. If you include <code>guardContent</code> blocks in the <code>content</code> field in the <code>messages</code> field, the guardrail operates only on those messages. If you include no <code>guardContent</code> blocks, the guardrail operates on all messages in the request body and in any included prompt resource.</p>
31 pub guardrail_config: ::std::option::Option<crate::types::GuardrailConfiguration>,
32 /// <p>Additional inference parameters that the model supports, beyond the base set of inference parameters that <code>Converse</code> and <code>ConverseStream</code> support in the <code>inferenceConfig</code> field. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Model parameters</a>.</p>
33 pub additional_model_request_fields: ::std::option::Option<::aws_smithy_types::Document>,
34 /// <p>Contains a map of variables in a prompt from Prompt management to objects containing the values to fill in for them when running model invocation. This field is ignored if you don't specify a prompt resource in the <code>modelId</code> field.</p>
35 pub prompt_variables: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::PromptVariableValues>>,
36 /// <p>Additional model parameters field paths to return in the response. <code>Converse</code> and <code>ConverseStream</code> return the requested fields as a JSON Pointer object in the <code>additionalModelResponseFields</code> field. The following is example JSON for <code>additionalModelResponseFieldPaths</code>.</p>
37 /// <p><code>\[ "/stop_sequence" \]</code></p>
38 /// <p>For information about the JSON Pointer syntax, see the <a href="https://datatracker.ietf.org/doc/html/rfc6901">Internet Engineering Task Force (IETF)</a> documentation.</p>
39 /// <p><code>Converse</code> and <code>ConverseStream</code> reject an empty JSON Pointer or incorrectly structured JSON Pointer with a <code>400</code> error code. if the JSON Pointer is valid, but the requested field is not in the model response, it is ignored by <code>Converse</code>.</p>
40 pub additional_model_response_field_paths: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
41 /// <p>Key-value pairs that you can use to filter invocation logs.</p>
42 pub request_metadata: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
43 /// <p>Model performance settings for the request.</p>
44 pub performance_config: ::std::option::Option<crate::types::PerformanceConfiguration>,
45}
46impl ConverseInput {
47 /// <p>Specifies the model or throughput with which to run inference, or the prompt resource to use in inference. The value depends on the resource that you use:</p>
48 /// <ul>
49 /// <li>
50 /// <p>If you use a base model, specify the model ID or its ARN. For a list of model IDs for base models, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns">Amazon Bedrock base model IDs (on-demand throughput)</a> in the Amazon Bedrock User Guide.</p></li>
51 /// <li>
52 /// <p>If you use an inference profile, specify the inference profile ID or its ARN. For a list of inference profile IDs, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference-support.html">Supported Regions and models for cross-region inference</a> in the Amazon Bedrock User Guide.</p></li>
53 /// <li>
54 /// <p>If you use a provisioned model, specify the ARN of the Provisioned Throughput. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prov-thru-use.html">Run inference using a Provisioned Throughput</a> in the Amazon Bedrock User Guide.</p></li>
55 /// <li>
56 /// <p>If you use a custom model, first purchase Provisioned Throughput for it. Then specify the ARN of the resulting provisioned model. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-use.html">Use a custom model in Amazon Bedrock</a> in the Amazon Bedrock User Guide.</p></li>
57 /// <li>
58 /// <p>To include a prompt that was defined in <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management.html">Prompt management</a>, specify the ARN of the prompt version to use.</p></li>
59 /// </ul>
60 /// <p>The Converse API doesn't support <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-import-model.html">imported models</a>.</p>
61 pub fn model_id(&self) -> ::std::option::Option<&str> {
62 self.model_id.as_deref()
63 }
64 /// <p>The messages that you want to send to the model.</p>
65 ///
66 /// 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()`.
67 pub fn messages(&self) -> &[crate::types::Message] {
68 self.messages.as_deref().unwrap_or_default()
69 }
70 /// <p>A prompt that provides instructions or context to the model about the task it should perform, or the persona it should adopt during the conversation.</p>
71 ///
72 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.system.is_none()`.
73 pub fn system(&self) -> &[crate::types::SystemContentBlock] {
74 self.system.as_deref().unwrap_or_default()
75 }
76 /// <p>Inference parameters to pass to the model. <code>Converse</code> and <code>ConverseStream</code> support a base set of inference parameters. If you need to pass additional parameters that the model supports, use the <code>additionalModelRequestFields</code> request field.</p>
77 pub fn inference_config(&self) -> ::std::option::Option<&crate::types::InferenceConfiguration> {
78 self.inference_config.as_ref()
79 }
80 /// <p>Configuration information for the tools that the model can use when generating a response.</p>
81 /// <p>For information about models that support tool use, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html#conversation-inference-supported-models-features">Supported models and model features</a>.</p>
82 pub fn tool_config(&self) -> ::std::option::Option<&crate::types::ToolConfiguration> {
83 self.tool_config.as_ref()
84 }
85 /// <p>Configuration information for a guardrail that you want to use in the request. If you include <code>guardContent</code> blocks in the <code>content</code> field in the <code>messages</code> field, the guardrail operates only on those messages. If you include no <code>guardContent</code> blocks, the guardrail operates on all messages in the request body and in any included prompt resource.</p>
86 pub fn guardrail_config(&self) -> ::std::option::Option<&crate::types::GuardrailConfiguration> {
87 self.guardrail_config.as_ref()
88 }
89 /// <p>Additional inference parameters that the model supports, beyond the base set of inference parameters that <code>Converse</code> and <code>ConverseStream</code> support in the <code>inferenceConfig</code> field. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Model parameters</a>.</p>
90 pub fn additional_model_request_fields(&self) -> ::std::option::Option<&::aws_smithy_types::Document> {
91 self.additional_model_request_fields.as_ref()
92 }
93 /// <p>Contains a map of variables in a prompt from Prompt management to objects containing the values to fill in for them when running model invocation. This field is ignored if you don't specify a prompt resource in the <code>modelId</code> field.</p>
94 pub fn prompt_variables(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::PromptVariableValues>> {
95 self.prompt_variables.as_ref()
96 }
97 /// <p>Additional model parameters field paths to return in the response. <code>Converse</code> and <code>ConverseStream</code> return the requested fields as a JSON Pointer object in the <code>additionalModelResponseFields</code> field. The following is example JSON for <code>additionalModelResponseFieldPaths</code>.</p>
98 /// <p><code>\[ "/stop_sequence" \]</code></p>
99 /// <p>For information about the JSON Pointer syntax, see the <a href="https://datatracker.ietf.org/doc/html/rfc6901">Internet Engineering Task Force (IETF)</a> documentation.</p>
100 /// <p><code>Converse</code> and <code>ConverseStream</code> reject an empty JSON Pointer or incorrectly structured JSON Pointer with a <code>400</code> error code. if the JSON Pointer is valid, but the requested field is not in the model response, it is ignored by <code>Converse</code>.</p>
101 ///
102 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.additional_model_response_field_paths.is_none()`.
103 pub fn additional_model_response_field_paths(&self) -> &[::std::string::String] {
104 self.additional_model_response_field_paths.as_deref().unwrap_or_default()
105 }
106 /// <p>Key-value pairs that you can use to filter invocation logs.</p>
107 pub fn request_metadata(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
108 self.request_metadata.as_ref()
109 }
110 /// <p>Model performance settings for the request.</p>
111 pub fn performance_config(&self) -> ::std::option::Option<&crate::types::PerformanceConfiguration> {
112 self.performance_config.as_ref()
113 }
114}
115impl ::std::fmt::Debug for ConverseInput {
116 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
117 let mut formatter = f.debug_struct("ConverseInput");
118 formatter.field("model_id", &self.model_id);
119 formatter.field("messages", &self.messages);
120 formatter.field("system", &self.system);
121 formatter.field("inference_config", &self.inference_config);
122 formatter.field("tool_config", &self.tool_config);
123 formatter.field("guardrail_config", &self.guardrail_config);
124 formatter.field("additional_model_request_fields", &self.additional_model_request_fields);
125 formatter.field("prompt_variables", &"*** Sensitive Data Redacted ***");
126 formatter.field("additional_model_response_field_paths", &self.additional_model_response_field_paths);
127 formatter.field("request_metadata", &"*** Sensitive Data Redacted ***");
128 formatter.field("performance_config", &self.performance_config);
129 formatter.finish()
130 }
131}
132impl ConverseInput {
133 /// Creates a new builder-style object to manufacture [`ConverseInput`](crate::operation::converse::ConverseInput).
134 pub fn builder() -> crate::operation::converse::builders::ConverseInputBuilder {
135 crate::operation::converse::builders::ConverseInputBuilder::default()
136 }
137}
138
139/// A builder for [`ConverseInput`](crate::operation::converse::ConverseInput).
140#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
141#[non_exhaustive]
142pub struct ConverseInputBuilder {
143 pub(crate) model_id: ::std::option::Option<::std::string::String>,
144 pub(crate) messages: ::std::option::Option<::std::vec::Vec<crate::types::Message>>,
145 pub(crate) system: ::std::option::Option<::std::vec::Vec<crate::types::SystemContentBlock>>,
146 pub(crate) inference_config: ::std::option::Option<crate::types::InferenceConfiguration>,
147 pub(crate) tool_config: ::std::option::Option<crate::types::ToolConfiguration>,
148 pub(crate) guardrail_config: ::std::option::Option<crate::types::GuardrailConfiguration>,
149 pub(crate) additional_model_request_fields: ::std::option::Option<::aws_smithy_types::Document>,
150 pub(crate) prompt_variables: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::PromptVariableValues>>,
151 pub(crate) additional_model_response_field_paths: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
152 pub(crate) request_metadata: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
153 pub(crate) performance_config: ::std::option::Option<crate::types::PerformanceConfiguration>,
154}
155impl ConverseInputBuilder {
156 /// <p>Specifies the model or throughput with which to run inference, or the prompt resource to use in inference. The value depends on the resource that you use:</p>
157 /// <ul>
158 /// <li>
159 /// <p>If you use a base model, specify the model ID or its ARN. For a list of model IDs for base models, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns">Amazon Bedrock base model IDs (on-demand throughput)</a> in the Amazon Bedrock User Guide.</p></li>
160 /// <li>
161 /// <p>If you use an inference profile, specify the inference profile ID or its ARN. For a list of inference profile IDs, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference-support.html">Supported Regions and models for cross-region inference</a> in the Amazon Bedrock User Guide.</p></li>
162 /// <li>
163 /// <p>If you use a provisioned model, specify the ARN of the Provisioned Throughput. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prov-thru-use.html">Run inference using a Provisioned Throughput</a> in the Amazon Bedrock User Guide.</p></li>
164 /// <li>
165 /// <p>If you use a custom model, first purchase Provisioned Throughput for it. Then specify the ARN of the resulting provisioned model. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-use.html">Use a custom model in Amazon Bedrock</a> in the Amazon Bedrock User Guide.</p></li>
166 /// <li>
167 /// <p>To include a prompt that was defined in <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management.html">Prompt management</a>, specify the ARN of the prompt version to use.</p></li>
168 /// </ul>
169 /// <p>The Converse API doesn't support <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-import-model.html">imported models</a>.</p>
170 /// This field is required.
171 pub fn model_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
172 self.model_id = ::std::option::Option::Some(input.into());
173 self
174 }
175 /// <p>Specifies the model or throughput with which to run inference, or the prompt resource to use in inference. The value depends on the resource that you use:</p>
176 /// <ul>
177 /// <li>
178 /// <p>If you use a base model, specify the model ID or its ARN. For a list of model IDs for base models, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns">Amazon Bedrock base model IDs (on-demand throughput)</a> in the Amazon Bedrock User Guide.</p></li>
179 /// <li>
180 /// <p>If you use an inference profile, specify the inference profile ID or its ARN. For a list of inference profile IDs, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference-support.html">Supported Regions and models for cross-region inference</a> in the Amazon Bedrock User Guide.</p></li>
181 /// <li>
182 /// <p>If you use a provisioned model, specify the ARN of the Provisioned Throughput. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prov-thru-use.html">Run inference using a Provisioned Throughput</a> in the Amazon Bedrock User Guide.</p></li>
183 /// <li>
184 /// <p>If you use a custom model, first purchase Provisioned Throughput for it. Then specify the ARN of the resulting provisioned model. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-use.html">Use a custom model in Amazon Bedrock</a> in the Amazon Bedrock User Guide.</p></li>
185 /// <li>
186 /// <p>To include a prompt that was defined in <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management.html">Prompt management</a>, specify the ARN of the prompt version to use.</p></li>
187 /// </ul>
188 /// <p>The Converse API doesn't support <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-import-model.html">imported models</a>.</p>
189 pub fn set_model_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
190 self.model_id = input;
191 self
192 }
193 /// <p>Specifies the model or throughput with which to run inference, or the prompt resource to use in inference. The value depends on the resource that you use:</p>
194 /// <ul>
195 /// <li>
196 /// <p>If you use a base model, specify the model ID or its ARN. For a list of model IDs for base models, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html#model-ids-arns">Amazon Bedrock base model IDs (on-demand throughput)</a> in the Amazon Bedrock User Guide.</p></li>
197 /// <li>
198 /// <p>If you use an inference profile, specify the inference profile ID or its ARN. For a list of inference profile IDs, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference-support.html">Supported Regions and models for cross-region inference</a> in the Amazon Bedrock User Guide.</p></li>
199 /// <li>
200 /// <p>If you use a provisioned model, specify the ARN of the Provisioned Throughput. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prov-thru-use.html">Run inference using a Provisioned Throughput</a> in the Amazon Bedrock User Guide.</p></li>
201 /// <li>
202 /// <p>If you use a custom model, first purchase Provisioned Throughput for it. Then specify the ARN of the resulting provisioned model. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-use.html">Use a custom model in Amazon Bedrock</a> in the Amazon Bedrock User Guide.</p></li>
203 /// <li>
204 /// <p>To include a prompt that was defined in <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management.html">Prompt management</a>, specify the ARN of the prompt version to use.</p></li>
205 /// </ul>
206 /// <p>The Converse API doesn't support <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-customization-import-model.html">imported models</a>.</p>
207 pub fn get_model_id(&self) -> &::std::option::Option<::std::string::String> {
208 &self.model_id
209 }
210 /// Appends an item to `messages`.
211 ///
212 /// To override the contents of this collection use [`set_messages`](Self::set_messages).
213 ///
214 /// <p>The messages that you want to send to the model.</p>
215 pub fn messages(mut self, input: crate::types::Message) -> Self {
216 let mut v = self.messages.unwrap_or_default();
217 v.push(input);
218 self.messages = ::std::option::Option::Some(v);
219 self
220 }
221 /// <p>The messages that you want to send to the model.</p>
222 pub fn set_messages(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Message>>) -> Self {
223 self.messages = input;
224 self
225 }
226 /// <p>The messages that you want to send to the model.</p>
227 pub fn get_messages(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Message>> {
228 &self.messages
229 }
230 /// Appends an item to `system`.
231 ///
232 /// To override the contents of this collection use [`set_system`](Self::set_system).
233 ///
234 /// <p>A prompt that provides instructions or context to the model about the task it should perform, or the persona it should adopt during the conversation.</p>
235 pub fn system(mut self, input: crate::types::SystemContentBlock) -> Self {
236 let mut v = self.system.unwrap_or_default();
237 v.push(input);
238 self.system = ::std::option::Option::Some(v);
239 self
240 }
241 /// <p>A prompt that provides instructions or context to the model about the task it should perform, or the persona it should adopt during the conversation.</p>
242 pub fn set_system(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SystemContentBlock>>) -> Self {
243 self.system = input;
244 self
245 }
246 /// <p>A prompt that provides instructions or context to the model about the task it should perform, or the persona it should adopt during the conversation.</p>
247 pub fn get_system(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SystemContentBlock>> {
248 &self.system
249 }
250 /// <p>Inference parameters to pass to the model. <code>Converse</code> and <code>ConverseStream</code> support a base set of inference parameters. If you need to pass additional parameters that the model supports, use the <code>additionalModelRequestFields</code> request field.</p>
251 pub fn inference_config(mut self, input: crate::types::InferenceConfiguration) -> Self {
252 self.inference_config = ::std::option::Option::Some(input);
253 self
254 }
255 /// <p>Inference parameters to pass to the model. <code>Converse</code> and <code>ConverseStream</code> support a base set of inference parameters. If you need to pass additional parameters that the model supports, use the <code>additionalModelRequestFields</code> request field.</p>
256 pub fn set_inference_config(mut self, input: ::std::option::Option<crate::types::InferenceConfiguration>) -> Self {
257 self.inference_config = input;
258 self
259 }
260 /// <p>Inference parameters to pass to the model. <code>Converse</code> and <code>ConverseStream</code> support a base set of inference parameters. If you need to pass additional parameters that the model supports, use the <code>additionalModelRequestFields</code> request field.</p>
261 pub fn get_inference_config(&self) -> &::std::option::Option<crate::types::InferenceConfiguration> {
262 &self.inference_config
263 }
264 /// <p>Configuration information for the tools that the model can use when generating a response.</p>
265 /// <p>For information about models that support tool use, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html#conversation-inference-supported-models-features">Supported models and model features</a>.</p>
266 pub fn tool_config(mut self, input: crate::types::ToolConfiguration) -> Self {
267 self.tool_config = ::std::option::Option::Some(input);
268 self
269 }
270 /// <p>Configuration information for the tools that the model can use when generating a response.</p>
271 /// <p>For information about models that support tool use, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html#conversation-inference-supported-models-features">Supported models and model features</a>.</p>
272 pub fn set_tool_config(mut self, input: ::std::option::Option<crate::types::ToolConfiguration>) -> Self {
273 self.tool_config = input;
274 self
275 }
276 /// <p>Configuration information for the tools that the model can use when generating a response.</p>
277 /// <p>For information about models that support tool use, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html#conversation-inference-supported-models-features">Supported models and model features</a>.</p>
278 pub fn get_tool_config(&self) -> &::std::option::Option<crate::types::ToolConfiguration> {
279 &self.tool_config
280 }
281 /// <p>Configuration information for a guardrail that you want to use in the request. If you include <code>guardContent</code> blocks in the <code>content</code> field in the <code>messages</code> field, the guardrail operates only on those messages. If you include no <code>guardContent</code> blocks, the guardrail operates on all messages in the request body and in any included prompt resource.</p>
282 pub fn guardrail_config(mut self, input: crate::types::GuardrailConfiguration) -> Self {
283 self.guardrail_config = ::std::option::Option::Some(input);
284 self
285 }
286 /// <p>Configuration information for a guardrail that you want to use in the request. If you include <code>guardContent</code> blocks in the <code>content</code> field in the <code>messages</code> field, the guardrail operates only on those messages. If you include no <code>guardContent</code> blocks, the guardrail operates on all messages in the request body and in any included prompt resource.</p>
287 pub fn set_guardrail_config(mut self, input: ::std::option::Option<crate::types::GuardrailConfiguration>) -> Self {
288 self.guardrail_config = input;
289 self
290 }
291 /// <p>Configuration information for a guardrail that you want to use in the request. If you include <code>guardContent</code> blocks in the <code>content</code> field in the <code>messages</code> field, the guardrail operates only on those messages. If you include no <code>guardContent</code> blocks, the guardrail operates on all messages in the request body and in any included prompt resource.</p>
292 pub fn get_guardrail_config(&self) -> &::std::option::Option<crate::types::GuardrailConfiguration> {
293 &self.guardrail_config
294 }
295 /// <p>Additional inference parameters that the model supports, beyond the base set of inference parameters that <code>Converse</code> and <code>ConverseStream</code> support in the <code>inferenceConfig</code> field. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Model parameters</a>.</p>
296 pub fn additional_model_request_fields(mut self, input: ::aws_smithy_types::Document) -> Self {
297 self.additional_model_request_fields = ::std::option::Option::Some(input);
298 self
299 }
300 /// <p>Additional inference parameters that the model supports, beyond the base set of inference parameters that <code>Converse</code> and <code>ConverseStream</code> support in the <code>inferenceConfig</code> field. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Model parameters</a>.</p>
301 pub fn set_additional_model_request_fields(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self {
302 self.additional_model_request_fields = input;
303 self
304 }
305 /// <p>Additional inference parameters that the model supports, beyond the base set of inference parameters that <code>Converse</code> and <code>ConverseStream</code> support in the <code>inferenceConfig</code> field. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Model parameters</a>.</p>
306 pub fn get_additional_model_request_fields(&self) -> &::std::option::Option<::aws_smithy_types::Document> {
307 &self.additional_model_request_fields
308 }
309 /// Adds a key-value pair to `prompt_variables`.
310 ///
311 /// To override the contents of this collection use [`set_prompt_variables`](Self::set_prompt_variables).
312 ///
313 /// <p>Contains a map of variables in a prompt from Prompt management to objects containing the values to fill in for them when running model invocation. This field is ignored if you don't specify a prompt resource in the <code>modelId</code> field.</p>
314 pub fn prompt_variables(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::PromptVariableValues) -> Self {
315 let mut hash_map = self.prompt_variables.unwrap_or_default();
316 hash_map.insert(k.into(), v);
317 self.prompt_variables = ::std::option::Option::Some(hash_map);
318 self
319 }
320 /// <p>Contains a map of variables in a prompt from Prompt management to objects containing the values to fill in for them when running model invocation. This field is ignored if you don't specify a prompt resource in the <code>modelId</code> field.</p>
321 pub fn set_prompt_variables(
322 mut self,
323 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::PromptVariableValues>>,
324 ) -> Self {
325 self.prompt_variables = input;
326 self
327 }
328 /// <p>Contains a map of variables in a prompt from Prompt management to objects containing the values to fill in for them when running model invocation. This field is ignored if you don't specify a prompt resource in the <code>modelId</code> field.</p>
329 pub fn get_prompt_variables(
330 &self,
331 ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::PromptVariableValues>> {
332 &self.prompt_variables
333 }
334 /// Appends an item to `additional_model_response_field_paths`.
335 ///
336 /// To override the contents of this collection use [`set_additional_model_response_field_paths`](Self::set_additional_model_response_field_paths).
337 ///
338 /// <p>Additional model parameters field paths to return in the response. <code>Converse</code> and <code>ConverseStream</code> return the requested fields as a JSON Pointer object in the <code>additionalModelResponseFields</code> field. The following is example JSON for <code>additionalModelResponseFieldPaths</code>.</p>
339 /// <p><code>\[ "/stop_sequence" \]</code></p>
340 /// <p>For information about the JSON Pointer syntax, see the <a href="https://datatracker.ietf.org/doc/html/rfc6901">Internet Engineering Task Force (IETF)</a> documentation.</p>
341 /// <p><code>Converse</code> and <code>ConverseStream</code> reject an empty JSON Pointer or incorrectly structured JSON Pointer with a <code>400</code> error code. if the JSON Pointer is valid, but the requested field is not in the model response, it is ignored by <code>Converse</code>.</p>
342 pub fn additional_model_response_field_paths(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
343 let mut v = self.additional_model_response_field_paths.unwrap_or_default();
344 v.push(input.into());
345 self.additional_model_response_field_paths = ::std::option::Option::Some(v);
346 self
347 }
348 /// <p>Additional model parameters field paths to return in the response. <code>Converse</code> and <code>ConverseStream</code> return the requested fields as a JSON Pointer object in the <code>additionalModelResponseFields</code> field. The following is example JSON for <code>additionalModelResponseFieldPaths</code>.</p>
349 /// <p><code>\[ "/stop_sequence" \]</code></p>
350 /// <p>For information about the JSON Pointer syntax, see the <a href="https://datatracker.ietf.org/doc/html/rfc6901">Internet Engineering Task Force (IETF)</a> documentation.</p>
351 /// <p><code>Converse</code> and <code>ConverseStream</code> reject an empty JSON Pointer or incorrectly structured JSON Pointer with a <code>400</code> error code. if the JSON Pointer is valid, but the requested field is not in the model response, it is ignored by <code>Converse</code>.</p>
352 pub fn set_additional_model_response_field_paths(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
353 self.additional_model_response_field_paths = input;
354 self
355 }
356 /// <p>Additional model parameters field paths to return in the response. <code>Converse</code> and <code>ConverseStream</code> return the requested fields as a JSON Pointer object in the <code>additionalModelResponseFields</code> field. The following is example JSON for <code>additionalModelResponseFieldPaths</code>.</p>
357 /// <p><code>\[ "/stop_sequence" \]</code></p>
358 /// <p>For information about the JSON Pointer syntax, see the <a href="https://datatracker.ietf.org/doc/html/rfc6901">Internet Engineering Task Force (IETF)</a> documentation.</p>
359 /// <p><code>Converse</code> and <code>ConverseStream</code> reject an empty JSON Pointer or incorrectly structured JSON Pointer with a <code>400</code> error code. if the JSON Pointer is valid, but the requested field is not in the model response, it is ignored by <code>Converse</code>.</p>
360 pub fn get_additional_model_response_field_paths(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
361 &self.additional_model_response_field_paths
362 }
363 /// Adds a key-value pair to `request_metadata`.
364 ///
365 /// To override the contents of this collection use [`set_request_metadata`](Self::set_request_metadata).
366 ///
367 /// <p>Key-value pairs that you can use to filter invocation logs.</p>
368 pub fn request_metadata(
369 mut self,
370 k: impl ::std::convert::Into<::std::string::String>,
371 v: impl ::std::convert::Into<::std::string::String>,
372 ) -> Self {
373 let mut hash_map = self.request_metadata.unwrap_or_default();
374 hash_map.insert(k.into(), v.into());
375 self.request_metadata = ::std::option::Option::Some(hash_map);
376 self
377 }
378 /// <p>Key-value pairs that you can use to filter invocation logs.</p>
379 pub fn set_request_metadata(
380 mut self,
381 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
382 ) -> Self {
383 self.request_metadata = input;
384 self
385 }
386 /// <p>Key-value pairs that you can use to filter invocation logs.</p>
387 pub fn get_request_metadata(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
388 &self.request_metadata
389 }
390 /// <p>Model performance settings for the request.</p>
391 pub fn performance_config(mut self, input: crate::types::PerformanceConfiguration) -> Self {
392 self.performance_config = ::std::option::Option::Some(input);
393 self
394 }
395 /// <p>Model performance settings for the request.</p>
396 pub fn set_performance_config(mut self, input: ::std::option::Option<crate::types::PerformanceConfiguration>) -> Self {
397 self.performance_config = input;
398 self
399 }
400 /// <p>Model performance settings for the request.</p>
401 pub fn get_performance_config(&self) -> &::std::option::Option<crate::types::PerformanceConfiguration> {
402 &self.performance_config
403 }
404 /// Consumes the builder and constructs a [`ConverseInput`](crate::operation::converse::ConverseInput).
405 pub fn build(self) -> ::std::result::Result<crate::operation::converse::ConverseInput, ::aws_smithy_types::error::operation::BuildError> {
406 ::std::result::Result::Ok(crate::operation::converse::ConverseInput {
407 model_id: self.model_id,
408 messages: self.messages,
409 system: self.system,
410 inference_config: self.inference_config,
411 tool_config: self.tool_config,
412 guardrail_config: self.guardrail_config,
413 additional_model_request_fields: self.additional_model_request_fields,
414 prompt_variables: self.prompt_variables,
415 additional_model_response_field_paths: self.additional_model_response_field_paths,
416 request_metadata: self.request_metadata,
417 performance_config: self.performance_config,
418 })
419 }
420}
421impl ::std::fmt::Debug for ConverseInputBuilder {
422 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
423 let mut formatter = f.debug_struct("ConverseInputBuilder");
424 formatter.field("model_id", &self.model_id);
425 formatter.field("messages", &self.messages);
426 formatter.field("system", &self.system);
427 formatter.field("inference_config", &self.inference_config);
428 formatter.field("tool_config", &self.tool_config);
429 formatter.field("guardrail_config", &self.guardrail_config);
430 formatter.field("additional_model_request_fields", &self.additional_model_request_fields);
431 formatter.field("prompt_variables", &"*** Sensitive Data Redacted ***");
432 formatter.field("additional_model_response_field_paths", &self.additional_model_response_field_paths);
433 formatter.field("request_metadata", &"*** Sensitive Data Redacted ***");
434 formatter.field("performance_config", &self.performance_config);
435 formatter.finish()
436 }
437}