@aws-sdk/client-bedrock-runtime 3.598.0 → 3.602.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,39 @@ export declare class AccessDeniedException extends __BaseException {
13
13
  */
14
14
  constructor(opts: __ExceptionOptionType<AccessDeniedException, __BaseException>);
15
15
  }
16
+ /**
17
+ * @public
18
+ * @enum
19
+ */
20
+ export declare const GuardrailTrace: {
21
+ readonly DISABLED: "disabled";
22
+ readonly ENABLED: "enabled";
23
+ };
24
+ /**
25
+ * @public
26
+ */
27
+ export type GuardrailTrace = (typeof GuardrailTrace)[keyof typeof GuardrailTrace];
28
+ /**
29
+ * <p>Configuration information for a guardrail that you use with the <a>Converse</a> action.</p>
30
+ * @public
31
+ */
32
+ export interface GuardrailConfiguration {
33
+ /**
34
+ * <p>The identifier for the guardrail.</p>
35
+ * @public
36
+ */
37
+ guardrailIdentifier: string | undefined;
38
+ /**
39
+ * <p>The version of the guardrail.</p>
40
+ * @public
41
+ */
42
+ guardrailVersion: string | undefined;
43
+ /**
44
+ * <p>The trace behavior for the guardrail.</p>
45
+ * @public
46
+ */
47
+ trace?: GuardrailTrace;
48
+ }
16
49
  /**
17
50
  * <p>Base inference parameters to pass to a model in a call to <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html">Converse</a> or <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html">ConverseStream</a>. For more information,
18
51
  * see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters for foundation models</a>.</p>
@@ -26,96 +59,7 @@ export interface InferenceConfiguration {
26
59
  /**
27
60
  * <p>The maximum number of tokens to allow in the generated response. The default value is
28
61
  * the maximum allowed value for the model that you are using. For more information, see
29
- * <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters for foundatio\{
30
- * "messages": [
31
- * \{
32
- * "role": "user",
33
- * "content": [
34
- * \{
35
- * "text": "what's the weather in Queens, NY and Austin, TX?"
36
- * \}
37
- * ]
38
- * \},
39
- * \{
40
- * "role": "assistant",
41
- * "content": [
42
- * \{
43
- * "toolUse": \{
44
- * "toolUseId": "1",
45
- * "name": "get_weather",
46
- * "input": \{
47
- * "city": "Queens",
48
- * "state": "NY"
49
- * \}
50
- * \}
51
- * \},
52
- * \{
53
- * "toolUse": \{
54
- * "toolUseId": "2",
55
- * "name": "get_weather",
56
- * "input": \{
57
- * "city": "Austin",
58
- * "state": "TX"
59
- * \}
60
- * \}
61
- * \}
62
- * ]
63
- * \},
64
- * \{
65
- * "role": "user",
66
- * "content": [
67
- * \{
68
- * "toolResult": \{
69
- * "toolUseId": "2",
70
- * "content": [
71
- * \{
72
- * "json": \{
73
- * "weather": "40"
74
- * \}
75
- * \}
76
- * ]
77
- * \}
78
- * \},
79
- * \{
80
- * "text": "..."
81
- * \},
82
- * \{
83
- * "toolResult": \{
84
- * "toolUseId": "1",
85
- * "content": [
86
- * \{
87
- * "text": "result text"
88
- * \}
89
- * ]
90
- * \}
91
- * \}
92
- * ]
93
- * \}
94
- * ],
95
- * "toolConfig": \{
96
- * "tools": [
97
- * \{
98
- * "name": "get_weather",
99
- * "description": "Get weather",
100
- * "inputSchema": \{
101
- * "type": "object",
102
- * "properties": \{
103
- * "city": \{
104
- * "type": "string",
105
- * "description": "City of location"
106
- * \},
107
- * "state": \{
108
- * "type": "string",
109
- * "description": "State of location"
110
- * \}
111
- * \},
112
- * "required": ["city", "state"]
113
- * \}
114
- * \}
115
- * ]
116
- * \}
117
- * \}
118
- * n models</a>. </p>
62
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters for foundation models</a>. </p>
119
63
  * @public
120
64
  */
121
65
  maxTokens?: number;
@@ -146,6 +90,119 @@ export interface InferenceConfiguration {
146
90
  */
147
91
  stopSequences?: string[];
148
92
  }
93
+ /**
94
+ * @public
95
+ * @enum
96
+ */
97
+ export declare const DocumentFormat: {
98
+ readonly CSV: "csv";
99
+ readonly DOC: "doc";
100
+ readonly DOCX: "docx";
101
+ readonly HTML: "html";
102
+ readonly MD: "md";
103
+ readonly PDF: "pdf";
104
+ readonly TXT: "txt";
105
+ readonly XLS: "xls";
106
+ readonly XLSX: "xlsx";
107
+ };
108
+ /**
109
+ * @public
110
+ */
111
+ export type DocumentFormat = (typeof DocumentFormat)[keyof typeof DocumentFormat];
112
+ /**
113
+ * <p>Contains the content of the document included in a message when sending a <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html">Converse</a> or <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html">ConverseStream</a> request or in the response.</p>
114
+ * @public
115
+ */
116
+ export type DocumentSource = DocumentSource.BytesMember | DocumentSource.$UnknownMember;
117
+ /**
118
+ * @public
119
+ */
120
+ export declare namespace DocumentSource {
121
+ /**
122
+ * <p>A base64-encoded string of a UTF-8 encoded file, that is the document to include in the message.</p>
123
+ * @public
124
+ */
125
+ interface BytesMember {
126
+ bytes: Uint8Array;
127
+ $unknown?: never;
128
+ }
129
+ /**
130
+ * @public
131
+ */
132
+ interface $UnknownMember {
133
+ bytes?: never;
134
+ $unknown: [string, any];
135
+ }
136
+ interface Visitor<T> {
137
+ bytes: (value: Uint8Array) => T;
138
+ _: (name: string, value: any) => T;
139
+ }
140
+ const visit: <T>(value: DocumentSource, visitor: Visitor<T>) => T;
141
+ }
142
+ /**
143
+ * <p>A document to include in a message when sending a <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html">Converse</a> or <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html">ConverseStream</a> request. You can include up to 5 documents in a request. The maximum document size is 50 MB.</p>
144
+ * @public
145
+ */
146
+ export interface DocumentBlock {
147
+ /**
148
+ * <p>The format of a document, or its extension.</p>
149
+ * @public
150
+ */
151
+ format: DocumentFormat | undefined;
152
+ /**
153
+ * <p>A name for the document.</p>
154
+ * @public
155
+ */
156
+ name: string | undefined;
157
+ /**
158
+ * <p>Contains the content of the document.</p>
159
+ * @public
160
+ */
161
+ source: DocumentSource | undefined;
162
+ }
163
+ /**
164
+ * <p>A text block that contains text that you want to assess with a guardrail. For more information, see <a>GuardrailConverseContentBlock</a>.</p>
165
+ * @public
166
+ */
167
+ export interface GuardrailConverseTextBlock {
168
+ /**
169
+ * <p>The text that you want to guard.</p>
170
+ * @public
171
+ */
172
+ text: string | undefined;
173
+ }
174
+ /**
175
+ * <p/>
176
+ * <p>A content block for selective guarding with the Converse API (<a>Converse</a> and <a>ConverseStream</a>).
177
+ * </p>
178
+ * @public
179
+ */
180
+ export type GuardrailConverseContentBlock = GuardrailConverseContentBlock.TextMember | GuardrailConverseContentBlock.$UnknownMember;
181
+ /**
182
+ * @public
183
+ */
184
+ export declare namespace GuardrailConverseContentBlock {
185
+ /**
186
+ * <p>The text to guard.</p>
187
+ * @public
188
+ */
189
+ interface TextMember {
190
+ text: GuardrailConverseTextBlock;
191
+ $unknown?: never;
192
+ }
193
+ /**
194
+ * @public
195
+ */
196
+ interface $UnknownMember {
197
+ text?: never;
198
+ $unknown: [string, any];
199
+ }
200
+ interface Visitor<T> {
201
+ text: (value: GuardrailConverseTextBlock) => T;
202
+ _: (name: string, value: any) => T;
203
+ }
204
+ const visit: <T>(value: GuardrailConverseContentBlock, visitor: Visitor<T>) => T;
205
+ }
149
206
  /**
150
207
  * @public
151
208
  * @enum
@@ -210,7 +267,7 @@ export interface ImageBlock {
210
267
  * <p>The tool result content block.</p>
211
268
  * @public
212
269
  */
213
- export type ToolResultContentBlock = ToolResultContentBlock.ImageMember | ToolResultContentBlock.JsonMember | ToolResultContentBlock.TextMember | ToolResultContentBlock.$UnknownMember;
270
+ export type ToolResultContentBlock = ToolResultContentBlock.DocumentMember | ToolResultContentBlock.ImageMember | ToolResultContentBlock.JsonMember | ToolResultContentBlock.TextMember | ToolResultContentBlock.$UnknownMember;
214
271
  /**
215
272
  * @public
216
273
  */
@@ -223,6 +280,7 @@ export declare namespace ToolResultContentBlock {
223
280
  json: __DocumentType;
224
281
  text?: never;
225
282
  image?: never;
283
+ document?: never;
226
284
  $unknown?: never;
227
285
  }
228
286
  /**
@@ -233,6 +291,7 @@ export declare namespace ToolResultContentBlock {
233
291
  json?: never;
234
292
  text: string;
235
293
  image?: never;
294
+ document?: never;
236
295
  $unknown?: never;
237
296
  }
238
297
  /**
@@ -246,6 +305,18 @@ export declare namespace ToolResultContentBlock {
246
305
  json?: never;
247
306
  text?: never;
248
307
  image: ImageBlock;
308
+ document?: never;
309
+ $unknown?: never;
310
+ }
311
+ /**
312
+ * <p>A tool result that is a document.</p>
313
+ * @public
314
+ */
315
+ interface DocumentMember {
316
+ json?: never;
317
+ text?: never;
318
+ image?: never;
319
+ document: DocumentBlock;
249
320
  $unknown?: never;
250
321
  }
251
322
  /**
@@ -255,12 +326,14 @@ export declare namespace ToolResultContentBlock {
255
326
  json?: never;
256
327
  text?: never;
257
328
  image?: never;
329
+ document?: never;
258
330
  $unknown: [string, any];
259
331
  }
260
332
  interface Visitor<T> {
261
333
  json: (value: __DocumentType) => T;
262
334
  text: (value: string) => T;
263
335
  image: (value: ImageBlock) => T;
336
+ document: (value: DocumentBlock) => T;
264
337
  _: (name: string, value: any) => T;
265
338
  }
266
339
  const visit: <T>(value: ToolResultContentBlock, visitor: Visitor<T>) => T;
@@ -325,10 +398,10 @@ export interface ToolUseBlock {
325
398
  input: __DocumentType | undefined;
326
399
  }
327
400
  /**
328
- * <p>A block of content for a message.</p>
401
+ * <p>A block of content for a message that you pass to, or receive from, a model with the Converse API (<a>Converse</a> and <a>ConverseStream</a>).</p>
329
402
  * @public
330
403
  */
331
- export type ContentBlock = ContentBlock.ImageMember | ContentBlock.TextMember | ContentBlock.ToolResultMember | ContentBlock.ToolUseMember | ContentBlock.$UnknownMember;
404
+ export type ContentBlock = ContentBlock.DocumentMember | ContentBlock.GuardContentMember | ContentBlock.ImageMember | ContentBlock.TextMember | ContentBlock.ToolResultMember | ContentBlock.ToolUseMember | ContentBlock.$UnknownMember;
332
405
  /**
333
406
  * @public
334
407
  */
@@ -340,8 +413,10 @@ export declare namespace ContentBlock {
340
413
  interface TextMember {
341
414
  text: string;
342
415
  image?: never;
416
+ document?: never;
343
417
  toolUse?: never;
344
418
  toolResult?: never;
419
+ guardContent?: never;
345
420
  $unknown?: never;
346
421
  }
347
422
  /**
@@ -354,8 +429,23 @@ export declare namespace ContentBlock {
354
429
  interface ImageMember {
355
430
  text?: never;
356
431
  image: ImageBlock;
432
+ document?: never;
357
433
  toolUse?: never;
358
434
  toolResult?: never;
435
+ guardContent?: never;
436
+ $unknown?: never;
437
+ }
438
+ /**
439
+ * <p>A document to include in the message.</p>
440
+ * @public
441
+ */
442
+ interface DocumentMember {
443
+ text?: never;
444
+ image?: never;
445
+ document: DocumentBlock;
446
+ toolUse?: never;
447
+ toolResult?: never;
448
+ guardContent?: never;
359
449
  $unknown?: never;
360
450
  }
361
451
  /**
@@ -365,8 +455,10 @@ export declare namespace ContentBlock {
365
455
  interface ToolUseMember {
366
456
  text?: never;
367
457
  image?: never;
458
+ document?: never;
368
459
  toolUse: ToolUseBlock;
369
460
  toolResult?: never;
461
+ guardContent?: never;
370
462
  $unknown?: never;
371
463
  }
372
464
  /**
@@ -376,8 +468,28 @@ export declare namespace ContentBlock {
376
468
  interface ToolResultMember {
377
469
  text?: never;
378
470
  image?: never;
471
+ document?: never;
379
472
  toolUse?: never;
380
473
  toolResult: ToolResultBlock;
474
+ guardContent?: never;
475
+ $unknown?: never;
476
+ }
477
+ /**
478
+ * <p>Contains the content to assess with the guardrail. If you don't specify
479
+ * <code>guardContent</code> in a call to the Converse API, the guardrail (if passed in the
480
+ * Converse API) assesses the entire message.</p>
481
+ * <p>For more information, see <i>Use a guardrail with the Converse API</i> in the <i>Amazon Bedrock User Guide</i>.
482
+ *
483
+ * </p>
484
+ * @public
485
+ */
486
+ interface GuardContentMember {
487
+ text?: never;
488
+ image?: never;
489
+ document?: never;
490
+ toolUse?: never;
491
+ toolResult?: never;
492
+ guardContent: GuardrailConverseContentBlock;
381
493
  $unknown?: never;
382
494
  }
383
495
  /**
@@ -386,15 +498,19 @@ export declare namespace ContentBlock {
386
498
  interface $UnknownMember {
387
499
  text?: never;
388
500
  image?: never;
501
+ document?: never;
389
502
  toolUse?: never;
390
503
  toolResult?: never;
504
+ guardContent?: never;
391
505
  $unknown: [string, any];
392
506
  }
393
507
  interface Visitor<T> {
394
508
  text: (value: string) => T;
395
509
  image: (value: ImageBlock) => T;
510
+ document: (value: DocumentBlock) => T;
396
511
  toolUse: (value: ToolUseBlock) => T;
397
512
  toolResult: (value: ToolResultBlock) => T;
513
+ guardContent: (value: GuardrailConverseContentBlock) => T;
398
514
  _: (name: string, value: any) => T;
399
515
  }
400
516
  const visit: <T>(value: ContentBlock, visitor: Visitor<T>) => T;
@@ -412,8 +528,7 @@ export declare const ConversationRole: {
412
528
  */
413
529
  export type ConversationRole = (typeof ConversationRole)[keyof typeof ConversationRole];
414
530
  /**
415
- * <p>A message in the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Message.html">Message</a> field. Use to send a message in a call to
416
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html">Converse</a>. </p>
531
+ * <p>A message input, or returned from, a call to <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html">Converse</a> or <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html">ConverseStream</a>.</p>
417
532
  * @public
418
533
  */
419
534
  export interface Message {
@@ -429,10 +544,10 @@ export interface Message {
429
544
  content: ContentBlock[] | undefined;
430
545
  }
431
546
  /**
432
- * <p>A system content block</p>
547
+ * <p>A system content block.</p>
433
548
  * @public
434
549
  */
435
- export type SystemContentBlock = SystemContentBlock.TextMember | SystemContentBlock.$UnknownMember;
550
+ export type SystemContentBlock = SystemContentBlock.GuardContentMember | SystemContentBlock.TextMember | SystemContentBlock.$UnknownMember;
436
551
  /**
437
552
  * @public
438
553
  */
@@ -443,6 +558,18 @@ export declare namespace SystemContentBlock {
443
558
  */
444
559
  interface TextMember {
445
560
  text: string;
561
+ guardContent?: never;
562
+ $unknown?: never;
563
+ }
564
+ /**
565
+ * <p>A content block to assess with the guardrail. Use with the Converse API (<a>Converse</a> and <a>ConverseStream</a>). </p>
566
+ * <p>For more information, see <i>Use a guardrail with the Converse
567
+ * API</i> in the <i>Amazon Bedrock User Guide</i>.</p>
568
+ * @public
569
+ */
570
+ interface GuardContentMember {
571
+ text?: never;
572
+ guardContent: GuardrailConverseContentBlock;
446
573
  $unknown?: never;
447
574
  }
448
575
  /**
@@ -450,28 +577,31 @@ export declare namespace SystemContentBlock {
450
577
  */
451
578
  interface $UnknownMember {
452
579
  text?: never;
580
+ guardContent?: never;
453
581
  $unknown: [string, any];
454
582
  }
455
583
  interface Visitor<T> {
456
584
  text: (value: string) => T;
585
+ guardContent: (value: GuardrailConverseContentBlock) => T;
457
586
  _: (name: string, value: any) => T;
458
587
  }
459
588
  const visit: <T>(value: SystemContentBlock, visitor: Visitor<T>) => T;
460
589
  }
461
590
  /**
462
- * <p>The model must request at least one tool (no text is generated).</p>
591
+ * <p>The model must request at least one tool (no text is generated). For example, <code>\{"any" : \{\}\}</code>.</p>
463
592
  * @public
464
593
  */
465
594
  export interface AnyToolChoice {
466
595
  }
467
596
  /**
468
- * <p>The Model automatically decides if a tool should be called or to whether to generate text instead.</p>
597
+ * <p>The Model automatically decides if a tool should be called or whether to generate text instead.
598
+ * For example, <code>\{"auto" : \{\}\}</code>.</p>
469
599
  * @public
470
600
  */
471
601
  export interface AutoToolChoice {
472
602
  }
473
603
  /**
474
- * <p>The model must request a specific tool.</p>
604
+ * <p>The model must request a specific tool. For example, <code>\{"tool" : \{"name" : "Your tool name"\}\}</code>.</p>
475
605
  * <note>
476
606
  * <p>This field is only supported by Anthropic Claude 3 models.</p>
477
607
  * </note>
@@ -485,7 +615,9 @@ export interface SpecificToolChoice {
485
615
  name: string | undefined;
486
616
  }
487
617
  /**
488
- * <p>Forces a model to use a tool.</p>
618
+ * <p>Determines which tools the model should request in a call to <code>Converse</code> or <code>ConverseStream</code>.
619
+ * <code>ToolChoice</code> is only supported by
620
+ * Anthropic Claude 3 models and by Mistral AI Mistral Large.</p>
489
621
  * @public
490
622
  */
491
623
  export type ToolChoice = ToolChoice.AnyMember | ToolChoice.AutoMember | ToolChoice.ToolMember | ToolChoice.$UnknownMember;
@@ -494,7 +626,7 @@ export type ToolChoice = ToolChoice.AnyMember | ToolChoice.AutoMember | ToolChoi
494
626
  */
495
627
  export declare namespace ToolChoice {
496
628
  /**
497
- * <p>The Model automatically decides if a tool should be called or to whether to generate text instead.</p>
629
+ * <p>(Default). The Model automatically decides if a tool should be called or whether to generate text instead. </p>
498
630
  * @public
499
631
  */
500
632
  interface AutoMember {
@@ -514,7 +646,7 @@ export declare namespace ToolChoice {
514
646
  $unknown?: never;
515
647
  }
516
648
  /**
517
- * <p>The Model must request the specified tool.</p>
649
+ * <p>The Model must request the specified tool. Only supported by Anthropic Claude 3 models. </p>
518
650
  * @public
519
651
  */
520
652
  interface ToolMember {
@@ -686,6 +818,11 @@ export interface ConverseRequest {
686
818
  * @public
687
819
  */
688
820
  toolConfig?: ToolConfiguration;
821
+ /**
822
+ * <p>Configuration information for a guardrail that you want to use in the request. </p>
823
+ * @public
824
+ */
825
+ guardrailConfig?: GuardrailConfiguration;
689
826
  /**
690
827
  * <p>Additional inference parameters that the model supports, beyond the
691
828
  * base set of inference parameters that <code>Converse</code> supports in the <code>inferenceConfig</code>
@@ -696,7 +833,7 @@ export interface ConverseRequest {
696
833
  /**
697
834
  * <p>Additional model parameters field paths to return in the
698
835
  * response. <code>Converse</code> returns the requested fields as a JSON Pointer object in the
699
- * <code>additionalModelResultFields</code> field. The following is example JSON for <code>additionalModelResponseFieldPaths</code>.</p>
836
+ * <code>additionalModelResponseFields</code> field. The following is example JSON for <code>additionalModelResponseFieldPaths</code>.</p>
700
837
  * <p>
701
838
  * <code>[
702
839
  * "/stop_sequence"
@@ -761,6 +898,7 @@ export declare namespace ConverseOutput {
761
898
  export declare const StopReason: {
762
899
  readonly CONTENT_FILTERED: "content_filtered";
763
900
  readonly END_TURN: "end_turn";
901
+ readonly GUARDRAIL_INTERVENED: "guardrail_intervened";
764
902
  readonly MAX_TOKENS: "max_tokens";
765
903
  readonly STOP_SEQUENCE: "stop_sequence";
766
904
  readonly TOOL_USE: "tool_use";
@@ -769,6 +907,382 @@ export declare const StopReason: {
769
907
  * @public
770
908
  */
771
909
  export type StopReason = (typeof StopReason)[keyof typeof StopReason];
910
+ /**
911
+ * @public
912
+ * @enum
913
+ */
914
+ export declare const GuardrailContentPolicyAction: {
915
+ readonly BLOCKED: "BLOCKED";
916
+ };
917
+ /**
918
+ * @public
919
+ */
920
+ export type GuardrailContentPolicyAction = (typeof GuardrailContentPolicyAction)[keyof typeof GuardrailContentPolicyAction];
921
+ /**
922
+ * @public
923
+ * @enum
924
+ */
925
+ export declare const GuardrailContentFilterConfidence: {
926
+ readonly HIGH: "HIGH";
927
+ readonly LOW: "LOW";
928
+ readonly MEDIUM: "MEDIUM";
929
+ readonly NONE: "NONE";
930
+ };
931
+ /**
932
+ * @public
933
+ */
934
+ export type GuardrailContentFilterConfidence = (typeof GuardrailContentFilterConfidence)[keyof typeof GuardrailContentFilterConfidence];
935
+ /**
936
+ * @public
937
+ * @enum
938
+ */
939
+ export declare const GuardrailContentFilterType: {
940
+ readonly HATE: "HATE";
941
+ readonly INSULTS: "INSULTS";
942
+ readonly MISCONDUCT: "MISCONDUCT";
943
+ readonly PROMPT_ATTACK: "PROMPT_ATTACK";
944
+ readonly SEXUAL: "SEXUAL";
945
+ readonly VIOLENCE: "VIOLENCE";
946
+ };
947
+ /**
948
+ * @public
949
+ */
950
+ export type GuardrailContentFilterType = (typeof GuardrailContentFilterType)[keyof typeof GuardrailContentFilterType];
951
+ /**
952
+ * <p>The content filter for a guardrail.</p>
953
+ * @public
954
+ */
955
+ export interface GuardrailContentFilter {
956
+ /**
957
+ * <p>The guardrail type.</p>
958
+ * @public
959
+ */
960
+ type: GuardrailContentFilterType | undefined;
961
+ /**
962
+ * <p>The guardrail confidence.</p>
963
+ * @public
964
+ */
965
+ confidence: GuardrailContentFilterConfidence | undefined;
966
+ /**
967
+ * <p>The guardrail action.</p>
968
+ * @public
969
+ */
970
+ action: GuardrailContentPolicyAction | undefined;
971
+ }
972
+ /**
973
+ * <p>An assessment of a content policy for a guardrail.</p>
974
+ * @public
975
+ */
976
+ export interface GuardrailContentPolicyAssessment {
977
+ /**
978
+ * <p>The content policy filters.</p>
979
+ * @public
980
+ */
981
+ filters: GuardrailContentFilter[] | undefined;
982
+ }
983
+ /**
984
+ * @public
985
+ * @enum
986
+ */
987
+ export declare const GuardrailSensitiveInformationPolicyAction: {
988
+ readonly ANONYMIZED: "ANONYMIZED";
989
+ readonly BLOCKED: "BLOCKED";
990
+ };
991
+ /**
992
+ * @public
993
+ */
994
+ export type GuardrailSensitiveInformationPolicyAction = (typeof GuardrailSensitiveInformationPolicyAction)[keyof typeof GuardrailSensitiveInformationPolicyAction];
995
+ /**
996
+ * @public
997
+ * @enum
998
+ */
999
+ export declare const GuardrailPiiEntityType: {
1000
+ readonly ADDRESS: "ADDRESS";
1001
+ readonly AGE: "AGE";
1002
+ readonly AWS_ACCESS_KEY: "AWS_ACCESS_KEY";
1003
+ readonly AWS_SECRET_KEY: "AWS_SECRET_KEY";
1004
+ readonly CA_HEALTH_NUMBER: "CA_HEALTH_NUMBER";
1005
+ readonly CA_SOCIAL_INSURANCE_NUMBER: "CA_SOCIAL_INSURANCE_NUMBER";
1006
+ readonly CREDIT_DEBIT_CARD_CVV: "CREDIT_DEBIT_CARD_CVV";
1007
+ readonly CREDIT_DEBIT_CARD_EXPIRY: "CREDIT_DEBIT_CARD_EXPIRY";
1008
+ readonly CREDIT_DEBIT_CARD_NUMBER: "CREDIT_DEBIT_CARD_NUMBER";
1009
+ readonly DRIVER_ID: "DRIVER_ID";
1010
+ readonly EMAIL: "EMAIL";
1011
+ readonly INTERNATIONAL_BANK_ACCOUNT_NUMBER: "INTERNATIONAL_BANK_ACCOUNT_NUMBER";
1012
+ readonly IP_ADDRESS: "IP_ADDRESS";
1013
+ readonly LICENSE_PLATE: "LICENSE_PLATE";
1014
+ readonly MAC_ADDRESS: "MAC_ADDRESS";
1015
+ readonly NAME: "NAME";
1016
+ readonly PASSWORD: "PASSWORD";
1017
+ readonly PHONE: "PHONE";
1018
+ readonly PIN: "PIN";
1019
+ readonly SWIFT_CODE: "SWIFT_CODE";
1020
+ readonly UK_NATIONAL_HEALTH_SERVICE_NUMBER: "UK_NATIONAL_HEALTH_SERVICE_NUMBER";
1021
+ readonly UK_NATIONAL_INSURANCE_NUMBER: "UK_NATIONAL_INSURANCE_NUMBER";
1022
+ readonly UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER: "UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER";
1023
+ readonly URL: "URL";
1024
+ readonly USERNAME: "USERNAME";
1025
+ readonly US_BANK_ACCOUNT_NUMBER: "US_BANK_ACCOUNT_NUMBER";
1026
+ readonly US_BANK_ROUTING_NUMBER: "US_BANK_ROUTING_NUMBER";
1027
+ readonly US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER: "US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER";
1028
+ readonly US_PASSPORT_NUMBER: "US_PASSPORT_NUMBER";
1029
+ readonly US_SOCIAL_SECURITY_NUMBER: "US_SOCIAL_SECURITY_NUMBER";
1030
+ readonly VEHICLE_IDENTIFICATION_NUMBER: "VEHICLE_IDENTIFICATION_NUMBER";
1031
+ };
1032
+ /**
1033
+ * @public
1034
+ */
1035
+ export type GuardrailPiiEntityType = (typeof GuardrailPiiEntityType)[keyof typeof GuardrailPiiEntityType];
1036
+ /**
1037
+ * <p>A Personally Identifiable Information (PII) entity configured in a guardrail.</p>
1038
+ * @public
1039
+ */
1040
+ export interface GuardrailPiiEntityFilter {
1041
+ /**
1042
+ * <p>The PII entity filter match.</p>
1043
+ * @public
1044
+ */
1045
+ match: string | undefined;
1046
+ /**
1047
+ * <p>The PII entity filter type.</p>
1048
+ * @public
1049
+ */
1050
+ type: GuardrailPiiEntityType | undefined;
1051
+ /**
1052
+ * <p>The PII entity filter action.</p>
1053
+ * @public
1054
+ */
1055
+ action: GuardrailSensitiveInformationPolicyAction | undefined;
1056
+ }
1057
+ /**
1058
+ * <p>A Regex filter configured in a guardrail.</p>
1059
+ * @public
1060
+ */
1061
+ export interface GuardrailRegexFilter {
1062
+ /**
1063
+ * <p>The regex filter name.</p>
1064
+ * @public
1065
+ */
1066
+ name?: string;
1067
+ /**
1068
+ * <p>The regesx filter match.</p>
1069
+ * @public
1070
+ */
1071
+ match?: string;
1072
+ /**
1073
+ * <p>The regex query.</p>
1074
+ * @public
1075
+ */
1076
+ regex?: string;
1077
+ /**
1078
+ * <p>The region filter action.</p>
1079
+ * @public
1080
+ */
1081
+ action: GuardrailSensitiveInformationPolicyAction | undefined;
1082
+ }
1083
+ /**
1084
+ * <p>The assessment for aPersonally Identifiable Information (PII) policy. </p>
1085
+ * @public
1086
+ */
1087
+ export interface GuardrailSensitiveInformationPolicyAssessment {
1088
+ /**
1089
+ * <p>The PII entities in the assessment.</p>
1090
+ * @public
1091
+ */
1092
+ piiEntities: GuardrailPiiEntityFilter[] | undefined;
1093
+ /**
1094
+ * <p>The regex queries in the assessment.</p>
1095
+ * @public
1096
+ */
1097
+ regexes: GuardrailRegexFilter[] | undefined;
1098
+ }
1099
+ /**
1100
+ * @public
1101
+ * @enum
1102
+ */
1103
+ export declare const GuardrailTopicPolicyAction: {
1104
+ readonly BLOCKED: "BLOCKED";
1105
+ };
1106
+ /**
1107
+ * @public
1108
+ */
1109
+ export type GuardrailTopicPolicyAction = (typeof GuardrailTopicPolicyAction)[keyof typeof GuardrailTopicPolicyAction];
1110
+ /**
1111
+ * @public
1112
+ * @enum
1113
+ */
1114
+ export declare const GuardrailTopicType: {
1115
+ readonly DENY: "DENY";
1116
+ };
1117
+ /**
1118
+ * @public
1119
+ */
1120
+ export type GuardrailTopicType = (typeof GuardrailTopicType)[keyof typeof GuardrailTopicType];
1121
+ /**
1122
+ * <p>Information about a topic guardrail.</p>
1123
+ * @public
1124
+ */
1125
+ export interface GuardrailTopic {
1126
+ /**
1127
+ * <p>The name for the guardrail.</p>
1128
+ * @public
1129
+ */
1130
+ name: string | undefined;
1131
+ /**
1132
+ * <p>The type behavior that the guardrail should perform when the model detects the topic.</p>
1133
+ * @public
1134
+ */
1135
+ type: GuardrailTopicType | undefined;
1136
+ /**
1137
+ * <p>The action the guardrail should take when it intervenes on a topic.</p>
1138
+ * @public
1139
+ */
1140
+ action: GuardrailTopicPolicyAction | undefined;
1141
+ }
1142
+ /**
1143
+ * <p>A behavior assessment of a topic policy.</p>
1144
+ * @public
1145
+ */
1146
+ export interface GuardrailTopicPolicyAssessment {
1147
+ /**
1148
+ * <p>The topics in the assessment.</p>
1149
+ * @public
1150
+ */
1151
+ topics: GuardrailTopic[] | undefined;
1152
+ }
1153
+ /**
1154
+ * @public
1155
+ * @enum
1156
+ */
1157
+ export declare const GuardrailWordPolicyAction: {
1158
+ readonly BLOCKED: "BLOCKED";
1159
+ };
1160
+ /**
1161
+ * @public
1162
+ */
1163
+ export type GuardrailWordPolicyAction = (typeof GuardrailWordPolicyAction)[keyof typeof GuardrailWordPolicyAction];
1164
+ /**
1165
+ * <p>A custom word configured in a guardrail.</p>
1166
+ * @public
1167
+ */
1168
+ export interface GuardrailCustomWord {
1169
+ /**
1170
+ * <p>The match for the custom word.</p>
1171
+ * @public
1172
+ */
1173
+ match: string | undefined;
1174
+ /**
1175
+ * <p>The action for the custom word.</p>
1176
+ * @public
1177
+ */
1178
+ action: GuardrailWordPolicyAction | undefined;
1179
+ }
1180
+ /**
1181
+ * @public
1182
+ * @enum
1183
+ */
1184
+ export declare const GuardrailManagedWordType: {
1185
+ readonly PROFANITY: "PROFANITY";
1186
+ };
1187
+ /**
1188
+ * @public
1189
+ */
1190
+ export type GuardrailManagedWordType = (typeof GuardrailManagedWordType)[keyof typeof GuardrailManagedWordType];
1191
+ /**
1192
+ * <p>A managed word configured in a guardrail.</p>
1193
+ * @public
1194
+ */
1195
+ export interface GuardrailManagedWord {
1196
+ /**
1197
+ * <p>The match for the managed word.</p>
1198
+ * @public
1199
+ */
1200
+ match: string | undefined;
1201
+ /**
1202
+ * <p>The type for the managed word.</p>
1203
+ * @public
1204
+ */
1205
+ type: GuardrailManagedWordType | undefined;
1206
+ /**
1207
+ * <p>The action for the managed word.</p>
1208
+ * @public
1209
+ */
1210
+ action: GuardrailWordPolicyAction | undefined;
1211
+ }
1212
+ /**
1213
+ * <p>The word policy assessment.</p>
1214
+ * @public
1215
+ */
1216
+ export interface GuardrailWordPolicyAssessment {
1217
+ /**
1218
+ * <p>Custom words in the assessment.</p>
1219
+ * @public
1220
+ */
1221
+ customWords: GuardrailCustomWord[] | undefined;
1222
+ /**
1223
+ * <p>Managed word lists in the assessment.</p>
1224
+ * @public
1225
+ */
1226
+ managedWordLists: GuardrailManagedWord[] | undefined;
1227
+ }
1228
+ /**
1229
+ * <p>A behavior assessment of the guardrail policies used in a call to the Converse API. </p>
1230
+ * @public
1231
+ */
1232
+ export interface GuardrailAssessment {
1233
+ /**
1234
+ * <p>The topic policy.</p>
1235
+ * @public
1236
+ */
1237
+ topicPolicy?: GuardrailTopicPolicyAssessment;
1238
+ /**
1239
+ * <p>The content policy.</p>
1240
+ * @public
1241
+ */
1242
+ contentPolicy?: GuardrailContentPolicyAssessment;
1243
+ /**
1244
+ * <p>The word policy.</p>
1245
+ * @public
1246
+ */
1247
+ wordPolicy?: GuardrailWordPolicyAssessment;
1248
+ /**
1249
+ * <p>The sensitive information policy.</p>
1250
+ * @public
1251
+ */
1252
+ sensitiveInformationPolicy?: GuardrailSensitiveInformationPolicyAssessment;
1253
+ }
1254
+ /**
1255
+ * <p>A Top level guardrail trace object. For more information, see <a>ConverseTrace</a>.</p>
1256
+ * @public
1257
+ */
1258
+ export interface GuardrailTraceAssessment {
1259
+ /**
1260
+ * <p>The output from the model.</p>
1261
+ * @public
1262
+ */
1263
+ modelOutput?: string[];
1264
+ /**
1265
+ * <p>The input assessment.</p>
1266
+ * @public
1267
+ */
1268
+ inputAssessment?: Record<string, GuardrailAssessment>;
1269
+ /**
1270
+ * <p>the output assessments.</p>
1271
+ * @public
1272
+ */
1273
+ outputAssessments?: Record<string, GuardrailAssessment[]>;
1274
+ }
1275
+ /**
1276
+ * <p>The trace object in a response from <a>Converse</a>. Currently, you can only trace guardrails.</p>
1277
+ * @public
1278
+ */
1279
+ export interface ConverseTrace {
1280
+ /**
1281
+ * <p>The guardrail trace object. </p>
1282
+ * @public
1283
+ */
1284
+ guardrail?: GuardrailTraceAssessment;
1285
+ }
772
1286
  /**
773
1287
  * <p>The tokens used in a message API inference call. </p>
774
1288
  * @public
@@ -820,6 +1334,11 @@ export interface ConverseResponse {
820
1334
  * @public
821
1335
  */
822
1336
  additionalModelResponseFields?: __DocumentType;
1337
+ /**
1338
+ * <p>A trace object that contains information about the Guardrail behavior.</p>
1339
+ * @public
1340
+ */
1341
+ trace?: ConverseTrace;
823
1342
  }
824
1343
  /**
825
1344
  * <p>An internal server error occurred. Retry your request.</p>
@@ -915,6 +1434,47 @@ export declare class ValidationException extends __BaseException {
915
1434
  */
916
1435
  constructor(opts: __ExceptionOptionType<ValidationException, __BaseException>);
917
1436
  }
1437
+ /**
1438
+ * @public
1439
+ * @enum
1440
+ */
1441
+ export declare const GuardrailStreamProcessingMode: {
1442
+ readonly ASYNC: "async";
1443
+ readonly SYNC: "sync";
1444
+ };
1445
+ /**
1446
+ * @public
1447
+ */
1448
+ export type GuardrailStreamProcessingMode = (typeof GuardrailStreamProcessingMode)[keyof typeof GuardrailStreamProcessingMode];
1449
+ /**
1450
+ * <p>Configuration information for a guardrail that you use with the <a>ConverseStream</a> action.
1451
+ * </p>
1452
+ * @public
1453
+ */
1454
+ export interface GuardrailStreamConfiguration {
1455
+ /**
1456
+ * <p>The identifier for the guardrail.</p>
1457
+ * @public
1458
+ */
1459
+ guardrailIdentifier: string | undefined;
1460
+ /**
1461
+ * <p>The version of the guardrail.</p>
1462
+ * @public
1463
+ */
1464
+ guardrailVersion: string | undefined;
1465
+ /**
1466
+ * <p>The trace behavior for the guardrail.</p>
1467
+ * @public
1468
+ */
1469
+ trace?: GuardrailTrace;
1470
+ /**
1471
+ * <p>The processing mode. </p>
1472
+ * <p>The processing mode. For more information, see <i>Configure streaming response behavior</i> in the <i>Amazon Bedrock User Guide</i>.
1473
+ * </p>
1474
+ * @public
1475
+ */
1476
+ streamProcessingMode?: GuardrailStreamProcessingMode;
1477
+ }
918
1478
  /**
919
1479
  * @public
920
1480
  */
@@ -961,6 +1521,11 @@ export interface ConverseStreamRequest {
961
1521
  * @public
962
1522
  */
963
1523
  toolConfig?: ToolConfiguration;
1524
+ /**
1525
+ * <p>Configuration information for a guardrail that you want to use in the request. </p>
1526
+ * @public
1527
+ */
1528
+ guardrailConfig?: GuardrailStreamConfiguration;
964
1529
  /**
965
1530
  * <p>Additional inference parameters that the model supports, beyond the
966
1531
  * base set of inference parameters that <code>ConverseStream</code> supports in the <code>inferenceConfig</code>
@@ -971,7 +1536,7 @@ export interface ConverseStreamRequest {
971
1536
  /**
972
1537
  * <p>Additional model parameters field paths to return in the
973
1538
  * response. <code>ConverseStream</code> returns the requested fields as a JSON Pointer object in the
974
- * <code>additionalModelResultFields</code> field. The following is example JSON for <code>additionalModelResponseFieldPaths</code>.</p>
1539
+ * <code>additionalModelResponseFields</code> field. The following is example JSON for <code>additionalModelResponseFieldPaths</code>.</p>
975
1540
  * <p>
976
1541
  * <code>[
977
1542
  * "/stop_sequence"
@@ -1167,6 +1732,17 @@ export interface ConverseStreamMetrics {
1167
1732
  */
1168
1733
  latencyMs: number | undefined;
1169
1734
  }
1735
+ /**
1736
+ * <p>The trace object in a response from <a>ConverseStream</a>. Currently, you can only trace guardrails.</p>
1737
+ * @public
1738
+ */
1739
+ export interface ConverseStreamTrace {
1740
+ /**
1741
+ * <p>The guardrail trace object. </p>
1742
+ * @public
1743
+ */
1744
+ guardrail?: GuardrailTraceAssessment;
1745
+ }
1170
1746
  /**
1171
1747
  * <p>A conversation stream metadata event.</p>
1172
1748
  * @public
@@ -1182,6 +1758,11 @@ export interface ConverseStreamMetadataEvent {
1182
1758
  * @public
1183
1759
  */
1184
1760
  metrics: ConverseStreamMetrics | undefined;
1761
+ /**
1762
+ * <p>The trace object in the response from <a>ConverseStream</a> that contains information about the guardrail behavior.</p>
1763
+ * @public
1764
+ */
1765
+ trace?: ConverseStreamTrace;
1185
1766
  }
1186
1767
  /**
1187
1768
  * <p>An error occurred while streaming the response. Retry your request.</p>
@@ -1442,12 +2023,12 @@ export type Trace = (typeof Trace)[keyof typeof Trace];
1442
2023
  */
1443
2024
  export interface InvokeModelRequest {
1444
2025
  /**
1445
- * <p>The prompt and inference parameters in the format specified in the <code>contentType</code> in the header. To see the format and content of the request and response bodies for different models, refer to <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters</a>. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html">Run inference</a> in the Bedrock User Guide.</p>
2026
+ * <p>The prompt and inference parameters in the format specified in the <code>contentType</code> in the header. You must provide the body in JSON format. To see the format and content of the request and response bodies for different models, refer to <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters</a>. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html">Run inference</a> in the Bedrock User Guide.</p>
1446
2027
  * @public
1447
2028
  */
1448
2029
  body: Uint8Array | undefined;
1449
2030
  /**
1450
- * <p>The MIME type of the input data in the request. The default value is
2031
+ * <p>The MIME type of the input data in the request. You must specify
1451
2032
  * <code>application/json</code>.</p>
1452
2033
  * @public
1453
2034
  */
@@ -1535,12 +2116,12 @@ export declare class ServiceQuotaExceededException extends __BaseException {
1535
2116
  */
1536
2117
  export interface InvokeModelWithResponseStreamRequest {
1537
2118
  /**
1538
- * <p>The prompt and inference parameters in the format specified in the <code>contentType</code> in the header. To see the format and content of the request and response bodies for different models, refer to <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters</a>. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html">Run inference</a> in the Bedrock User Guide.</p>
2119
+ * <p>The prompt and inference parameters in the format specified in the <code>contentType</code> in the header. You must provide the body in JSON format. To see the format and content of the request and response bodies for different models, refer to <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters</a>. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/api-methods-run.html">Run inference</a> in the Bedrock User Guide.</p>
1539
2120
  * @public
1540
2121
  */
1541
2122
  body: Uint8Array | undefined;
1542
2123
  /**
1543
- * <p>The MIME type of the input data in the request. The default value is
2124
+ * <p>The MIME type of the input data in the request. You must specify
1544
2125
  * <code>application/json</code>.</p>
1545
2126
  * @public
1546
2127
  */