@aws-sdk/client-bedrock-runtime 3.598.0 → 3.600.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.
@@ -8,12 +8,47 @@ export declare class AccessDeniedException extends __BaseException {
8
8
  opts: __ExceptionOptionType<AccessDeniedException, __BaseException>
9
9
  );
10
10
  }
11
+ export declare const GuardrailTrace: {
12
+ readonly DISABLED: "disabled";
13
+ readonly ENABLED: "enabled";
14
+ };
15
+ export type GuardrailTrace =
16
+ (typeof GuardrailTrace)[keyof typeof GuardrailTrace];
17
+ export interface GuardrailConfiguration {
18
+ guardrailIdentifier: string | undefined;
19
+ guardrailVersion: string | undefined;
20
+ trace?: GuardrailTrace;
21
+ }
11
22
  export interface InferenceConfiguration {
12
23
  maxTokens?: number;
13
24
  temperature?: number;
14
25
  topP?: number;
15
26
  stopSequences?: string[];
16
27
  }
28
+ export interface GuardrailConverseTextBlock {
29
+ text: string | undefined;
30
+ }
31
+ export type GuardrailConverseContentBlock =
32
+ | GuardrailConverseContentBlock.TextMember
33
+ | GuardrailConverseContentBlock.$UnknownMember;
34
+ export declare namespace GuardrailConverseContentBlock {
35
+ interface TextMember {
36
+ text: GuardrailConverseTextBlock;
37
+ $unknown?: never;
38
+ }
39
+ interface $UnknownMember {
40
+ text?: never;
41
+ $unknown: [string, any];
42
+ }
43
+ interface Visitor<T> {
44
+ text: (value: GuardrailConverseTextBlock) => T;
45
+ _: (name: string, value: any) => T;
46
+ }
47
+ const visit: <T>(
48
+ value: GuardrailConverseContentBlock,
49
+ visitor: Visitor<T>
50
+ ) => T;
51
+ }
17
52
  export declare const ImageFormat: {
18
53
  readonly GIF: "gif";
19
54
  readonly JPEG: "jpeg";
@@ -96,6 +131,7 @@ export interface ToolUseBlock {
96
131
  input: __DocumentType | undefined;
97
132
  }
98
133
  export type ContentBlock =
134
+ | ContentBlock.GuardContentMember
99
135
  | ContentBlock.ImageMember
100
136
  | ContentBlock.TextMember
101
137
  | ContentBlock.ToolResultMember
@@ -107,6 +143,7 @@ export declare namespace ContentBlock {
107
143
  image?: never;
108
144
  toolUse?: never;
109
145
  toolResult?: never;
146
+ guardContent?: never;
110
147
  $unknown?: never;
111
148
  }
112
149
  interface ImageMember {
@@ -114,6 +151,7 @@ export declare namespace ContentBlock {
114
151
  image: ImageBlock;
115
152
  toolUse?: never;
116
153
  toolResult?: never;
154
+ guardContent?: never;
117
155
  $unknown?: never;
118
156
  }
119
157
  interface ToolUseMember {
@@ -121,6 +159,7 @@ export declare namespace ContentBlock {
121
159
  image?: never;
122
160
  toolUse: ToolUseBlock;
123
161
  toolResult?: never;
162
+ guardContent?: never;
124
163
  $unknown?: never;
125
164
  }
126
165
  interface ToolResultMember {
@@ -128,6 +167,15 @@ export declare namespace ContentBlock {
128
167
  image?: never;
129
168
  toolUse?: never;
130
169
  toolResult: ToolResultBlock;
170
+ guardContent?: never;
171
+ $unknown?: never;
172
+ }
173
+ interface GuardContentMember {
174
+ text?: never;
175
+ image?: never;
176
+ toolUse?: never;
177
+ toolResult?: never;
178
+ guardContent: GuardrailConverseContentBlock;
131
179
  $unknown?: never;
132
180
  }
133
181
  interface $UnknownMember {
@@ -135,6 +183,7 @@ export declare namespace ContentBlock {
135
183
  image?: never;
136
184
  toolUse?: never;
137
185
  toolResult?: never;
186
+ guardContent?: never;
138
187
  $unknown: [string, any];
139
188
  }
140
189
  interface Visitor<T> {
@@ -142,6 +191,7 @@ export declare namespace ContentBlock {
142
191
  image: (value: ImageBlock) => T;
143
192
  toolUse: (value: ToolUseBlock) => T;
144
193
  toolResult: (value: ToolResultBlock) => T;
194
+ guardContent: (value: GuardrailConverseContentBlock) => T;
145
195
  _: (name: string, value: any) => T;
146
196
  }
147
197
  const visit: <T>(value: ContentBlock, visitor: Visitor<T>) => T;
@@ -157,19 +207,28 @@ export interface Message {
157
207
  content: ContentBlock[] | undefined;
158
208
  }
159
209
  export type SystemContentBlock =
210
+ | SystemContentBlock.GuardContentMember
160
211
  | SystemContentBlock.TextMember
161
212
  | SystemContentBlock.$UnknownMember;
162
213
  export declare namespace SystemContentBlock {
163
214
  interface TextMember {
164
215
  text: string;
216
+ guardContent?: never;
217
+ $unknown?: never;
218
+ }
219
+ interface GuardContentMember {
220
+ text?: never;
221
+ guardContent: GuardrailConverseContentBlock;
165
222
  $unknown?: never;
166
223
  }
167
224
  interface $UnknownMember {
168
225
  text?: never;
226
+ guardContent?: never;
169
227
  $unknown: [string, any];
170
228
  }
171
229
  interface Visitor<T> {
172
230
  text: (value: string) => T;
231
+ guardContent: (value: GuardrailConverseContentBlock) => T;
173
232
  _: (name: string, value: any) => T;
174
233
  }
175
234
  const visit: <T>(value: SystemContentBlock, visitor: Visitor<T>) => T;
@@ -266,6 +325,7 @@ export interface ConverseRequest {
266
325
  system?: SystemContentBlock[];
267
326
  inferenceConfig?: InferenceConfiguration;
268
327
  toolConfig?: ToolConfiguration;
328
+ guardrailConfig?: GuardrailConfiguration;
269
329
  additionalModelRequestFields?: __DocumentType;
270
330
  additionalModelResponseFieldPaths?: string[];
271
331
  }
@@ -293,11 +353,154 @@ export declare namespace ConverseOutput {
293
353
  export declare const StopReason: {
294
354
  readonly CONTENT_FILTERED: "content_filtered";
295
355
  readonly END_TURN: "end_turn";
356
+ readonly GUARDRAIL_INTERVENED: "guardrail_intervened";
296
357
  readonly MAX_TOKENS: "max_tokens";
297
358
  readonly STOP_SEQUENCE: "stop_sequence";
298
359
  readonly TOOL_USE: "tool_use";
299
360
  };
300
361
  export type StopReason = (typeof StopReason)[keyof typeof StopReason];
362
+ export declare const GuardrailContentPolicyAction: {
363
+ readonly BLOCKED: "BLOCKED";
364
+ };
365
+ export type GuardrailContentPolicyAction =
366
+ (typeof GuardrailContentPolicyAction)[keyof typeof GuardrailContentPolicyAction];
367
+ export declare const GuardrailContentFilterConfidence: {
368
+ readonly HIGH: "HIGH";
369
+ readonly LOW: "LOW";
370
+ readonly MEDIUM: "MEDIUM";
371
+ readonly NONE: "NONE";
372
+ };
373
+ export type GuardrailContentFilterConfidence =
374
+ (typeof GuardrailContentFilterConfidence)[keyof typeof GuardrailContentFilterConfidence];
375
+ export declare const GuardrailContentFilterType: {
376
+ readonly HATE: "HATE";
377
+ readonly INSULTS: "INSULTS";
378
+ readonly MISCONDUCT: "MISCONDUCT";
379
+ readonly PROMPT_ATTACK: "PROMPT_ATTACK";
380
+ readonly SEXUAL: "SEXUAL";
381
+ readonly VIOLENCE: "VIOLENCE";
382
+ };
383
+ export type GuardrailContentFilterType =
384
+ (typeof GuardrailContentFilterType)[keyof typeof GuardrailContentFilterType];
385
+ export interface GuardrailContentFilter {
386
+ type: GuardrailContentFilterType | undefined;
387
+ confidence: GuardrailContentFilterConfidence | undefined;
388
+ action: GuardrailContentPolicyAction | undefined;
389
+ }
390
+ export interface GuardrailContentPolicyAssessment {
391
+ filters: GuardrailContentFilter[] | undefined;
392
+ }
393
+ export declare const GuardrailSensitiveInformationPolicyAction: {
394
+ readonly ANONYMIZED: "ANONYMIZED";
395
+ readonly BLOCKED: "BLOCKED";
396
+ };
397
+ export type GuardrailSensitiveInformationPolicyAction =
398
+ (typeof GuardrailSensitiveInformationPolicyAction)[keyof typeof GuardrailSensitiveInformationPolicyAction];
399
+ export declare const GuardrailPiiEntityType: {
400
+ readonly ADDRESS: "ADDRESS";
401
+ readonly AGE: "AGE";
402
+ readonly AWS_ACCESS_KEY: "AWS_ACCESS_KEY";
403
+ readonly AWS_SECRET_KEY: "AWS_SECRET_KEY";
404
+ readonly CA_HEALTH_NUMBER: "CA_HEALTH_NUMBER";
405
+ readonly CA_SOCIAL_INSURANCE_NUMBER: "CA_SOCIAL_INSURANCE_NUMBER";
406
+ readonly CREDIT_DEBIT_CARD_CVV: "CREDIT_DEBIT_CARD_CVV";
407
+ readonly CREDIT_DEBIT_CARD_EXPIRY: "CREDIT_DEBIT_CARD_EXPIRY";
408
+ readonly CREDIT_DEBIT_CARD_NUMBER: "CREDIT_DEBIT_CARD_NUMBER";
409
+ readonly DRIVER_ID: "DRIVER_ID";
410
+ readonly EMAIL: "EMAIL";
411
+ readonly INTERNATIONAL_BANK_ACCOUNT_NUMBER: "INTERNATIONAL_BANK_ACCOUNT_NUMBER";
412
+ readonly IP_ADDRESS: "IP_ADDRESS";
413
+ readonly LICENSE_PLATE: "LICENSE_PLATE";
414
+ readonly MAC_ADDRESS: "MAC_ADDRESS";
415
+ readonly NAME: "NAME";
416
+ readonly PASSWORD: "PASSWORD";
417
+ readonly PHONE: "PHONE";
418
+ readonly PIN: "PIN";
419
+ readonly SWIFT_CODE: "SWIFT_CODE";
420
+ readonly UK_NATIONAL_HEALTH_SERVICE_NUMBER: "UK_NATIONAL_HEALTH_SERVICE_NUMBER";
421
+ readonly UK_NATIONAL_INSURANCE_NUMBER: "UK_NATIONAL_INSURANCE_NUMBER";
422
+ readonly UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER: "UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER";
423
+ readonly URL: "URL";
424
+ readonly USERNAME: "USERNAME";
425
+ readonly US_BANK_ACCOUNT_NUMBER: "US_BANK_ACCOUNT_NUMBER";
426
+ readonly US_BANK_ROUTING_NUMBER: "US_BANK_ROUTING_NUMBER";
427
+ readonly US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER: "US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER";
428
+ readonly US_PASSPORT_NUMBER: "US_PASSPORT_NUMBER";
429
+ readonly US_SOCIAL_SECURITY_NUMBER: "US_SOCIAL_SECURITY_NUMBER";
430
+ readonly VEHICLE_IDENTIFICATION_NUMBER: "VEHICLE_IDENTIFICATION_NUMBER";
431
+ };
432
+ export type GuardrailPiiEntityType =
433
+ (typeof GuardrailPiiEntityType)[keyof typeof GuardrailPiiEntityType];
434
+ export interface GuardrailPiiEntityFilter {
435
+ match: string | undefined;
436
+ type: GuardrailPiiEntityType | undefined;
437
+ action: GuardrailSensitiveInformationPolicyAction | undefined;
438
+ }
439
+ export interface GuardrailRegexFilter {
440
+ name?: string;
441
+ match?: string;
442
+ regex?: string;
443
+ action: GuardrailSensitiveInformationPolicyAction | undefined;
444
+ }
445
+ export interface GuardrailSensitiveInformationPolicyAssessment {
446
+ piiEntities: GuardrailPiiEntityFilter[] | undefined;
447
+ regexes: GuardrailRegexFilter[] | undefined;
448
+ }
449
+ export declare const GuardrailTopicPolicyAction: {
450
+ readonly BLOCKED: "BLOCKED";
451
+ };
452
+ export type GuardrailTopicPolicyAction =
453
+ (typeof GuardrailTopicPolicyAction)[keyof typeof GuardrailTopicPolicyAction];
454
+ export declare const GuardrailTopicType: {
455
+ readonly DENY: "DENY";
456
+ };
457
+ export type GuardrailTopicType =
458
+ (typeof GuardrailTopicType)[keyof typeof GuardrailTopicType];
459
+ export interface GuardrailTopic {
460
+ name: string | undefined;
461
+ type: GuardrailTopicType | undefined;
462
+ action: GuardrailTopicPolicyAction | undefined;
463
+ }
464
+ export interface GuardrailTopicPolicyAssessment {
465
+ topics: GuardrailTopic[] | undefined;
466
+ }
467
+ export declare const GuardrailWordPolicyAction: {
468
+ readonly BLOCKED: "BLOCKED";
469
+ };
470
+ export type GuardrailWordPolicyAction =
471
+ (typeof GuardrailWordPolicyAction)[keyof typeof GuardrailWordPolicyAction];
472
+ export interface GuardrailCustomWord {
473
+ match: string | undefined;
474
+ action: GuardrailWordPolicyAction | undefined;
475
+ }
476
+ export declare const GuardrailManagedWordType: {
477
+ readonly PROFANITY: "PROFANITY";
478
+ };
479
+ export type GuardrailManagedWordType =
480
+ (typeof GuardrailManagedWordType)[keyof typeof GuardrailManagedWordType];
481
+ export interface GuardrailManagedWord {
482
+ match: string | undefined;
483
+ type: GuardrailManagedWordType | undefined;
484
+ action: GuardrailWordPolicyAction | undefined;
485
+ }
486
+ export interface GuardrailWordPolicyAssessment {
487
+ customWords: GuardrailCustomWord[] | undefined;
488
+ managedWordLists: GuardrailManagedWord[] | undefined;
489
+ }
490
+ export interface GuardrailAssessment {
491
+ topicPolicy?: GuardrailTopicPolicyAssessment;
492
+ contentPolicy?: GuardrailContentPolicyAssessment;
493
+ wordPolicy?: GuardrailWordPolicyAssessment;
494
+ sensitiveInformationPolicy?: GuardrailSensitiveInformationPolicyAssessment;
495
+ }
496
+ export interface GuardrailTraceAssessment {
497
+ modelOutput?: string[];
498
+ inputAssessment?: Record<string, GuardrailAssessment>;
499
+ outputAssessments?: Record<string, GuardrailAssessment[]>;
500
+ }
501
+ export interface ConverseTrace {
502
+ guardrail?: GuardrailTraceAssessment;
503
+ }
301
504
  export interface TokenUsage {
302
505
  inputTokens: number | undefined;
303
506
  outputTokens: number | undefined;
@@ -309,6 +512,7 @@ export interface ConverseResponse {
309
512
  usage: TokenUsage | undefined;
310
513
  metrics: ConverseMetrics | undefined;
311
514
  additionalModelResponseFields?: __DocumentType;
515
+ trace?: ConverseTrace;
312
516
  }
313
517
  export declare class InternalServerException extends __BaseException {
314
518
  readonly name: "InternalServerException";
@@ -361,12 +565,25 @@ export declare class ValidationException extends __BaseException {
361
565
  opts: __ExceptionOptionType<ValidationException, __BaseException>
362
566
  );
363
567
  }
568
+ export declare const GuardrailStreamProcessingMode: {
569
+ readonly ASYNC: "async";
570
+ readonly SYNC: "sync";
571
+ };
572
+ export type GuardrailStreamProcessingMode =
573
+ (typeof GuardrailStreamProcessingMode)[keyof typeof GuardrailStreamProcessingMode];
574
+ export interface GuardrailStreamConfiguration {
575
+ guardrailIdentifier: string | undefined;
576
+ guardrailVersion: string | undefined;
577
+ trace?: GuardrailTrace;
578
+ streamProcessingMode?: GuardrailStreamProcessingMode;
579
+ }
364
580
  export interface ConverseStreamRequest {
365
581
  modelId: string | undefined;
366
582
  messages: Message[] | undefined;
367
583
  system?: SystemContentBlock[];
368
584
  inferenceConfig?: InferenceConfiguration;
369
585
  toolConfig?: ToolConfiguration;
586
+ guardrailConfig?: GuardrailStreamConfiguration;
370
587
  additionalModelRequestFields?: __DocumentType;
371
588
  additionalModelResponseFieldPaths?: string[];
372
589
  }
@@ -443,9 +660,13 @@ export interface MessageStopEvent {
443
660
  export interface ConverseStreamMetrics {
444
661
  latencyMs: number | undefined;
445
662
  }
663
+ export interface ConverseStreamTrace {
664
+ guardrail?: GuardrailTraceAssessment;
665
+ }
446
666
  export interface ConverseStreamMetadataEvent {
447
667
  usage: TokenUsage | undefined;
448
668
  metrics: ConverseStreamMetrics | undefined;
669
+ trace?: ConverseStreamTrace;
449
670
  }
450
671
  export declare class ModelStreamErrorException extends __BaseException {
451
672
  readonly name: "ModelStreamErrorException";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-bedrock-runtime",
3
3
  "description": "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
4
- "version": "3.598.0",
4
+ "version": "3.600.0",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
@@ -20,10 +20,10 @@
20
20
  "dependencies": {
21
21
  "@aws-crypto/sha256-browser": "5.2.0",
22
22
  "@aws-crypto/sha256-js": "5.2.0",
23
- "@aws-sdk/client-sso-oidc": "3.598.0",
24
- "@aws-sdk/client-sts": "3.598.0",
23
+ "@aws-sdk/client-sso-oidc": "3.600.0",
24
+ "@aws-sdk/client-sts": "3.600.0",
25
25
  "@aws-sdk/core": "3.598.0",
26
- "@aws-sdk/credential-provider-node": "3.598.0",
26
+ "@aws-sdk/credential-provider-node": "3.600.0",
27
27
  "@aws-sdk/middleware-host-header": "3.598.0",
28
28
  "@aws-sdk/middleware-logger": "3.598.0",
29
29
  "@aws-sdk/middleware-recursion-detection": "3.598.0",