@aws-sdk/client-bedrock-runtime 3.782.0 → 3.785.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.
- package/README.md +8 -0
- package/dist-cjs/index.js +232 -8
- package/dist-cjs/runtimeConfig.browser.js +2 -0
- package/dist-cjs/runtimeConfig.js +2 -0
- package/dist-cjs/runtimeConfig.native.js +3 -0
- package/dist-es/BedrockRuntime.js +2 -0
- package/dist-es/BedrockRuntimeClient.js +4 -2
- package/dist-es/commands/InvokeModelWithBidirectionalStreamCommand.js +30 -0
- package/dist-es/commands/index.js +1 -0
- package/dist-es/models/models_0.js +78 -0
- package/dist-es/protocols/Aws_restJson1.js +105 -2
- package/dist-es/runtimeConfig.browser.js +3 -1
- package/dist-es/runtimeConfig.js +2 -0
- package/dist-es/runtimeConfig.native.js +3 -0
- package/dist-types/BedrockRuntime.d.ts +7 -0
- package/dist-types/BedrockRuntimeClient.d.ts +12 -4
- package/dist-types/commands/ApplyGuardrailCommand.d.ts +15 -6
- package/dist-types/commands/ConverseCommand.d.ts +28 -13
- package/dist-types/commands/ConverseStreamCommand.d.ts +28 -13
- package/dist-types/commands/InvokeModelCommand.d.ts +1 -1
- package/dist-types/commands/InvokeModelWithBidirectionalStreamCommand.d.ts +144 -0
- package/dist-types/commands/InvokeModelWithResponseStreamCommand.d.ts +1 -1
- package/dist-types/commands/index.d.ts +1 -0
- package/dist-types/models/models_0.d.ts +302 -0
- package/dist-types/protocols/Aws_restJson1.d.ts +9 -0
- package/dist-types/runtimeConfig.browser.d.ts +1 -0
- package/dist-types/runtimeConfig.d.ts +1 -0
- package/dist-types/runtimeConfig.native.d.ts +1 -0
- package/dist-types/ts3.4/BedrockRuntime.d.ts +23 -0
- package/dist-types/ts3.4/BedrockRuntimeClient.d.ts +14 -0
- package/dist-types/ts3.4/commands/InvokeModelWithBidirectionalStreamCommand.d.ts +51 -0
- package/dist-types/ts3.4/commands/index.d.ts +1 -0
- package/dist-types/ts3.4/models/models_0.d.ts +179 -0
- package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +12 -0
- package/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -0
- package/dist-types/ts3.4/runtimeConfig.d.ts +1 -0
- package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -0
- package/package.json +3 -1
|
@@ -143,6 +143,10 @@ export var GuardrailContentBlock;
|
|
|
143
143
|
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
144
144
|
};
|
|
145
145
|
})(GuardrailContentBlock || (GuardrailContentBlock = {}));
|
|
146
|
+
export const GuardrailOutputScope = {
|
|
147
|
+
FULL: "FULL",
|
|
148
|
+
INTERVENTIONS: "INTERVENTIONS",
|
|
149
|
+
};
|
|
146
150
|
export const GuardrailContentSource = {
|
|
147
151
|
INPUT: "INPUT",
|
|
148
152
|
OUTPUT: "OUTPUT",
|
|
@@ -153,6 +157,7 @@ export const GuardrailAction = {
|
|
|
153
157
|
};
|
|
154
158
|
export const GuardrailContentPolicyAction = {
|
|
155
159
|
BLOCKED: "BLOCKED",
|
|
160
|
+
NONE: "NONE",
|
|
156
161
|
};
|
|
157
162
|
export const GuardrailContentFilterConfidence = {
|
|
158
163
|
HIGH: "HIGH",
|
|
@@ -185,6 +190,7 @@ export const GuardrailContextualGroundingFilterType = {
|
|
|
185
190
|
export const GuardrailSensitiveInformationPolicyAction = {
|
|
186
191
|
ANONYMIZED: "ANONYMIZED",
|
|
187
192
|
BLOCKED: "BLOCKED",
|
|
193
|
+
NONE: "NONE",
|
|
188
194
|
};
|
|
189
195
|
export const GuardrailPiiEntityType = {
|
|
190
196
|
ADDRESS: "ADDRESS",
|
|
@@ -221,12 +227,14 @@ export const GuardrailPiiEntityType = {
|
|
|
221
227
|
};
|
|
222
228
|
export const GuardrailTopicPolicyAction = {
|
|
223
229
|
BLOCKED: "BLOCKED",
|
|
230
|
+
NONE: "NONE",
|
|
224
231
|
};
|
|
225
232
|
export const GuardrailTopicType = {
|
|
226
233
|
DENY: "DENY",
|
|
227
234
|
};
|
|
228
235
|
export const GuardrailWordPolicyAction = {
|
|
229
236
|
BLOCKED: "BLOCKED",
|
|
237
|
+
NONE: "NONE",
|
|
230
238
|
};
|
|
231
239
|
export const GuardrailManagedWordType = {
|
|
232
240
|
PROFANITY: "PROFANITY",
|
|
@@ -234,6 +242,7 @@ export const GuardrailManagedWordType = {
|
|
|
234
242
|
export const GuardrailTrace = {
|
|
235
243
|
DISABLED: "disabled",
|
|
236
244
|
ENABLED: "enabled",
|
|
245
|
+
ENABLED_FULL: "enabled_full",
|
|
237
246
|
};
|
|
238
247
|
export const CachePointType = {
|
|
239
248
|
DEFAULT: "default",
|
|
@@ -571,7 +580,36 @@ export var ConverseStreamOutput;
|
|
|
571
580
|
export const Trace = {
|
|
572
581
|
DISABLED: "DISABLED",
|
|
573
582
|
ENABLED: "ENABLED",
|
|
583
|
+
ENABLED_FULL: "ENABLED_FULL",
|
|
574
584
|
};
|
|
585
|
+
export var InvokeModelWithBidirectionalStreamInput;
|
|
586
|
+
(function (InvokeModelWithBidirectionalStreamInput) {
|
|
587
|
+
InvokeModelWithBidirectionalStreamInput.visit = (value, visitor) => {
|
|
588
|
+
if (value.chunk !== undefined)
|
|
589
|
+
return visitor.chunk(value.chunk);
|
|
590
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
591
|
+
};
|
|
592
|
+
})(InvokeModelWithBidirectionalStreamInput || (InvokeModelWithBidirectionalStreamInput = {}));
|
|
593
|
+
export var InvokeModelWithBidirectionalStreamOutput;
|
|
594
|
+
(function (InvokeModelWithBidirectionalStreamOutput) {
|
|
595
|
+
InvokeModelWithBidirectionalStreamOutput.visit = (value, visitor) => {
|
|
596
|
+
if (value.chunk !== undefined)
|
|
597
|
+
return visitor.chunk(value.chunk);
|
|
598
|
+
if (value.internalServerException !== undefined)
|
|
599
|
+
return visitor.internalServerException(value.internalServerException);
|
|
600
|
+
if (value.modelStreamErrorException !== undefined)
|
|
601
|
+
return visitor.modelStreamErrorException(value.modelStreamErrorException);
|
|
602
|
+
if (value.validationException !== undefined)
|
|
603
|
+
return visitor.validationException(value.validationException);
|
|
604
|
+
if (value.throttlingException !== undefined)
|
|
605
|
+
return visitor.throttlingException(value.throttlingException);
|
|
606
|
+
if (value.modelTimeoutException !== undefined)
|
|
607
|
+
return visitor.modelTimeoutException(value.modelTimeoutException);
|
|
608
|
+
if (value.serviceUnavailableException !== undefined)
|
|
609
|
+
return visitor.serviceUnavailableException(value.serviceUnavailableException);
|
|
610
|
+
return visitor._(value.$unknown[0], value.$unknown[1]);
|
|
611
|
+
};
|
|
612
|
+
})(InvokeModelWithBidirectionalStreamOutput || (InvokeModelWithBidirectionalStreamOutput = {}));
|
|
575
613
|
export var ResponseStream;
|
|
576
614
|
(function (ResponseStream) {
|
|
577
615
|
ResponseStream.visit = (value, visitor) => {
|
|
@@ -788,6 +826,46 @@ export const InvokeModelResponseFilterSensitiveLog = (obj) => ({
|
|
|
788
826
|
...obj,
|
|
789
827
|
...(obj.body && { body: SENSITIVE_STRING }),
|
|
790
828
|
});
|
|
829
|
+
export const BidirectionalInputPayloadPartFilterSensitiveLog = (obj) => ({
|
|
830
|
+
...obj,
|
|
831
|
+
...(obj.bytes && { bytes: SENSITIVE_STRING }),
|
|
832
|
+
});
|
|
833
|
+
export const InvokeModelWithBidirectionalStreamInputFilterSensitiveLog = (obj) => {
|
|
834
|
+
if (obj.chunk !== undefined)
|
|
835
|
+
return { chunk: SENSITIVE_STRING };
|
|
836
|
+
if (obj.$unknown !== undefined)
|
|
837
|
+
return { [obj.$unknown[0]]: "UNKNOWN" };
|
|
838
|
+
};
|
|
839
|
+
export const InvokeModelWithBidirectionalStreamRequestFilterSensitiveLog = (obj) => ({
|
|
840
|
+
...obj,
|
|
841
|
+
...(obj.body && { body: "STREAMING_CONTENT" }),
|
|
842
|
+
});
|
|
843
|
+
export const BidirectionalOutputPayloadPartFilterSensitiveLog = (obj) => ({
|
|
844
|
+
...obj,
|
|
845
|
+
...(obj.bytes && { bytes: SENSITIVE_STRING }),
|
|
846
|
+
});
|
|
847
|
+
export const InvokeModelWithBidirectionalStreamOutputFilterSensitiveLog = (obj) => {
|
|
848
|
+
if (obj.chunk !== undefined)
|
|
849
|
+
return { chunk: SENSITIVE_STRING };
|
|
850
|
+
if (obj.internalServerException !== undefined)
|
|
851
|
+
return { internalServerException: obj.internalServerException };
|
|
852
|
+
if (obj.modelStreamErrorException !== undefined)
|
|
853
|
+
return { modelStreamErrorException: obj.modelStreamErrorException };
|
|
854
|
+
if (obj.validationException !== undefined)
|
|
855
|
+
return { validationException: obj.validationException };
|
|
856
|
+
if (obj.throttlingException !== undefined)
|
|
857
|
+
return { throttlingException: obj.throttlingException };
|
|
858
|
+
if (obj.modelTimeoutException !== undefined)
|
|
859
|
+
return { modelTimeoutException: obj.modelTimeoutException };
|
|
860
|
+
if (obj.serviceUnavailableException !== undefined)
|
|
861
|
+
return { serviceUnavailableException: obj.serviceUnavailableException };
|
|
862
|
+
if (obj.$unknown !== undefined)
|
|
863
|
+
return { [obj.$unknown[0]]: "UNKNOWN" };
|
|
864
|
+
};
|
|
865
|
+
export const InvokeModelWithBidirectionalStreamResponseFilterSensitiveLog = (obj) => ({
|
|
866
|
+
...obj,
|
|
867
|
+
...(obj.body && { body: "STREAMING_CONTENT" }),
|
|
868
|
+
});
|
|
791
869
|
export const InvokeModelWithResponseStreamRequestFilterSensitiveLog = (obj) => ({
|
|
792
870
|
...obj,
|
|
793
871
|
...(obj.body && { body: SENSITIVE_STRING }),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { awsExpectUnion as __expectUnion, loadRestJsonErrorCode, parseJsonBody as parseBody, parseJsonErrorBody as parseErrorBody, } from "@aws-sdk/core";
|
|
2
2
|
import { requestBuilder as rb } from "@smithy/core";
|
|
3
|
-
import { _json, collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, isSerializableHeaderValue, limitedParseDouble as __limitedParseDouble, map, parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, serializeDateTime as __serializeDateTime, serializeFloat as __serializeFloat, take, withBaseException, } from "@smithy/smithy-client";
|
|
3
|
+
import { _json, collectBody, decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, isSerializableHeaderValue, limitedParseDouble as __limitedParseDouble, map, parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, serializeDateTime as __serializeDateTime, serializeFloat as __serializeFloat, take, withBaseException, } from "@smithy/smithy-client";
|
|
4
4
|
import { v4 as generateIdempotencyToken } from "uuid";
|
|
5
5
|
import { BedrockRuntimeServiceException as __BaseException } from "../models/BedrockRuntimeServiceException";
|
|
6
|
-
import { AccessDeniedException, ConflictException, ContentBlock, DocumentSource, GuardrailContentBlock, GuardrailConverseContentBlock, GuardrailConverseImageSource, GuardrailImageSource, ImageSource, InternalServerException, ModelErrorException, ModelNotReadyException, ModelStreamErrorException, ModelTimeoutException, ReasoningContentBlock, ResourceNotFoundException, ServiceQuotaExceededException, ServiceUnavailableException, SystemContentBlock, ThrottlingException, Tool, ToolInputSchema, ToolResultContentBlock, ValidationException, VideoSource, } from "../models/models_0";
|
|
6
|
+
import { AccessDeniedException, ConflictException, ContentBlock, DocumentSource, GuardrailContentBlock, GuardrailConverseContentBlock, GuardrailConverseImageSource, GuardrailImageSource, ImageSource, InternalServerException, InvokeModelWithBidirectionalStreamInput, ModelErrorException, ModelNotReadyException, ModelStreamErrorException, ModelTimeoutException, ReasoningContentBlock, ResourceNotFoundException, ServiceQuotaExceededException, ServiceUnavailableException, SystemContentBlock, ThrottlingException, Tool, ToolInputSchema, ToolResultContentBlock, ValidationException, VideoSource, } from "../models/models_0";
|
|
7
7
|
export const se_ApplyGuardrailCommand = async (input, context) => {
|
|
8
8
|
const b = rb(input, context);
|
|
9
9
|
const headers = {
|
|
@@ -15,6 +15,7 @@ export const se_ApplyGuardrailCommand = async (input, context) => {
|
|
|
15
15
|
let body;
|
|
16
16
|
body = JSON.stringify(take(input, {
|
|
17
17
|
content: (_) => se_GuardrailContentBlockList(_, context),
|
|
18
|
+
outputScope: [],
|
|
18
19
|
source: [],
|
|
19
20
|
}));
|
|
20
21
|
b.m("POST").h(headers).b(body);
|
|
@@ -94,6 +95,20 @@ export const se_InvokeModelCommand = async (input, context) => {
|
|
|
94
95
|
b.m("POST").h(headers).b(body);
|
|
95
96
|
return b.build();
|
|
96
97
|
};
|
|
98
|
+
export const se_InvokeModelWithBidirectionalStreamCommand = async (input, context) => {
|
|
99
|
+
const b = rb(input, context);
|
|
100
|
+
const headers = {
|
|
101
|
+
"content-type": "application/json",
|
|
102
|
+
};
|
|
103
|
+
b.bp("/model/{modelId}/invoke-with-bidirectional-stream");
|
|
104
|
+
b.p("modelId", () => input.modelId, "{modelId}", false);
|
|
105
|
+
let body;
|
|
106
|
+
if (input.body !== undefined) {
|
|
107
|
+
body = se_InvokeModelWithBidirectionalStreamInput(input.body, context);
|
|
108
|
+
}
|
|
109
|
+
b.m("POST").h(headers).b(body);
|
|
110
|
+
return b.build();
|
|
111
|
+
};
|
|
97
112
|
export const se_InvokeModelWithResponseStreamCommand = async (input, context) => {
|
|
98
113
|
const b = rb(input, context);
|
|
99
114
|
const headers = map({}, isSerializableHeaderValue, {
|
|
@@ -157,6 +172,7 @@ export const de_ApplyGuardrailCommand = async (output, context) => {
|
|
|
157
172
|
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
158
173
|
const doc = take(data, {
|
|
159
174
|
action: __expectString,
|
|
175
|
+
actionReason: __expectString,
|
|
160
176
|
assessments: (_) => de_GuardrailAssessmentList(_, context),
|
|
161
177
|
guardrailCoverage: _json,
|
|
162
178
|
outputs: _json,
|
|
@@ -231,6 +247,17 @@ export const de_InvokeModelCommand = async (output, context) => {
|
|
|
231
247
|
contents.body = data;
|
|
232
248
|
return contents;
|
|
233
249
|
};
|
|
250
|
+
export const de_InvokeModelWithBidirectionalStreamCommand = async (output, context) => {
|
|
251
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
252
|
+
return de_CommandError(output, context);
|
|
253
|
+
}
|
|
254
|
+
const contents = map({
|
|
255
|
+
$metadata: deserializeMetadata(output),
|
|
256
|
+
});
|
|
257
|
+
const data = output.body;
|
|
258
|
+
contents.body = de_InvokeModelWithBidirectionalStreamOutput(data, context);
|
|
259
|
+
return contents;
|
|
260
|
+
};
|
|
234
261
|
export const de_InvokeModelWithResponseStreamCommand = async (output, context) => {
|
|
235
262
|
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
236
263
|
return de_CommandError(output, context);
|
|
@@ -486,6 +513,24 @@ const de_ValidationExceptionRes = async (parsedOutput, context) => {
|
|
|
486
513
|
});
|
|
487
514
|
return __decorateServiceException(exception, parsedOutput.body);
|
|
488
515
|
};
|
|
516
|
+
const se_InvokeModelWithBidirectionalStreamInput = (input, context) => {
|
|
517
|
+
const eventMarshallingVisitor = (event) => InvokeModelWithBidirectionalStreamInput.visit(event, {
|
|
518
|
+
chunk: (value) => se_BidirectionalInputPayloadPart_event(value, context),
|
|
519
|
+
_: (value) => value,
|
|
520
|
+
});
|
|
521
|
+
return context.eventStreamMarshaller.serialize(input, eventMarshallingVisitor);
|
|
522
|
+
};
|
|
523
|
+
const se_BidirectionalInputPayloadPart_event = (input, context) => {
|
|
524
|
+
const headers = {
|
|
525
|
+
":event-type": { type: "string", value: "chunk" },
|
|
526
|
+
":message-type": { type: "string", value: "event" },
|
|
527
|
+
":content-type": { type: "string", value: "application/json" },
|
|
528
|
+
};
|
|
529
|
+
let body = new Uint8Array();
|
|
530
|
+
body = se_BidirectionalInputPayloadPart(input, context);
|
|
531
|
+
body = context.utf8Decoder(JSON.stringify(body));
|
|
532
|
+
return { headers, body };
|
|
533
|
+
};
|
|
489
534
|
const de_ConverseStreamOutput = (output, context) => {
|
|
490
535
|
return context.eventStreamMarshaller.deserialize(output, async (event) => {
|
|
491
536
|
if (event["messageStart"] != null) {
|
|
@@ -546,6 +591,46 @@ const de_ConverseStreamOutput = (output, context) => {
|
|
|
546
591
|
return { $unknown: output };
|
|
547
592
|
});
|
|
548
593
|
};
|
|
594
|
+
const de_InvokeModelWithBidirectionalStreamOutput = (output, context) => {
|
|
595
|
+
return context.eventStreamMarshaller.deserialize(output, async (event) => {
|
|
596
|
+
if (event["chunk"] != null) {
|
|
597
|
+
return {
|
|
598
|
+
chunk: await de_BidirectionalOutputPayloadPart_event(event["chunk"], context),
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
if (event["internalServerException"] != null) {
|
|
602
|
+
return {
|
|
603
|
+
internalServerException: await de_InternalServerException_event(event["internalServerException"], context),
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
if (event["modelStreamErrorException"] != null) {
|
|
607
|
+
return {
|
|
608
|
+
modelStreamErrorException: await de_ModelStreamErrorException_event(event["modelStreamErrorException"], context),
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
if (event["validationException"] != null) {
|
|
612
|
+
return {
|
|
613
|
+
validationException: await de_ValidationException_event(event["validationException"], context),
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
if (event["throttlingException"] != null) {
|
|
617
|
+
return {
|
|
618
|
+
throttlingException: await de_ThrottlingException_event(event["throttlingException"], context),
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
if (event["modelTimeoutException"] != null) {
|
|
622
|
+
return {
|
|
623
|
+
modelTimeoutException: await de_ModelTimeoutException_event(event["modelTimeoutException"], context),
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
if (event["serviceUnavailableException"] != null) {
|
|
627
|
+
return {
|
|
628
|
+
serviceUnavailableException: await de_ServiceUnavailableException_event(event["serviceUnavailableException"], context),
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
return { $unknown: output };
|
|
632
|
+
});
|
|
633
|
+
};
|
|
549
634
|
const de_ResponseStream = (output, context) => {
|
|
550
635
|
return context.eventStreamMarshaller.deserialize(output, async (event) => {
|
|
551
636
|
if (event["chunk"] != null) {
|
|
@@ -586,6 +671,12 @@ const de_ResponseStream = (output, context) => {
|
|
|
586
671
|
return { $unknown: output };
|
|
587
672
|
});
|
|
588
673
|
};
|
|
674
|
+
const de_BidirectionalOutputPayloadPart_event = async (output, context) => {
|
|
675
|
+
const contents = {};
|
|
676
|
+
const data = await parseBody(output.body, context);
|
|
677
|
+
Object.assign(contents, de_BidirectionalOutputPayloadPart(data, context));
|
|
678
|
+
return contents;
|
|
679
|
+
};
|
|
589
680
|
const de_ContentBlockDeltaEvent_event = async (output, context) => {
|
|
590
681
|
const contents = {};
|
|
591
682
|
const data = await parseBody(output.body, context);
|
|
@@ -670,6 +761,11 @@ const de_ValidationException_event = async (output, context) => {
|
|
|
670
761
|
};
|
|
671
762
|
return de_ValidationExceptionRes(parsedOutput, context);
|
|
672
763
|
};
|
|
764
|
+
const se_BidirectionalInputPayloadPart = (input, context) => {
|
|
765
|
+
return take(input, {
|
|
766
|
+
bytes: context.base64Encoder,
|
|
767
|
+
});
|
|
768
|
+
};
|
|
673
769
|
const se_ContentBlock = (input, context) => {
|
|
674
770
|
return ContentBlock.visit(input, {
|
|
675
771
|
cachePoint: (value) => ({ cachePoint: _json(value) }),
|
|
@@ -908,6 +1004,11 @@ const de_AsyncInvokeSummary = (output, context) => {
|
|
|
908
1004
|
submitTime: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
|
|
909
1005
|
});
|
|
910
1006
|
};
|
|
1007
|
+
const de_BidirectionalOutputPayloadPart = (output, context) => {
|
|
1008
|
+
return take(output, {
|
|
1009
|
+
bytes: context.base64Decoder,
|
|
1010
|
+
});
|
|
1011
|
+
};
|
|
911
1012
|
const de_ContentBlock = (output, context) => {
|
|
912
1013
|
if (output.cachePoint != null) {
|
|
913
1014
|
return {
|
|
@@ -1066,6 +1167,7 @@ const de_GuardrailAssessmentMap = (output, context) => {
|
|
|
1066
1167
|
const de_GuardrailContextualGroundingFilter = (output, context) => {
|
|
1067
1168
|
return take(output, {
|
|
1068
1169
|
action: __expectString,
|
|
1170
|
+
detected: __expectBoolean,
|
|
1069
1171
|
score: __limitedParseDouble,
|
|
1070
1172
|
threshold: __limitedParseDouble,
|
|
1071
1173
|
type: __expectString,
|
|
@@ -1113,6 +1215,7 @@ const de_GuardrailConverseImageSource = (output, context) => {
|
|
|
1113
1215
|
};
|
|
1114
1216
|
const de_GuardrailTraceAssessment = (output, context) => {
|
|
1115
1217
|
return take(output, {
|
|
1218
|
+
actionReason: __expectString,
|
|
1116
1219
|
inputAssessment: (_) => de_GuardrailAssessmentMap(_, context),
|
|
1117
1220
|
modelOutput: _json,
|
|
1118
1221
|
outputAssessments: (_) => de_GuardrailAssessmentListMap(_, context),
|
|
@@ -4,7 +4,7 @@ import { createDefaultUserAgentProvider } from "@aws-sdk/util-user-agent-browser
|
|
|
4
4
|
import { DEFAULT_USE_DUALSTACK_ENDPOINT, DEFAULT_USE_FIPS_ENDPOINT } from "@smithy/config-resolver";
|
|
5
5
|
import { eventStreamSerdeProvider } from "@smithy/eventstream-serde-browser";
|
|
6
6
|
import { FetchHttpHandler as RequestHandler, streamCollector } from "@smithy/fetch-http-handler";
|
|
7
|
-
import { invalidProvider } from "@smithy/invalid-dependency";
|
|
7
|
+
import { invalidFunction, invalidProvider } from "@smithy/invalid-dependency";
|
|
8
8
|
import { calculateBodyLength } from "@smithy/util-body-length-browser";
|
|
9
9
|
import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@smithy/util-retry";
|
|
10
10
|
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
|
@@ -23,6 +23,8 @@ export const getRuntimeConfig = (config) => {
|
|
|
23
23
|
credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
|
|
24
24
|
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
25
25
|
createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
26
|
+
eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ??
|
|
27
|
+
(() => ({ handle: invalidFunction("event stream request is not supported in browser.") })),
|
|
26
28
|
eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventStreamSerdeProvider,
|
|
27
29
|
maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
|
|
28
30
|
region: config?.region ?? invalidProvider("Region is missing"),
|
package/dist-es/runtimeConfig.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import packageInfo from "../package.json";
|
|
2
2
|
import { emitWarningIfUnsupportedVersion as awsCheckVersion } from "@aws-sdk/core";
|
|
3
3
|
import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node";
|
|
4
|
+
import { eventStreamPayloadHandlerProvider } from "@aws-sdk/eventstream-handler-node";
|
|
4
5
|
import { NODE_APP_ID_CONFIG_OPTIONS, createDefaultUserAgentProvider } from "@aws-sdk/util-user-agent-node";
|
|
5
6
|
import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, } from "@smithy/config-resolver";
|
|
6
7
|
import { eventStreamSerdeProvider } from "@smithy/eventstream-serde-node";
|
|
@@ -30,6 +31,7 @@ export const getRuntimeConfig = (config) => {
|
|
|
30
31
|
credentialDefaultProvider: config?.credentialDefaultProvider ?? credentialDefaultProvider,
|
|
31
32
|
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
32
33
|
createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
34
|
+
eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ?? eventStreamPayloadHandlerProvider,
|
|
33
35
|
eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventStreamSerdeProvider,
|
|
34
36
|
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
|
|
35
37
|
region: config?.region ??
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Sha256 } from "@aws-crypto/sha256-js";
|
|
2
|
+
import { invalidFunction } from "@smithy/invalid-dependency";
|
|
2
3
|
import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser";
|
|
3
4
|
export const getRuntimeConfig = (config) => {
|
|
4
5
|
const browserDefaults = getBrowserRuntimeConfig(config);
|
|
@@ -6,6 +7,8 @@ export const getRuntimeConfig = (config) => {
|
|
|
6
7
|
...browserDefaults,
|
|
7
8
|
...config,
|
|
8
9
|
runtime: "react-native",
|
|
10
|
+
eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ??
|
|
11
|
+
(() => ({ handle: invalidFunction("event stream request is not supported in ReactNative.") })),
|
|
9
12
|
sha256: config?.sha256 ?? Sha256,
|
|
10
13
|
};
|
|
11
14
|
};
|
|
@@ -5,6 +5,7 @@ import { ConverseCommandInput, ConverseCommandOutput } from "./commands/Converse
|
|
|
5
5
|
import { ConverseStreamCommandInput, ConverseStreamCommandOutput } from "./commands/ConverseStreamCommand";
|
|
6
6
|
import { GetAsyncInvokeCommandInput, GetAsyncInvokeCommandOutput } from "./commands/GetAsyncInvokeCommand";
|
|
7
7
|
import { InvokeModelCommandInput, InvokeModelCommandOutput } from "./commands/InvokeModelCommand";
|
|
8
|
+
import { InvokeModelWithBidirectionalStreamCommandInput, InvokeModelWithBidirectionalStreamCommandOutput } from "./commands/InvokeModelWithBidirectionalStreamCommand";
|
|
8
9
|
import { InvokeModelWithResponseStreamCommandInput, InvokeModelWithResponseStreamCommandOutput } from "./commands/InvokeModelWithResponseStreamCommand";
|
|
9
10
|
import { ListAsyncInvokesCommandInput, ListAsyncInvokesCommandOutput } from "./commands/ListAsyncInvokesCommand";
|
|
10
11
|
import { StartAsyncInvokeCommandInput, StartAsyncInvokeCommandOutput } from "./commands/StartAsyncInvokeCommand";
|
|
@@ -39,6 +40,12 @@ export interface BedrockRuntime {
|
|
|
39
40
|
invokeModel(args: InvokeModelCommandInput, options?: __HttpHandlerOptions): Promise<InvokeModelCommandOutput>;
|
|
40
41
|
invokeModel(args: InvokeModelCommandInput, cb: (err: any, data?: InvokeModelCommandOutput) => void): void;
|
|
41
42
|
invokeModel(args: InvokeModelCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: InvokeModelCommandOutput) => void): void;
|
|
43
|
+
/**
|
|
44
|
+
* @see {@link InvokeModelWithBidirectionalStreamCommand}
|
|
45
|
+
*/
|
|
46
|
+
invokeModelWithBidirectionalStream(args: InvokeModelWithBidirectionalStreamCommandInput, options?: __HttpHandlerOptions): Promise<InvokeModelWithBidirectionalStreamCommandOutput>;
|
|
47
|
+
invokeModelWithBidirectionalStream(args: InvokeModelWithBidirectionalStreamCommandInput, cb: (err: any, data?: InvokeModelWithBidirectionalStreamCommandOutput) => void): void;
|
|
48
|
+
invokeModelWithBidirectionalStream(args: InvokeModelWithBidirectionalStreamCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: InvokeModelWithBidirectionalStreamCommandOutput) => void): void;
|
|
42
49
|
/**
|
|
43
50
|
* @see {@link InvokeModelWithResponseStreamCommand}
|
|
44
51
|
*/
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { EventStreamInputConfig, EventStreamResolvedConfig } from "@aws-sdk/middleware-eventstream";
|
|
1
2
|
import { HostHeaderInputConfig, HostHeaderResolvedConfig } from "@aws-sdk/middleware-host-header";
|
|
2
3
|
import { UserAgentInputConfig, UserAgentResolvedConfig } from "@aws-sdk/middleware-user-agent";
|
|
4
|
+
import { EventStreamPayloadHandlerProvider as __EventStreamPayloadHandlerProvider } from "@aws-sdk/types";
|
|
3
5
|
import { RegionInputConfig, RegionResolvedConfig } from "@smithy/config-resolver";
|
|
4
6
|
import { EventStreamSerdeInputConfig, EventStreamSerdeResolvedConfig } from "@smithy/eventstream-serde-config-resolver";
|
|
5
7
|
import { EndpointInputConfig, EndpointResolvedConfig } from "@smithy/middleware-endpoint";
|
|
@@ -13,6 +15,7 @@ import { ConverseCommandInput, ConverseCommandOutput } from "./commands/Converse
|
|
|
13
15
|
import { ConverseStreamCommandInput, ConverseStreamCommandOutput } from "./commands/ConverseStreamCommand";
|
|
14
16
|
import { GetAsyncInvokeCommandInput, GetAsyncInvokeCommandOutput } from "./commands/GetAsyncInvokeCommand";
|
|
15
17
|
import { InvokeModelCommandInput, InvokeModelCommandOutput } from "./commands/InvokeModelCommand";
|
|
18
|
+
import { InvokeModelWithBidirectionalStreamCommandInput, InvokeModelWithBidirectionalStreamCommandOutput } from "./commands/InvokeModelWithBidirectionalStreamCommand";
|
|
16
19
|
import { InvokeModelWithResponseStreamCommandInput, InvokeModelWithResponseStreamCommandOutput } from "./commands/InvokeModelWithResponseStreamCommand";
|
|
17
20
|
import { ListAsyncInvokesCommandInput, ListAsyncInvokesCommandOutput } from "./commands/ListAsyncInvokesCommand";
|
|
18
21
|
import { StartAsyncInvokeCommandInput, StartAsyncInvokeCommandOutput } from "./commands/StartAsyncInvokeCommand";
|
|
@@ -22,11 +25,11 @@ export { __Client };
|
|
|
22
25
|
/**
|
|
23
26
|
* @public
|
|
24
27
|
*/
|
|
25
|
-
export type ServiceInputTypes = ApplyGuardrailCommandInput | ConverseCommandInput | ConverseStreamCommandInput | GetAsyncInvokeCommandInput | InvokeModelCommandInput | InvokeModelWithResponseStreamCommandInput | ListAsyncInvokesCommandInput | StartAsyncInvokeCommandInput;
|
|
28
|
+
export type ServiceInputTypes = ApplyGuardrailCommandInput | ConverseCommandInput | ConverseStreamCommandInput | GetAsyncInvokeCommandInput | InvokeModelCommandInput | InvokeModelWithBidirectionalStreamCommandInput | InvokeModelWithResponseStreamCommandInput | ListAsyncInvokesCommandInput | StartAsyncInvokeCommandInput;
|
|
26
29
|
/**
|
|
27
30
|
* @public
|
|
28
31
|
*/
|
|
29
|
-
export type ServiceOutputTypes = ApplyGuardrailCommandOutput | ConverseCommandOutput | ConverseStreamCommandOutput | GetAsyncInvokeCommandOutput | InvokeModelCommandOutput | InvokeModelWithResponseStreamCommandOutput | ListAsyncInvokesCommandOutput | StartAsyncInvokeCommandOutput;
|
|
32
|
+
export type ServiceOutputTypes = ApplyGuardrailCommandOutput | ConverseCommandOutput | ConverseStreamCommandOutput | GetAsyncInvokeCommandOutput | InvokeModelCommandOutput | InvokeModelWithBidirectionalStreamCommandOutput | InvokeModelWithResponseStreamCommandOutput | ListAsyncInvokesCommandOutput | StartAsyncInvokeCommandOutput;
|
|
30
33
|
/**
|
|
31
34
|
* @public
|
|
32
35
|
*/
|
|
@@ -158,11 +161,16 @@ export interface ClientDefaults extends Partial<__SmithyConfiguration<__HttpHand
|
|
|
158
161
|
* The {@link @smithy/smithy-client#DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK.
|
|
159
162
|
*/
|
|
160
163
|
defaultsMode?: __DefaultsMode | __Provider<__DefaultsMode>;
|
|
164
|
+
/**
|
|
165
|
+
* The function that provides necessary utilities for handling request event stream.
|
|
166
|
+
* @internal
|
|
167
|
+
*/
|
|
168
|
+
eventStreamPayloadHandlerProvider?: __EventStreamPayloadHandlerProvider;
|
|
161
169
|
}
|
|
162
170
|
/**
|
|
163
171
|
* @public
|
|
164
172
|
*/
|
|
165
|
-
export type BedrockRuntimeClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & ClientDefaults & UserAgentInputConfig & RetryInputConfig & RegionInputConfig & HostHeaderInputConfig & EndpointInputConfig<EndpointParameters> & EventStreamSerdeInputConfig & HttpAuthSchemeInputConfig & ClientInputEndpointParameters;
|
|
173
|
+
export type BedrockRuntimeClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & ClientDefaults & UserAgentInputConfig & RetryInputConfig & RegionInputConfig & HostHeaderInputConfig & EndpointInputConfig<EndpointParameters> & EventStreamSerdeInputConfig & HttpAuthSchemeInputConfig & EventStreamInputConfig & ClientInputEndpointParameters;
|
|
166
174
|
/**
|
|
167
175
|
* @public
|
|
168
176
|
*
|
|
@@ -173,7 +181,7 @@ export interface BedrockRuntimeClientConfig extends BedrockRuntimeClientConfigTy
|
|
|
173
181
|
/**
|
|
174
182
|
* @public
|
|
175
183
|
*/
|
|
176
|
-
export type BedrockRuntimeClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & Required<ClientDefaults> & RuntimeExtensionsConfig & UserAgentResolvedConfig & RetryResolvedConfig & RegionResolvedConfig & HostHeaderResolvedConfig & EndpointResolvedConfig<EndpointParameters> & EventStreamSerdeResolvedConfig & HttpAuthSchemeResolvedConfig & ClientResolvedEndpointParameters;
|
|
184
|
+
export type BedrockRuntimeClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> & Required<ClientDefaults> & RuntimeExtensionsConfig & UserAgentResolvedConfig & RetryResolvedConfig & RegionResolvedConfig & HostHeaderResolvedConfig & EndpointResolvedConfig<EndpointParameters> & EventStreamSerdeResolvedConfig & HttpAuthSchemeResolvedConfig & EventStreamResolvedConfig & ClientResolvedEndpointParameters;
|
|
177
185
|
/**
|
|
178
186
|
* @public
|
|
179
187
|
*
|
|
@@ -56,6 +56,7 @@ declare const ApplyGuardrailCommand_base: {
|
|
|
56
56
|
* },
|
|
57
57
|
* },
|
|
58
58
|
* ],
|
|
59
|
+
* outputScope: "INTERVENTIONS" || "FULL",
|
|
59
60
|
* };
|
|
60
61
|
* const command = new ApplyGuardrailCommand(input);
|
|
61
62
|
* const response = await client.send(command);
|
|
@@ -70,6 +71,7 @@ declare const ApplyGuardrailCommand_base: {
|
|
|
70
71
|
* // contentPolicyImageUnits: Number("int"),
|
|
71
72
|
* // },
|
|
72
73
|
* // action: "NONE" || "GUARDRAIL_INTERVENED", // required
|
|
74
|
+
* // actionReason: "STRING_VALUE",
|
|
73
75
|
* // outputs: [ // GuardrailOutputContentList // required
|
|
74
76
|
* // { // GuardrailOutputContent
|
|
75
77
|
* // text: "STRING_VALUE",
|
|
@@ -82,7 +84,8 @@ declare const ApplyGuardrailCommand_base: {
|
|
|
82
84
|
* // { // GuardrailTopic
|
|
83
85
|
* // name: "STRING_VALUE", // required
|
|
84
86
|
* // type: "DENY", // required
|
|
85
|
-
* // action: "BLOCKED", // required
|
|
87
|
+
* // action: "BLOCKED" || "NONE", // required
|
|
88
|
+
* // detected: true || false,
|
|
86
89
|
* // },
|
|
87
90
|
* // ],
|
|
88
91
|
* // },
|
|
@@ -92,7 +95,8 @@ declare const ApplyGuardrailCommand_base: {
|
|
|
92
95
|
* // type: "INSULTS" || "HATE" || "SEXUAL" || "VIOLENCE" || "MISCONDUCT" || "PROMPT_ATTACK", // required
|
|
93
96
|
* // confidence: "NONE" || "LOW" || "MEDIUM" || "HIGH", // required
|
|
94
97
|
* // filterStrength: "NONE" || "LOW" || "MEDIUM" || "HIGH",
|
|
95
|
-
* // action: "BLOCKED", // required
|
|
98
|
+
* // action: "BLOCKED" || "NONE", // required
|
|
99
|
+
* // detected: true || false,
|
|
96
100
|
* // },
|
|
97
101
|
* // ],
|
|
98
102
|
* // },
|
|
@@ -100,14 +104,16 @@ declare const ApplyGuardrailCommand_base: {
|
|
|
100
104
|
* // customWords: [ // GuardrailCustomWordList // required
|
|
101
105
|
* // { // GuardrailCustomWord
|
|
102
106
|
* // match: "STRING_VALUE", // required
|
|
103
|
-
* // action: "BLOCKED", // required
|
|
107
|
+
* // action: "BLOCKED" || "NONE", // required
|
|
108
|
+
* // detected: true || false,
|
|
104
109
|
* // },
|
|
105
110
|
* // ],
|
|
106
111
|
* // managedWordLists: [ // GuardrailManagedWordList // required
|
|
107
112
|
* // { // GuardrailManagedWord
|
|
108
113
|
* // match: "STRING_VALUE", // required
|
|
109
114
|
* // type: "PROFANITY", // required
|
|
110
|
-
* // action: "BLOCKED", // required
|
|
115
|
+
* // action: "BLOCKED" || "NONE", // required
|
|
116
|
+
* // detected: true || false,
|
|
111
117
|
* // },
|
|
112
118
|
* // ],
|
|
113
119
|
* // },
|
|
@@ -116,7 +122,8 @@ declare const ApplyGuardrailCommand_base: {
|
|
|
116
122
|
* // { // GuardrailPiiEntityFilter
|
|
117
123
|
* // match: "STRING_VALUE", // required
|
|
118
124
|
* // type: "ADDRESS" || "AGE" || "AWS_ACCESS_KEY" || "AWS_SECRET_KEY" || "CA_HEALTH_NUMBER" || "CA_SOCIAL_INSURANCE_NUMBER" || "CREDIT_DEBIT_CARD_CVV" || "CREDIT_DEBIT_CARD_EXPIRY" || "CREDIT_DEBIT_CARD_NUMBER" || "DRIVER_ID" || "EMAIL" || "INTERNATIONAL_BANK_ACCOUNT_NUMBER" || "IP_ADDRESS" || "LICENSE_PLATE" || "MAC_ADDRESS" || "NAME" || "PASSWORD" || "PHONE" || "PIN" || "SWIFT_CODE" || "UK_NATIONAL_HEALTH_SERVICE_NUMBER" || "UK_NATIONAL_INSURANCE_NUMBER" || "UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER" || "URL" || "USERNAME" || "US_BANK_ACCOUNT_NUMBER" || "US_BANK_ROUTING_NUMBER" || "US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER" || "US_PASSPORT_NUMBER" || "US_SOCIAL_SECURITY_NUMBER" || "VEHICLE_IDENTIFICATION_NUMBER", // required
|
|
119
|
-
* // action: "ANONYMIZED" || "BLOCKED", // required
|
|
125
|
+
* // action: "ANONYMIZED" || "BLOCKED" || "NONE", // required
|
|
126
|
+
* // detected: true || false,
|
|
120
127
|
* // },
|
|
121
128
|
* // ],
|
|
122
129
|
* // regexes: [ // GuardrailRegexFilterList // required
|
|
@@ -124,7 +131,8 @@ declare const ApplyGuardrailCommand_base: {
|
|
|
124
131
|
* // name: "STRING_VALUE",
|
|
125
132
|
* // match: "STRING_VALUE",
|
|
126
133
|
* // regex: "STRING_VALUE",
|
|
127
|
-
* // action: "ANONYMIZED" || "BLOCKED", // required
|
|
134
|
+
* // action: "ANONYMIZED" || "BLOCKED" || "NONE", // required
|
|
135
|
+
* // detected: true || false,
|
|
128
136
|
* // },
|
|
129
137
|
* // ],
|
|
130
138
|
* // },
|
|
@@ -135,6 +143,7 @@ declare const ApplyGuardrailCommand_base: {
|
|
|
135
143
|
* // threshold: Number("double"), // required
|
|
136
144
|
* // score: Number("double"), // required
|
|
137
145
|
* // action: "BLOCKED" || "NONE", // required
|
|
146
|
+
* // detected: true || false,
|
|
138
147
|
* // },
|
|
139
148
|
* // ],
|
|
140
149
|
* // },
|