@aws-sdk/client-bedrock-runtime 3.704.0 → 3.706.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 +31 -7
- package/dist-cjs/index.js +711 -135
- package/dist-es/BedrockRuntime.js +6 -0
- package/dist-es/commands/ApplyGuardrailCommand.js +2 -1
- package/dist-es/commands/ConverseCommand.js +2 -2
- package/dist-es/commands/GetAsyncInvokeCommand.js +23 -0
- package/dist-es/commands/ListAsyncInvokesCommand.js +23 -0
- package/dist-es/commands/StartAsyncInvokeCommand.js +23 -0
- package/dist-es/commands/index.js +3 -0
- package/dist-es/index.js +1 -0
- package/dist-es/models/models_0.js +264 -76
- package/dist-es/pagination/Interfaces.js +1 -0
- package/dist-es/pagination/ListAsyncInvokesPaginator.js +4 -0
- package/dist-es/pagination/index.js +2 -0
- package/dist-es/protocols/Aws_restJson1.js +283 -7
- package/dist-types/BedrockRuntime.d.ts +22 -0
- package/dist-types/BedrockRuntimeClient.d.ts +5 -2
- package/dist-types/commands/ApplyGuardrailCommand.d.ts +16 -0
- package/dist-types/commands/ConverseCommand.d.ts +72 -0
- package/dist-types/commands/ConverseStreamCommand.d.ts +46 -0
- package/dist-types/commands/GetAsyncInvokeCommand.d.ts +101 -0
- package/dist-types/commands/ListAsyncInvokesCommand.d.ts +112 -0
- package/dist-types/commands/StartAsyncInvokeCommand.d.ts +124 -0
- package/dist-types/commands/index.d.ts +3 -0
- package/dist-types/index.d.ts +1 -0
- package/dist-types/models/models_0.d.ts +828 -119
- package/dist-types/pagination/Interfaces.d.ts +8 -0
- package/dist-types/pagination/ListAsyncInvokesPaginator.d.ts +7 -0
- package/dist-types/pagination/index.d.ts +2 -0
- package/dist-types/protocols/Aws_restJson1.d.ts +27 -0
- package/dist-types/ts3.4/BedrockRuntime.d.ts +52 -0
- package/dist-types/ts3.4/BedrockRuntimeClient.d.ts +20 -2
- package/dist-types/ts3.4/commands/GetAsyncInvokeCommand.d.ts +50 -0
- package/dist-types/ts3.4/commands/ListAsyncInvokesCommand.d.ts +50 -0
- package/dist-types/ts3.4/commands/StartAsyncInvokeCommand.d.ts +50 -0
- package/dist-types/ts3.4/commands/index.d.ts +3 -0
- package/dist-types/ts3.4/index.d.ts +1 -0
- package/dist-types/ts3.4/models/models_0.d.ts +356 -42
- package/dist-types/ts3.4/pagination/Interfaces.d.ts +6 -0
- package/dist-types/ts3.4/pagination/ListAsyncInvokesPaginator.d.ts +11 -0
- package/dist-types/ts3.4/pagination/index.d.ts +2 -0
- package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +36 -0
- package/package.json +4 -2
|
@@ -1,8 +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, serializeFloat as __serializeFloat, take, withBaseException, } from "@smithy/smithy-client";
|
|
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";
|
|
4
|
+
import { v4 as generateIdempotencyToken } from "uuid";
|
|
4
5
|
import { BedrockRuntimeServiceException as __BaseException } from "../models/BedrockRuntimeServiceException";
|
|
5
|
-
import { AccessDeniedException, ContentBlock, DocumentSource, ImageSource, InternalServerException, ModelErrorException, ModelNotReadyException, ModelStreamErrorException, ModelTimeoutException, ResourceNotFoundException, ServiceQuotaExceededException, ServiceUnavailableException, ThrottlingException, Tool, ToolInputSchema, ToolResultContentBlock, ValidationException, } from "../models/models_0";
|
|
6
|
+
import { AccessDeniedException, ConflictException, ContentBlock, DocumentSource, GuardrailContentBlock, GuardrailConverseContentBlock, GuardrailConverseImageSource, GuardrailImageSource, ImageSource, InternalServerException, ModelErrorException, ModelNotReadyException, ModelStreamErrorException, ModelTimeoutException, ResourceNotFoundException, ServiceQuotaExceededException, ServiceUnavailableException, SystemContentBlock, ThrottlingException, Tool, ToolInputSchema, ToolResultContentBlock, ValidationException, VideoSource, } from "../models/models_0";
|
|
6
7
|
export const se_ApplyGuardrailCommand = async (input, context) => {
|
|
7
8
|
const b = rb(input, context);
|
|
8
9
|
const headers = {
|
|
@@ -13,7 +14,7 @@ export const se_ApplyGuardrailCommand = async (input, context) => {
|
|
|
13
14
|
b.p("guardrailVersion", () => input.guardrailVersion, "{guardrailVersion}", false);
|
|
14
15
|
let body;
|
|
15
16
|
body = JSON.stringify(take(input, {
|
|
16
|
-
content: (_) =>
|
|
17
|
+
content: (_) => se_GuardrailContentBlockList(_, context),
|
|
17
18
|
source: [],
|
|
18
19
|
}));
|
|
19
20
|
b.m("POST").h(headers).b(body);
|
|
@@ -35,7 +36,8 @@ export const se_ConverseCommand = async (input, context) => {
|
|
|
35
36
|
messages: (_) => se_Messages(_, context),
|
|
36
37
|
performanceConfig: (_) => _json(_),
|
|
37
38
|
promptVariables: (_) => _json(_),
|
|
38
|
-
|
|
39
|
+
requestMetadata: (_) => _json(_),
|
|
40
|
+
system: (_) => se_SystemContentBlocks(_, context),
|
|
39
41
|
toolConfig: (_) => se_ToolConfiguration(_, context),
|
|
40
42
|
}));
|
|
41
43
|
b.m("POST").h(headers).b(body);
|
|
@@ -57,12 +59,22 @@ export const se_ConverseStreamCommand = async (input, context) => {
|
|
|
57
59
|
messages: (_) => se_Messages(_, context),
|
|
58
60
|
performanceConfig: (_) => _json(_),
|
|
59
61
|
promptVariables: (_) => _json(_),
|
|
60
|
-
|
|
62
|
+
requestMetadata: (_) => _json(_),
|
|
63
|
+
system: (_) => se_SystemContentBlocks(_, context),
|
|
61
64
|
toolConfig: (_) => se_ToolConfiguration(_, context),
|
|
62
65
|
}));
|
|
63
66
|
b.m("POST").h(headers).b(body);
|
|
64
67
|
return b.build();
|
|
65
68
|
};
|
|
69
|
+
export const se_GetAsyncInvokeCommand = async (input, context) => {
|
|
70
|
+
const b = rb(input, context);
|
|
71
|
+
const headers = {};
|
|
72
|
+
b.bp("/async-invoke/{invocationArn}");
|
|
73
|
+
b.p("invocationArn", () => input.invocationArn, "{invocationArn}", false);
|
|
74
|
+
let body;
|
|
75
|
+
b.m("GET").h(headers).b(body);
|
|
76
|
+
return b.build();
|
|
77
|
+
};
|
|
66
78
|
export const se_InvokeModelCommand = async (input, context) => {
|
|
67
79
|
const b = rb(input, context);
|
|
68
80
|
const headers = map({}, isSerializableHeaderValue, {
|
|
@@ -101,6 +113,40 @@ export const se_InvokeModelWithResponseStreamCommand = async (input, context) =>
|
|
|
101
113
|
b.m("POST").h(headers).b(body);
|
|
102
114
|
return b.build();
|
|
103
115
|
};
|
|
116
|
+
export const se_ListAsyncInvokesCommand = async (input, context) => {
|
|
117
|
+
const b = rb(input, context);
|
|
118
|
+
const headers = {};
|
|
119
|
+
b.bp("/async-invoke");
|
|
120
|
+
const query = map({
|
|
121
|
+
[_sTA]: [() => input.submitTimeAfter !== void 0, () => __serializeDateTime(input[_sTA]).toString()],
|
|
122
|
+
[_sTB]: [() => input.submitTimeBefore !== void 0, () => __serializeDateTime(input[_sTB]).toString()],
|
|
123
|
+
[_sE]: [, input[_sE]],
|
|
124
|
+
[_mR]: [() => input.maxResults !== void 0, () => input[_mR].toString()],
|
|
125
|
+
[_nT]: [, input[_nT]],
|
|
126
|
+
[_sB]: [, input[_sB]],
|
|
127
|
+
[_sO]: [, input[_sO]],
|
|
128
|
+
});
|
|
129
|
+
let body;
|
|
130
|
+
b.m("GET").h(headers).q(query).b(body);
|
|
131
|
+
return b.build();
|
|
132
|
+
};
|
|
133
|
+
export const se_StartAsyncInvokeCommand = async (input, context) => {
|
|
134
|
+
const b = rb(input, context);
|
|
135
|
+
const headers = {
|
|
136
|
+
"content-type": "application/json",
|
|
137
|
+
};
|
|
138
|
+
b.bp("/async-invoke");
|
|
139
|
+
let body;
|
|
140
|
+
body = JSON.stringify(take(input, {
|
|
141
|
+
clientRequestToken: [true, (_) => _ ?? generateIdempotencyToken()],
|
|
142
|
+
modelId: [],
|
|
143
|
+
modelInput: (_) => se_ModelInputPayload(_, context),
|
|
144
|
+
outputDataConfig: (_) => _json(_),
|
|
145
|
+
tags: (_) => _json(_),
|
|
146
|
+
}));
|
|
147
|
+
b.m("POST").h(headers).b(body);
|
|
148
|
+
return b.build();
|
|
149
|
+
};
|
|
104
150
|
export const de_ApplyGuardrailCommand = async (output, context) => {
|
|
105
151
|
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
106
152
|
return de_CommandError(output, context);
|
|
@@ -150,6 +196,28 @@ export const de_ConverseStreamCommand = async (output, context) => {
|
|
|
150
196
|
contents.stream = de_ConverseStreamOutput(data, context);
|
|
151
197
|
return contents;
|
|
152
198
|
};
|
|
199
|
+
export const de_GetAsyncInvokeCommand = async (output, context) => {
|
|
200
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
201
|
+
return de_CommandError(output, context);
|
|
202
|
+
}
|
|
203
|
+
const contents = map({
|
|
204
|
+
$metadata: deserializeMetadata(output),
|
|
205
|
+
});
|
|
206
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
207
|
+
const doc = take(data, {
|
|
208
|
+
clientRequestToken: __expectString,
|
|
209
|
+
endTime: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
|
|
210
|
+
failureMessage: __expectString,
|
|
211
|
+
invocationArn: __expectString,
|
|
212
|
+
lastModifiedTime: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
|
|
213
|
+
modelArn: __expectString,
|
|
214
|
+
outputDataConfig: (_) => _json(__expectUnion(_)),
|
|
215
|
+
status: __expectString,
|
|
216
|
+
submitTime: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
|
|
217
|
+
});
|
|
218
|
+
Object.assign(contents, doc);
|
|
219
|
+
return contents;
|
|
220
|
+
};
|
|
153
221
|
export const de_InvokeModelCommand = async (output, context) => {
|
|
154
222
|
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
155
223
|
return de_CommandError(output, context);
|
|
@@ -176,6 +244,35 @@ export const de_InvokeModelWithResponseStreamCommand = async (output, context) =
|
|
|
176
244
|
contents.body = de_ResponseStream(data, context);
|
|
177
245
|
return contents;
|
|
178
246
|
};
|
|
247
|
+
export const de_ListAsyncInvokesCommand = async (output, context) => {
|
|
248
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
249
|
+
return de_CommandError(output, context);
|
|
250
|
+
}
|
|
251
|
+
const contents = map({
|
|
252
|
+
$metadata: deserializeMetadata(output),
|
|
253
|
+
});
|
|
254
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
255
|
+
const doc = take(data, {
|
|
256
|
+
asyncInvokeSummaries: (_) => de_AsyncInvokeSummaries(_, context),
|
|
257
|
+
nextToken: __expectString,
|
|
258
|
+
});
|
|
259
|
+
Object.assign(contents, doc);
|
|
260
|
+
return contents;
|
|
261
|
+
};
|
|
262
|
+
export const de_StartAsyncInvokeCommand = async (output, context) => {
|
|
263
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
264
|
+
return de_CommandError(output, context);
|
|
265
|
+
}
|
|
266
|
+
const contents = map({
|
|
267
|
+
$metadata: deserializeMetadata(output),
|
|
268
|
+
});
|
|
269
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
270
|
+
const doc = take(data, {
|
|
271
|
+
invocationArn: __expectString,
|
|
272
|
+
});
|
|
273
|
+
Object.assign(contents, doc);
|
|
274
|
+
return contents;
|
|
275
|
+
};
|
|
179
276
|
const de_CommandError = async (output, context) => {
|
|
180
277
|
const parsedOutput = {
|
|
181
278
|
...output,
|
|
@@ -216,6 +313,9 @@ const de_CommandError = async (output, context) => {
|
|
|
216
313
|
case "ModelStreamErrorException":
|
|
217
314
|
case "com.amazonaws.bedrockruntime#ModelStreamErrorException":
|
|
218
315
|
throw await de_ModelStreamErrorExceptionRes(parsedOutput, context);
|
|
316
|
+
case "ConflictException":
|
|
317
|
+
case "com.amazonaws.bedrockruntime#ConflictException":
|
|
318
|
+
throw await de_ConflictExceptionRes(parsedOutput, context);
|
|
219
319
|
default:
|
|
220
320
|
const parsedBody = parsedOutput.body;
|
|
221
321
|
return throwDefaultError({
|
|
@@ -239,6 +339,19 @@ const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
|
|
|
239
339
|
});
|
|
240
340
|
return __decorateServiceException(exception, parsedOutput.body);
|
|
241
341
|
};
|
|
342
|
+
const de_ConflictExceptionRes = async (parsedOutput, context) => {
|
|
343
|
+
const contents = map({});
|
|
344
|
+
const data = parsedOutput.body;
|
|
345
|
+
const doc = take(data, {
|
|
346
|
+
message: __expectString,
|
|
347
|
+
});
|
|
348
|
+
Object.assign(contents, doc);
|
|
349
|
+
const exception = new ConflictException({
|
|
350
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
351
|
+
...contents,
|
|
352
|
+
});
|
|
353
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
354
|
+
};
|
|
242
355
|
const de_InternalServerExceptionRes = async (parsedOutput, context) => {
|
|
243
356
|
const contents = map({});
|
|
244
357
|
const data = parsedOutput.body;
|
|
@@ -560,11 +673,12 @@ const de_ValidationException_event = async (output, context) => {
|
|
|
560
673
|
const se_ContentBlock = (input, context) => {
|
|
561
674
|
return ContentBlock.visit(input, {
|
|
562
675
|
document: (value) => ({ document: se_DocumentBlock(value, context) }),
|
|
563
|
-
guardContent: (value) => ({ guardContent:
|
|
676
|
+
guardContent: (value) => ({ guardContent: se_GuardrailConverseContentBlock(value, context) }),
|
|
564
677
|
image: (value) => ({ image: se_ImageBlock(value, context) }),
|
|
565
678
|
text: (value) => ({ text: value }),
|
|
566
679
|
toolResult: (value) => ({ toolResult: se_ToolResultBlock(value, context) }),
|
|
567
680
|
toolUse: (value) => ({ toolUse: se_ToolUseBlock(value, context) }),
|
|
681
|
+
video: (value) => ({ video: se_VideoBlock(value, context) }),
|
|
568
682
|
_: (name, value) => ({ name: value }),
|
|
569
683
|
});
|
|
570
684
|
};
|
|
@@ -588,6 +702,51 @@ const se_DocumentSource = (input, context) => {
|
|
|
588
702
|
_: (name, value) => ({ name: value }),
|
|
589
703
|
});
|
|
590
704
|
};
|
|
705
|
+
const se_GuardrailContentBlock = (input, context) => {
|
|
706
|
+
return GuardrailContentBlock.visit(input, {
|
|
707
|
+
image: (value) => ({ image: se_GuardrailImageBlock(value, context) }),
|
|
708
|
+
text: (value) => ({ text: _json(value) }),
|
|
709
|
+
_: (name, value) => ({ name: value }),
|
|
710
|
+
});
|
|
711
|
+
};
|
|
712
|
+
const se_GuardrailContentBlockList = (input, context) => {
|
|
713
|
+
return input
|
|
714
|
+
.filter((e) => e != null)
|
|
715
|
+
.map((entry) => {
|
|
716
|
+
return se_GuardrailContentBlock(entry, context);
|
|
717
|
+
});
|
|
718
|
+
};
|
|
719
|
+
const se_GuardrailConverseContentBlock = (input, context) => {
|
|
720
|
+
return GuardrailConverseContentBlock.visit(input, {
|
|
721
|
+
image: (value) => ({ image: se_GuardrailConverseImageBlock(value, context) }),
|
|
722
|
+
text: (value) => ({ text: _json(value) }),
|
|
723
|
+
_: (name, value) => ({ name: value }),
|
|
724
|
+
});
|
|
725
|
+
};
|
|
726
|
+
const se_GuardrailConverseImageBlock = (input, context) => {
|
|
727
|
+
return take(input, {
|
|
728
|
+
format: [],
|
|
729
|
+
source: (_) => se_GuardrailConverseImageSource(_, context),
|
|
730
|
+
});
|
|
731
|
+
};
|
|
732
|
+
const se_GuardrailConverseImageSource = (input, context) => {
|
|
733
|
+
return GuardrailConverseImageSource.visit(input, {
|
|
734
|
+
bytes: (value) => ({ bytes: context.base64Encoder(value) }),
|
|
735
|
+
_: (name, value) => ({ name: value }),
|
|
736
|
+
});
|
|
737
|
+
};
|
|
738
|
+
const se_GuardrailImageBlock = (input, context) => {
|
|
739
|
+
return take(input, {
|
|
740
|
+
format: [],
|
|
741
|
+
source: (_) => se_GuardrailImageSource(_, context),
|
|
742
|
+
});
|
|
743
|
+
};
|
|
744
|
+
const se_GuardrailImageSource = (input, context) => {
|
|
745
|
+
return GuardrailImageSource.visit(input, {
|
|
746
|
+
bytes: (value) => ({ bytes: context.base64Encoder(value) }),
|
|
747
|
+
_: (name, value) => ({ name: value }),
|
|
748
|
+
});
|
|
749
|
+
};
|
|
591
750
|
const se_ImageBlock = (input, context) => {
|
|
592
751
|
return take(input, {
|
|
593
752
|
format: [],
|
|
@@ -621,6 +780,23 @@ const se_Messages = (input, context) => {
|
|
|
621
780
|
return se_Message(entry, context);
|
|
622
781
|
});
|
|
623
782
|
};
|
|
783
|
+
const se_ModelInputPayload = (input, context) => {
|
|
784
|
+
return input;
|
|
785
|
+
};
|
|
786
|
+
const se_SystemContentBlock = (input, context) => {
|
|
787
|
+
return SystemContentBlock.visit(input, {
|
|
788
|
+
guardContent: (value) => ({ guardContent: se_GuardrailConverseContentBlock(value, context) }),
|
|
789
|
+
text: (value) => ({ text: value }),
|
|
790
|
+
_: (name, value) => ({ name: value }),
|
|
791
|
+
});
|
|
792
|
+
};
|
|
793
|
+
const se_SystemContentBlocks = (input, context) => {
|
|
794
|
+
return input
|
|
795
|
+
.filter((e) => e != null)
|
|
796
|
+
.map((entry) => {
|
|
797
|
+
return se_SystemContentBlock(entry, context);
|
|
798
|
+
});
|
|
799
|
+
};
|
|
624
800
|
const se_Tool = (input, context) => {
|
|
625
801
|
return Tool.visit(input, {
|
|
626
802
|
toolSpec: (value) => ({ toolSpec: se_ToolSpecification(value, context) }),
|
|
@@ -652,6 +828,7 @@ const se_ToolResultContentBlock = (input, context) => {
|
|
|
652
828
|
image: (value) => ({ image: se_ImageBlock(value, context) }),
|
|
653
829
|
json: (value) => ({ json: se_Document(value, context) }),
|
|
654
830
|
text: (value) => ({ text: value }),
|
|
831
|
+
video: (value) => ({ video: se_VideoBlock(value, context) }),
|
|
655
832
|
_: (name, value) => ({ name: value }),
|
|
656
833
|
});
|
|
657
834
|
};
|
|
@@ -683,9 +860,43 @@ const se_ToolUseBlock = (input, context) => {
|
|
|
683
860
|
toolUseId: [],
|
|
684
861
|
});
|
|
685
862
|
};
|
|
863
|
+
const se_VideoBlock = (input, context) => {
|
|
864
|
+
return take(input, {
|
|
865
|
+
format: [],
|
|
866
|
+
source: (_) => se_VideoSource(_, context),
|
|
867
|
+
});
|
|
868
|
+
};
|
|
869
|
+
const se_VideoSource = (input, context) => {
|
|
870
|
+
return VideoSource.visit(input, {
|
|
871
|
+
bytes: (value) => ({ bytes: context.base64Encoder(value) }),
|
|
872
|
+
s3Location: (value) => ({ s3Location: _json(value) }),
|
|
873
|
+
_: (name, value) => ({ name: value }),
|
|
874
|
+
});
|
|
875
|
+
};
|
|
686
876
|
const se_Document = (input, context) => {
|
|
687
877
|
return input;
|
|
688
878
|
};
|
|
879
|
+
const de_AsyncInvokeSummaries = (output, context) => {
|
|
880
|
+
const retVal = (output || [])
|
|
881
|
+
.filter((e) => e != null)
|
|
882
|
+
.map((entry) => {
|
|
883
|
+
return de_AsyncInvokeSummary(entry, context);
|
|
884
|
+
});
|
|
885
|
+
return retVal;
|
|
886
|
+
};
|
|
887
|
+
const de_AsyncInvokeSummary = (output, context) => {
|
|
888
|
+
return take(output, {
|
|
889
|
+
clientRequestToken: __expectString,
|
|
890
|
+
endTime: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
|
|
891
|
+
failureMessage: __expectString,
|
|
892
|
+
invocationArn: __expectString,
|
|
893
|
+
lastModifiedTime: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
|
|
894
|
+
modelArn: __expectString,
|
|
895
|
+
outputDataConfig: (_) => _json(__expectUnion(_)),
|
|
896
|
+
status: __expectString,
|
|
897
|
+
submitTime: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
|
|
898
|
+
});
|
|
899
|
+
};
|
|
689
900
|
const de_ContentBlock = (output, context) => {
|
|
690
901
|
if (output.document != null) {
|
|
691
902
|
return {
|
|
@@ -694,7 +905,7 @@ const de_ContentBlock = (output, context) => {
|
|
|
694
905
|
}
|
|
695
906
|
if (output.guardContent != null) {
|
|
696
907
|
return {
|
|
697
|
-
guardContent:
|
|
908
|
+
guardContent: de_GuardrailConverseContentBlock(__expectUnion(output.guardContent), context),
|
|
698
909
|
};
|
|
699
910
|
}
|
|
700
911
|
if (output.image != null) {
|
|
@@ -715,6 +926,11 @@ const de_ContentBlock = (output, context) => {
|
|
|
715
926
|
toolUse: de_ToolUseBlock(output.toolUse, context),
|
|
716
927
|
};
|
|
717
928
|
}
|
|
929
|
+
if (output.video != null) {
|
|
930
|
+
return {
|
|
931
|
+
video: de_VideoBlock(output.video, context),
|
|
932
|
+
};
|
|
933
|
+
}
|
|
718
934
|
return { $unknown: Object.entries(output)[0] };
|
|
719
935
|
};
|
|
720
936
|
const de_ContentBlocks = (output, context) => {
|
|
@@ -744,11 +960,13 @@ const de_ConverseStreamMetadataEvent = (output, context) => {
|
|
|
744
960
|
const de_ConverseStreamTrace = (output, context) => {
|
|
745
961
|
return take(output, {
|
|
746
962
|
guardrail: (_) => de_GuardrailTraceAssessment(_, context),
|
|
963
|
+
promptRouter: _json,
|
|
747
964
|
});
|
|
748
965
|
};
|
|
749
966
|
const de_ConverseTrace = (output, context) => {
|
|
750
967
|
return take(output, {
|
|
751
968
|
guardrail: (_) => de_GuardrailTraceAssessment(_, context),
|
|
969
|
+
promptRouter: _json,
|
|
752
970
|
});
|
|
753
971
|
};
|
|
754
972
|
const de_DocumentBlock = (output, context) => {
|
|
@@ -823,6 +1041,33 @@ const de_GuardrailContextualGroundingPolicyAssessment = (output, context) => {
|
|
|
823
1041
|
filters: (_) => de_GuardrailContextualGroundingFilters(_, context),
|
|
824
1042
|
});
|
|
825
1043
|
};
|
|
1044
|
+
const de_GuardrailConverseContentBlock = (output, context) => {
|
|
1045
|
+
if (output.image != null) {
|
|
1046
|
+
return {
|
|
1047
|
+
image: de_GuardrailConverseImageBlock(output.image, context),
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
if (output.text != null) {
|
|
1051
|
+
return {
|
|
1052
|
+
text: _json(output.text),
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
return { $unknown: Object.entries(output)[0] };
|
|
1056
|
+
};
|
|
1057
|
+
const de_GuardrailConverseImageBlock = (output, context) => {
|
|
1058
|
+
return take(output, {
|
|
1059
|
+
format: __expectString,
|
|
1060
|
+
source: (_) => de_GuardrailConverseImageSource(__expectUnion(_), context),
|
|
1061
|
+
});
|
|
1062
|
+
};
|
|
1063
|
+
const de_GuardrailConverseImageSource = (output, context) => {
|
|
1064
|
+
if (output.bytes != null) {
|
|
1065
|
+
return {
|
|
1066
|
+
bytes: context.base64Decoder(output.bytes),
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
return { $unknown: Object.entries(output)[0] };
|
|
1070
|
+
};
|
|
826
1071
|
const de_GuardrailTraceAssessment = (output, context) => {
|
|
827
1072
|
return take(output, {
|
|
828
1073
|
inputAssessment: (_) => de_GuardrailAssessmentMap(_, context),
|
|
@@ -887,6 +1132,11 @@ const de_ToolResultContentBlock = (output, context) => {
|
|
|
887
1132
|
if (__expectString(output.text) !== undefined) {
|
|
888
1133
|
return { text: __expectString(output.text) };
|
|
889
1134
|
}
|
|
1135
|
+
if (output.video != null) {
|
|
1136
|
+
return {
|
|
1137
|
+
video: de_VideoBlock(output.video, context),
|
|
1138
|
+
};
|
|
1139
|
+
}
|
|
890
1140
|
return { $unknown: Object.entries(output)[0] };
|
|
891
1141
|
};
|
|
892
1142
|
const de_ToolResultContentBlocks = (output, context) => {
|
|
@@ -904,6 +1154,25 @@ const de_ToolUseBlock = (output, context) => {
|
|
|
904
1154
|
toolUseId: __expectString,
|
|
905
1155
|
});
|
|
906
1156
|
};
|
|
1157
|
+
const de_VideoBlock = (output, context) => {
|
|
1158
|
+
return take(output, {
|
|
1159
|
+
format: __expectString,
|
|
1160
|
+
source: (_) => de_VideoSource(__expectUnion(_), context),
|
|
1161
|
+
});
|
|
1162
|
+
};
|
|
1163
|
+
const de_VideoSource = (output, context) => {
|
|
1164
|
+
if (output.bytes != null) {
|
|
1165
|
+
return {
|
|
1166
|
+
bytes: context.base64Decoder(output.bytes),
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1169
|
+
if (output.s3Location != null) {
|
|
1170
|
+
return {
|
|
1171
|
+
s3Location: _json(output.s3Location),
|
|
1172
|
+
};
|
|
1173
|
+
}
|
|
1174
|
+
return { $unknown: Object.entries(output)[0] };
|
|
1175
|
+
};
|
|
907
1176
|
const de_Document = (output, context) => {
|
|
908
1177
|
return output;
|
|
909
1178
|
};
|
|
@@ -919,7 +1188,14 @@ const _cT = "contentType";
|
|
|
919
1188
|
const _ct = "content-type";
|
|
920
1189
|
const _gI = "guardrailIdentifier";
|
|
921
1190
|
const _gV = "guardrailVersion";
|
|
1191
|
+
const _mR = "maxResults";
|
|
1192
|
+
const _nT = "nextToken";
|
|
922
1193
|
const _pCL = "performanceConfigLatency";
|
|
1194
|
+
const _sB = "sortBy";
|
|
1195
|
+
const _sE = "statusEquals";
|
|
1196
|
+
const _sO = "sortOrder";
|
|
1197
|
+
const _sTA = "submitTimeAfter";
|
|
1198
|
+
const _sTB = "submitTimeBefore";
|
|
923
1199
|
const _t = "trace";
|
|
924
1200
|
const _xaba = "x-amzn-bedrock-accept";
|
|
925
1201
|
const _xabct = "x-amzn-bedrock-content-type";
|
|
@@ -3,8 +3,11 @@ import { BedrockRuntimeClient } from "./BedrockRuntimeClient";
|
|
|
3
3
|
import { ApplyGuardrailCommandInput, ApplyGuardrailCommandOutput } from "./commands/ApplyGuardrailCommand";
|
|
4
4
|
import { ConverseCommandInput, ConverseCommandOutput } from "./commands/ConverseCommand";
|
|
5
5
|
import { ConverseStreamCommandInput, ConverseStreamCommandOutput } from "./commands/ConverseStreamCommand";
|
|
6
|
+
import { GetAsyncInvokeCommandInput, GetAsyncInvokeCommandOutput } from "./commands/GetAsyncInvokeCommand";
|
|
6
7
|
import { InvokeModelCommandInput, InvokeModelCommandOutput } from "./commands/InvokeModelCommand";
|
|
7
8
|
import { InvokeModelWithResponseStreamCommandInput, InvokeModelWithResponseStreamCommandOutput } from "./commands/InvokeModelWithResponseStreamCommand";
|
|
9
|
+
import { ListAsyncInvokesCommandInput, ListAsyncInvokesCommandOutput } from "./commands/ListAsyncInvokesCommand";
|
|
10
|
+
import { StartAsyncInvokeCommandInput, StartAsyncInvokeCommandOutput } from "./commands/StartAsyncInvokeCommand";
|
|
8
11
|
export interface BedrockRuntime {
|
|
9
12
|
/**
|
|
10
13
|
* @see {@link ApplyGuardrailCommand}
|
|
@@ -24,6 +27,12 @@ export interface BedrockRuntime {
|
|
|
24
27
|
converseStream(args: ConverseStreamCommandInput, options?: __HttpHandlerOptions): Promise<ConverseStreamCommandOutput>;
|
|
25
28
|
converseStream(args: ConverseStreamCommandInput, cb: (err: any, data?: ConverseStreamCommandOutput) => void): void;
|
|
26
29
|
converseStream(args: ConverseStreamCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: ConverseStreamCommandOutput) => void): void;
|
|
30
|
+
/**
|
|
31
|
+
* @see {@link GetAsyncInvokeCommand}
|
|
32
|
+
*/
|
|
33
|
+
getAsyncInvoke(args: GetAsyncInvokeCommandInput, options?: __HttpHandlerOptions): Promise<GetAsyncInvokeCommandOutput>;
|
|
34
|
+
getAsyncInvoke(args: GetAsyncInvokeCommandInput, cb: (err: any, data?: GetAsyncInvokeCommandOutput) => void): void;
|
|
35
|
+
getAsyncInvoke(args: GetAsyncInvokeCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: GetAsyncInvokeCommandOutput) => void): void;
|
|
27
36
|
/**
|
|
28
37
|
* @see {@link InvokeModelCommand}
|
|
29
38
|
*/
|
|
@@ -36,6 +45,19 @@ export interface BedrockRuntime {
|
|
|
36
45
|
invokeModelWithResponseStream(args: InvokeModelWithResponseStreamCommandInput, options?: __HttpHandlerOptions): Promise<InvokeModelWithResponseStreamCommandOutput>;
|
|
37
46
|
invokeModelWithResponseStream(args: InvokeModelWithResponseStreamCommandInput, cb: (err: any, data?: InvokeModelWithResponseStreamCommandOutput) => void): void;
|
|
38
47
|
invokeModelWithResponseStream(args: InvokeModelWithResponseStreamCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: InvokeModelWithResponseStreamCommandOutput) => void): void;
|
|
48
|
+
/**
|
|
49
|
+
* @see {@link ListAsyncInvokesCommand}
|
|
50
|
+
*/
|
|
51
|
+
listAsyncInvokes(): Promise<ListAsyncInvokesCommandOutput>;
|
|
52
|
+
listAsyncInvokes(args: ListAsyncInvokesCommandInput, options?: __HttpHandlerOptions): Promise<ListAsyncInvokesCommandOutput>;
|
|
53
|
+
listAsyncInvokes(args: ListAsyncInvokesCommandInput, cb: (err: any, data?: ListAsyncInvokesCommandOutput) => void): void;
|
|
54
|
+
listAsyncInvokes(args: ListAsyncInvokesCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: ListAsyncInvokesCommandOutput) => void): void;
|
|
55
|
+
/**
|
|
56
|
+
* @see {@link StartAsyncInvokeCommand}
|
|
57
|
+
*/
|
|
58
|
+
startAsyncInvoke(args: StartAsyncInvokeCommandInput, options?: __HttpHandlerOptions): Promise<StartAsyncInvokeCommandOutput>;
|
|
59
|
+
startAsyncInvoke(args: StartAsyncInvokeCommandInput, cb: (err: any, data?: StartAsyncInvokeCommandOutput) => void): void;
|
|
60
|
+
startAsyncInvoke(args: StartAsyncInvokeCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: StartAsyncInvokeCommandOutput) => void): void;
|
|
39
61
|
}
|
|
40
62
|
/**
|
|
41
63
|
* <p>Describes the API operations for running inference using Amazon Bedrock models.</p>
|
|
@@ -11,19 +11,22 @@ import { HttpAuthSchemeInputConfig, HttpAuthSchemeResolvedConfig } from "./auth/
|
|
|
11
11
|
import { ApplyGuardrailCommandInput, ApplyGuardrailCommandOutput } from "./commands/ApplyGuardrailCommand";
|
|
12
12
|
import { ConverseCommandInput, ConverseCommandOutput } from "./commands/ConverseCommand";
|
|
13
13
|
import { ConverseStreamCommandInput, ConverseStreamCommandOutput } from "./commands/ConverseStreamCommand";
|
|
14
|
+
import { GetAsyncInvokeCommandInput, GetAsyncInvokeCommandOutput } from "./commands/GetAsyncInvokeCommand";
|
|
14
15
|
import { InvokeModelCommandInput, InvokeModelCommandOutput } from "./commands/InvokeModelCommand";
|
|
15
16
|
import { InvokeModelWithResponseStreamCommandInput, InvokeModelWithResponseStreamCommandOutput } from "./commands/InvokeModelWithResponseStreamCommand";
|
|
17
|
+
import { ListAsyncInvokesCommandInput, ListAsyncInvokesCommandOutput } from "./commands/ListAsyncInvokesCommand";
|
|
18
|
+
import { StartAsyncInvokeCommandInput, StartAsyncInvokeCommandOutput } from "./commands/StartAsyncInvokeCommand";
|
|
16
19
|
import { ClientInputEndpointParameters, ClientResolvedEndpointParameters, EndpointParameters } from "./endpoint/EndpointParameters";
|
|
17
20
|
import { RuntimeExtension, RuntimeExtensionsConfig } from "./runtimeExtensions";
|
|
18
21
|
export { __Client };
|
|
19
22
|
/**
|
|
20
23
|
* @public
|
|
21
24
|
*/
|
|
22
|
-
export type ServiceInputTypes = ApplyGuardrailCommandInput | ConverseCommandInput | ConverseStreamCommandInput | InvokeModelCommandInput | InvokeModelWithResponseStreamCommandInput;
|
|
25
|
+
export type ServiceInputTypes = ApplyGuardrailCommandInput | ConverseCommandInput | ConverseStreamCommandInput | GetAsyncInvokeCommandInput | InvokeModelCommandInput | InvokeModelWithResponseStreamCommandInput | ListAsyncInvokesCommandInput | StartAsyncInvokeCommandInput;
|
|
23
26
|
/**
|
|
24
27
|
* @public
|
|
25
28
|
*/
|
|
26
|
-
export type ServiceOutputTypes = ApplyGuardrailCommandOutput | ConverseCommandOutput | ConverseStreamCommandOutput | InvokeModelCommandOutput | InvokeModelWithResponseStreamCommandOutput;
|
|
29
|
+
export type ServiceOutputTypes = ApplyGuardrailCommandOutput | ConverseCommandOutput | ConverseStreamCommandOutput | GetAsyncInvokeCommandOutput | InvokeModelCommandOutput | InvokeModelWithResponseStreamCommandOutput | ListAsyncInvokesCommandOutput | StartAsyncInvokeCommandOutput;
|
|
27
30
|
/**
|
|
28
31
|
* @public
|
|
29
32
|
*/
|
|
@@ -28,6 +28,8 @@ declare const ApplyGuardrailCommand_base: {
|
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
30
30
|
* <p>The action to apply a guardrail.</p>
|
|
31
|
+
* <p>For troubleshooting some of the common errors you might encounter when using the <code>ApplyGuardrail</code> API,
|
|
32
|
+
* see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html">Troubleshooting Amazon Bedrock API Error Codes</a> in the Amazon Bedrock User Guide</p>
|
|
31
33
|
* @example
|
|
32
34
|
* Use a bare-bones client and the command you need to make an API call.
|
|
33
35
|
* ```javascript
|
|
@@ -46,6 +48,12 @@ declare const ApplyGuardrailCommand_base: {
|
|
|
46
48
|
* "grounding_source" || "query" || "guard_content",
|
|
47
49
|
* ],
|
|
48
50
|
* },
|
|
51
|
+
* image: { // GuardrailImageBlock
|
|
52
|
+
* format: "png" || "jpeg", // required
|
|
53
|
+
* source: { // GuardrailImageSource Union: only one key present
|
|
54
|
+
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
|
|
55
|
+
* },
|
|
56
|
+
* },
|
|
49
57
|
* },
|
|
50
58
|
* ],
|
|
51
59
|
* };
|
|
@@ -144,6 +152,10 @@ declare const ApplyGuardrailCommand_base: {
|
|
|
144
152
|
* // guarded: Number("int"),
|
|
145
153
|
* // total: Number("int"),
|
|
146
154
|
* // },
|
|
155
|
+
* // images: { // GuardrailImageCoverage
|
|
156
|
+
* // guarded: Number("int"),
|
|
157
|
+
* // total: Number("int"),
|
|
158
|
+
* // },
|
|
147
159
|
* // },
|
|
148
160
|
* // },
|
|
149
161
|
* // },
|
|
@@ -153,6 +165,10 @@ declare const ApplyGuardrailCommand_base: {
|
|
|
153
165
|
* // guarded: Number("int"),
|
|
154
166
|
* // total: Number("int"),
|
|
155
167
|
* // },
|
|
168
|
+
* // images: {
|
|
169
|
+
* // guarded: Number("int"),
|
|
170
|
+
* // total: Number("int"),
|
|
171
|
+
* // },
|
|
156
172
|
* // },
|
|
157
173
|
* // };
|
|
158
174
|
*
|