1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct ConverseInput {
/// <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>
/// <ul>
/// <li>
/// <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>
/// <li>
/// <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>
/// <li>
/// <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>
/// <li>
/// <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>
/// <li>
/// <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>
/// </ul>
/// <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>
pub model_id: ::std::option::Option<::std::string::String>,
/// <p>The messages that you want to send to the model.</p>
pub messages: ::std::option::Option<::std::vec::Vec<crate::types::Message>>,
/// <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>
pub system: ::std::option::Option<::std::vec::Vec<crate::types::SystemContentBlock>>,
/// <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>
pub inference_config: ::std::option::Option<crate::types::InferenceConfiguration>,
/// <p>Configuration information for the tools that the model can use when generating a response.</p>
/// <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>
pub tool_config: ::std::option::Option<crate::types::ToolConfiguration>,
/// <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>
pub guardrail_config: ::std::option::Option<crate::types::GuardrailConfiguration>,
/// <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>
pub additional_model_request_fields: ::std::option::Option<::aws_smithy_types::Document>,
/// <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>
pub prompt_variables: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::PromptVariableValues>>,
/// <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>
/// <p><code>\[ "/stop_sequence" \]</code></p>
/// <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>
/// <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>
pub additional_model_response_field_paths: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
/// <p>Key-value pairs that you can use to filter invocation logs.</p>
pub request_metadata: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
/// <p>Model performance settings for the request.</p>
pub performance_config: ::std::option::Option<crate::types::PerformanceConfiguration>,
/// <p>Specifies the processing tier configuration used for serving the request.</p>
pub service_tier: ::std::option::Option<crate::types::ServiceTier>,
/// <p>Output configuration for a model response.</p>
pub output_config: ::std::option::Option<crate::types::OutputConfig>,
}
impl ConverseInput {
/// <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>
/// <ul>
/// <li>
/// <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>
/// <li>
/// <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>
/// <li>
/// <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>
/// <li>
/// <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>
/// <li>
/// <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>
/// </ul>
/// <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>
pub fn model_id(&self) -> ::std::option::Option<&str> {
self.model_id.as_deref()
}
/// <p>The messages that you want to send to the model.</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 `.messages.is_none()`.
pub fn messages(&self) -> &[crate::types::Message] {
self.messages.as_deref().unwrap_or_default()
}
/// <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>
///
/// 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()`.
pub fn system(&self) -> &[crate::types::SystemContentBlock] {
self.system.as_deref().unwrap_or_default()
}
/// <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>
pub fn inference_config(&self) -> ::std::option::Option<&crate::types::InferenceConfiguration> {
self.inference_config.as_ref()
}
/// <p>Configuration information for the tools that the model can use when generating a response.</p>
/// <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>
pub fn tool_config(&self) -> ::std::option::Option<&crate::types::ToolConfiguration> {
self.tool_config.as_ref()
}
/// <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>
pub fn guardrail_config(&self) -> ::std::option::Option<&crate::types::GuardrailConfiguration> {
self.guardrail_config.as_ref()
}
/// <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>
pub fn additional_model_request_fields(&self) -> ::std::option::Option<&::aws_smithy_types::Document> {
self.additional_model_request_fields.as_ref()
}
/// <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>
pub fn prompt_variables(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::PromptVariableValues>> {
self.prompt_variables.as_ref()
}
/// <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>
/// <p><code>\[ "/stop_sequence" \]</code></p>
/// <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>
/// <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>
///
/// 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()`.
pub fn additional_model_response_field_paths(&self) -> &[::std::string::String] {
self.additional_model_response_field_paths.as_deref().unwrap_or_default()
}
/// <p>Key-value pairs that you can use to filter invocation logs.</p>
pub fn request_metadata(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
self.request_metadata.as_ref()
}
/// <p>Model performance settings for the request.</p>
pub fn performance_config(&self) -> ::std::option::Option<&crate::types::PerformanceConfiguration> {
self.performance_config.as_ref()
}
/// <p>Specifies the processing tier configuration used for serving the request.</p>
pub fn service_tier(&self) -> ::std::option::Option<&crate::types::ServiceTier> {
self.service_tier.as_ref()
}
/// <p>Output configuration for a model response.</p>
pub fn output_config(&self) -> ::std::option::Option<&crate::types::OutputConfig> {
self.output_config.as_ref()
}
}
impl ::std::fmt::Debug for ConverseInput {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
let mut formatter = f.debug_struct("ConverseInput");
formatter.field("model_id", &self.model_id);
formatter.field("messages", &self.messages);
formatter.field("system", &self.system);
formatter.field("inference_config", &self.inference_config);
formatter.field("tool_config", &self.tool_config);
formatter.field("guardrail_config", &self.guardrail_config);
formatter.field("additional_model_request_fields", &self.additional_model_request_fields);
formatter.field("prompt_variables", &"*** Sensitive Data Redacted ***");
formatter.field("additional_model_response_field_paths", &self.additional_model_response_field_paths);
formatter.field("request_metadata", &"*** Sensitive Data Redacted ***");
formatter.field("performance_config", &self.performance_config);
formatter.field("service_tier", &self.service_tier);
formatter.field("output_config", &self.output_config);
formatter.finish()
}
}
impl ConverseInput {
/// Creates a new builder-style object to manufacture [`ConverseInput`](crate::operation::converse::ConverseInput).
pub fn builder() -> crate::operation::converse::builders::ConverseInputBuilder {
crate::operation::converse::builders::ConverseInputBuilder::default()
}
}
/// A builder for [`ConverseInput`](crate::operation::converse::ConverseInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct ConverseInputBuilder {
pub(crate) model_id: ::std::option::Option<::std::string::String>,
pub(crate) messages: ::std::option::Option<::std::vec::Vec<crate::types::Message>>,
pub(crate) system: ::std::option::Option<::std::vec::Vec<crate::types::SystemContentBlock>>,
pub(crate) inference_config: ::std::option::Option<crate::types::InferenceConfiguration>,
pub(crate) tool_config: ::std::option::Option<crate::types::ToolConfiguration>,
pub(crate) guardrail_config: ::std::option::Option<crate::types::GuardrailConfiguration>,
pub(crate) additional_model_request_fields: ::std::option::Option<::aws_smithy_types::Document>,
pub(crate) prompt_variables: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::PromptVariableValues>>,
pub(crate) additional_model_response_field_paths: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
pub(crate) request_metadata: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
pub(crate) performance_config: ::std::option::Option<crate::types::PerformanceConfiguration>,
pub(crate) service_tier: ::std::option::Option<crate::types::ServiceTier>,
pub(crate) output_config: ::std::option::Option<crate::types::OutputConfig>,
}
impl ConverseInputBuilder {
/// <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>
/// <ul>
/// <li>
/// <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>
/// <li>
/// <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>
/// <li>
/// <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>
/// <li>
/// <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>
/// <li>
/// <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>
/// </ul>
/// <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>
/// This field is required.
pub fn model_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.model_id = ::std::option::Option::Some(input.into());
self
}
/// <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>
/// <ul>
/// <li>
/// <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>
/// <li>
/// <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>
/// <li>
/// <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>
/// <li>
/// <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>
/// <li>
/// <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>
/// </ul>
/// <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>
pub fn set_model_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.model_id = input;
self
}
/// <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>
/// <ul>
/// <li>
/// <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>
/// <li>
/// <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>
/// <li>
/// <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>
/// <li>
/// <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>
/// <li>
/// <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>
/// </ul>
/// <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>
pub fn get_model_id(&self) -> &::std::option::Option<::std::string::String> {
&self.model_id
}
/// Appends an item to `messages`.
///
/// To override the contents of this collection use [`set_messages`](Self::set_messages).
///
/// <p>The messages that you want to send to the model.</p>
pub fn messages(mut self, input: crate::types::Message) -> Self {
let mut v = self.messages.unwrap_or_default();
v.push(input);
self.messages = ::std::option::Option::Some(v);
self
}
/// <p>The messages that you want to send to the model.</p>
pub fn set_messages(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Message>>) -> Self {
self.messages = input;
self
}
/// <p>The messages that you want to send to the model.</p>
pub fn get_messages(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Message>> {
&self.messages
}
/// Appends an item to `system`.
///
/// To override the contents of this collection use [`set_system`](Self::set_system).
///
/// <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>
pub fn system(mut self, input: crate::types::SystemContentBlock) -> Self {
let mut v = self.system.unwrap_or_default();
v.push(input);
self.system = ::std::option::Option::Some(v);
self
}
/// <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>
pub fn set_system(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SystemContentBlock>>) -> Self {
self.system = input;
self
}
/// <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>
pub fn get_system(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SystemContentBlock>> {
&self.system
}
/// <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>
pub fn inference_config(mut self, input: crate::types::InferenceConfiguration) -> Self {
self.inference_config = ::std::option::Option::Some(input);
self
}
/// <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>
pub fn set_inference_config(mut self, input: ::std::option::Option<crate::types::InferenceConfiguration>) -> Self {
self.inference_config = input;
self
}
/// <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>
pub fn get_inference_config(&self) -> &::std::option::Option<crate::types::InferenceConfiguration> {
&self.inference_config
}
/// <p>Configuration information for the tools that the model can use when generating a response.</p>
/// <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>
pub fn tool_config(mut self, input: crate::types::ToolConfiguration) -> Self {
self.tool_config = ::std::option::Option::Some(input);
self
}
/// <p>Configuration information for the tools that the model can use when generating a response.</p>
/// <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>
pub fn set_tool_config(mut self, input: ::std::option::Option<crate::types::ToolConfiguration>) -> Self {
self.tool_config = input;
self
}
/// <p>Configuration information for the tools that the model can use when generating a response.</p>
/// <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>
pub fn get_tool_config(&self) -> &::std::option::Option<crate::types::ToolConfiguration> {
&self.tool_config
}
/// <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>
pub fn guardrail_config(mut self, input: crate::types::GuardrailConfiguration) -> Self {
self.guardrail_config = ::std::option::Option::Some(input);
self
}
/// <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>
pub fn set_guardrail_config(mut self, input: ::std::option::Option<crate::types::GuardrailConfiguration>) -> Self {
self.guardrail_config = input;
self
}
/// <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>
pub fn get_guardrail_config(&self) -> &::std::option::Option<crate::types::GuardrailConfiguration> {
&self.guardrail_config
}
/// <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>
pub fn additional_model_request_fields(mut self, input: ::aws_smithy_types::Document) -> Self {
self.additional_model_request_fields = ::std::option::Option::Some(input);
self
}
/// <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>
pub fn set_additional_model_request_fields(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self {
self.additional_model_request_fields = input;
self
}
/// <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>
pub fn get_additional_model_request_fields(&self) -> &::std::option::Option<::aws_smithy_types::Document> {
&self.additional_model_request_fields
}
/// Adds a key-value pair to `prompt_variables`.
///
/// To override the contents of this collection use [`set_prompt_variables`](Self::set_prompt_variables).
///
/// <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>
pub fn prompt_variables(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::PromptVariableValues) -> Self {
let mut hash_map = self.prompt_variables.unwrap_or_default();
hash_map.insert(k.into(), v);
self.prompt_variables = ::std::option::Option::Some(hash_map);
self
}
/// <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>
pub fn set_prompt_variables(
mut self,
input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::PromptVariableValues>>,
) -> Self {
self.prompt_variables = input;
self
}
/// <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>
pub fn get_prompt_variables(
&self,
) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::PromptVariableValues>> {
&self.prompt_variables
}
/// Appends an item to `additional_model_response_field_paths`.
///
/// To override the contents of this collection use [`set_additional_model_response_field_paths`](Self::set_additional_model_response_field_paths).
///
/// <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>
/// <p><code>\[ "/stop_sequence" \]</code></p>
/// <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>
/// <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>
pub fn additional_model_response_field_paths(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut v = self.additional_model_response_field_paths.unwrap_or_default();
v.push(input.into());
self.additional_model_response_field_paths = ::std::option::Option::Some(v);
self
}
/// <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>
/// <p><code>\[ "/stop_sequence" \]</code></p>
/// <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>
/// <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>
pub fn set_additional_model_response_field_paths(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
self.additional_model_response_field_paths = input;
self
}
/// <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>
/// <p><code>\[ "/stop_sequence" \]</code></p>
/// <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>
/// <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>
pub fn get_additional_model_response_field_paths(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
&self.additional_model_response_field_paths
}
/// Adds a key-value pair to `request_metadata`.
///
/// To override the contents of this collection use [`set_request_metadata`](Self::set_request_metadata).
///
/// <p>Key-value pairs that you can use to filter invocation logs.</p>
pub fn request_metadata(
mut self,
k: impl ::std::convert::Into<::std::string::String>,
v: impl ::std::convert::Into<::std::string::String>,
) -> Self {
let mut hash_map = self.request_metadata.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.request_metadata = ::std::option::Option::Some(hash_map);
self
}
/// <p>Key-value pairs that you can use to filter invocation logs.</p>
pub fn set_request_metadata(
mut self,
input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
) -> Self {
self.request_metadata = input;
self
}
/// <p>Key-value pairs that you can use to filter invocation logs.</p>
pub fn get_request_metadata(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
&self.request_metadata
}
/// <p>Model performance settings for the request.</p>
pub fn performance_config(mut self, input: crate::types::PerformanceConfiguration) -> Self {
self.performance_config = ::std::option::Option::Some(input);
self
}
/// <p>Model performance settings for the request.</p>
pub fn set_performance_config(mut self, input: ::std::option::Option<crate::types::PerformanceConfiguration>) -> Self {
self.performance_config = input;
self
}
/// <p>Model performance settings for the request.</p>
pub fn get_performance_config(&self) -> &::std::option::Option<crate::types::PerformanceConfiguration> {
&self.performance_config
}
/// <p>Specifies the processing tier configuration used for serving the request.</p>
pub fn service_tier(mut self, input: crate::types::ServiceTier) -> Self {
self.service_tier = ::std::option::Option::Some(input);
self
}
/// <p>Specifies the processing tier configuration used for serving the request.</p>
pub fn set_service_tier(mut self, input: ::std::option::Option<crate::types::ServiceTier>) -> Self {
self.service_tier = input;
self
}
/// <p>Specifies the processing tier configuration used for serving the request.</p>
pub fn get_service_tier(&self) -> &::std::option::Option<crate::types::ServiceTier> {
&self.service_tier
}
/// <p>Output configuration for a model response.</p>
pub fn output_config(mut self, input: crate::types::OutputConfig) -> Self {
self.output_config = ::std::option::Option::Some(input);
self
}
/// <p>Output configuration for a model response.</p>
pub fn set_output_config(mut self, input: ::std::option::Option<crate::types::OutputConfig>) -> Self {
self.output_config = input;
self
}
/// <p>Output configuration for a model response.</p>
pub fn get_output_config(&self) -> &::std::option::Option<crate::types::OutputConfig> {
&self.output_config
}
/// Consumes the builder and constructs a [`ConverseInput`](crate::operation::converse::ConverseInput).
pub fn build(self) -> ::std::result::Result<crate::operation::converse::ConverseInput, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::operation::converse::ConverseInput {
model_id: self.model_id,
messages: self.messages,
system: self.system,
inference_config: self.inference_config,
tool_config: self.tool_config,
guardrail_config: self.guardrail_config,
additional_model_request_fields: self.additional_model_request_fields,
prompt_variables: self.prompt_variables,
additional_model_response_field_paths: self.additional_model_response_field_paths,
request_metadata: self.request_metadata,
performance_config: self.performance_config,
service_tier: self.service_tier,
output_config: self.output_config,
})
}
}
impl ::std::fmt::Debug for ConverseInputBuilder {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
let mut formatter = f.debug_struct("ConverseInputBuilder");
formatter.field("model_id", &self.model_id);
formatter.field("messages", &self.messages);
formatter.field("system", &self.system);
formatter.field("inference_config", &self.inference_config);
formatter.field("tool_config", &self.tool_config);
formatter.field("guardrail_config", &self.guardrail_config);
formatter.field("additional_model_request_fields", &self.additional_model_request_fields);
formatter.field("prompt_variables", &"*** Sensitive Data Redacted ***");
formatter.field("additional_model_response_field_paths", &self.additional_model_response_field_paths);
formatter.field("request_metadata", &"*** Sensitive Data Redacted ***");
formatter.field("performance_config", &self.performance_config);
formatter.field("service_tier", &self.service_tier);
formatter.field("output_config", &self.output_config);
formatter.finish()
}
}