@aws-sdk/client-bedrock-runtime 3.784.0 → 3.787.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 +210 -2
- 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 +68 -0
- package/dist-es/protocols/Aws_restJson1.js +100 -1
- 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/InvokeModelWithBidirectionalStreamCommand.d.ts +144 -0
- package/dist-types/commands/index.d.ts +1 -0
- package/dist-types/models/models_0.d.ts +233 -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 +157 -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 +7 -5
|
@@ -3,7 +3,7 @@ import { requestBuilder as rb } from "@smithy/core";
|
|
|
3
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 = {
|
|
@@ -95,6 +95,20 @@ export const se_InvokeModelCommand = async (input, context) => {
|
|
|
95
95
|
b.m("POST").h(headers).b(body);
|
|
96
96
|
return b.build();
|
|
97
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
|
+
};
|
|
98
112
|
export const se_InvokeModelWithResponseStreamCommand = async (input, context) => {
|
|
99
113
|
const b = rb(input, context);
|
|
100
114
|
const headers = map({}, isSerializableHeaderValue, {
|
|
@@ -233,6 +247,17 @@ export const de_InvokeModelCommand = async (output, context) => {
|
|
|
233
247
|
contents.body = data;
|
|
234
248
|
return contents;
|
|
235
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
|
+
};
|
|
236
261
|
export const de_InvokeModelWithResponseStreamCommand = async (output, context) => {
|
|
237
262
|
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
238
263
|
return de_CommandError(output, context);
|
|
@@ -488,6 +513,24 @@ const de_ValidationExceptionRes = async (parsedOutput, context) => {
|
|
|
488
513
|
});
|
|
489
514
|
return __decorateServiceException(exception, parsedOutput.body);
|
|
490
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
|
+
};
|
|
491
534
|
const de_ConverseStreamOutput = (output, context) => {
|
|
492
535
|
return context.eventStreamMarshaller.deserialize(output, async (event) => {
|
|
493
536
|
if (event["messageStart"] != null) {
|
|
@@ -548,6 +591,46 @@ const de_ConverseStreamOutput = (output, context) => {
|
|
|
548
591
|
return { $unknown: output };
|
|
549
592
|
});
|
|
550
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
|
+
};
|
|
551
634
|
const de_ResponseStream = (output, context) => {
|
|
552
635
|
return context.eventStreamMarshaller.deserialize(output, async (event) => {
|
|
553
636
|
if (event["chunk"] != null) {
|
|
@@ -588,6 +671,12 @@ const de_ResponseStream = (output, context) => {
|
|
|
588
671
|
return { $unknown: output };
|
|
589
672
|
});
|
|
590
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
|
+
};
|
|
591
680
|
const de_ContentBlockDeltaEvent_event = async (output, context) => {
|
|
592
681
|
const contents = {};
|
|
593
682
|
const data = await parseBody(output.body, context);
|
|
@@ -672,6 +761,11 @@ const de_ValidationException_event = async (output, context) => {
|
|
|
672
761
|
};
|
|
673
762
|
return de_ValidationExceptionRes(parsedOutput, context);
|
|
674
763
|
};
|
|
764
|
+
const se_BidirectionalInputPayloadPart = (input, context) => {
|
|
765
|
+
return take(input, {
|
|
766
|
+
bytes: context.base64Encoder,
|
|
767
|
+
});
|
|
768
|
+
};
|
|
675
769
|
const se_ContentBlock = (input, context) => {
|
|
676
770
|
return ContentBlock.visit(input, {
|
|
677
771
|
cachePoint: (value) => ({ cachePoint: _json(value) }),
|
|
@@ -910,6 +1004,11 @@ const de_AsyncInvokeSummary = (output, context) => {
|
|
|
910
1004
|
submitTime: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
|
|
911
1005
|
});
|
|
912
1006
|
};
|
|
1007
|
+
const de_BidirectionalOutputPayloadPart = (output, context) => {
|
|
1008
|
+
return take(output, {
|
|
1009
|
+
bytes: context.base64Decoder,
|
|
1010
|
+
});
|
|
1011
|
+
};
|
|
913
1012
|
const de_ContentBlock = (output, context) => {
|
|
914
1013
|
if (output.cachePoint != null) {
|
|
915
1014
|
return {
|
|
@@ -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
|
*
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { Command as $Command } from "@smithy/smithy-client";
|
|
2
|
+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
|
|
3
|
+
import { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockRuntimeClient";
|
|
4
|
+
import { InvokeModelWithBidirectionalStreamRequest, InvokeModelWithBidirectionalStreamResponse } from "../models/models_0";
|
|
5
|
+
/**
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export type { __MetadataBearer };
|
|
9
|
+
export { $Command };
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*
|
|
13
|
+
* The input for {@link InvokeModelWithBidirectionalStreamCommand}.
|
|
14
|
+
*/
|
|
15
|
+
export interface InvokeModelWithBidirectionalStreamCommandInput extends InvokeModelWithBidirectionalStreamRequest {
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @public
|
|
19
|
+
*
|
|
20
|
+
* The output of {@link InvokeModelWithBidirectionalStreamCommand}.
|
|
21
|
+
*/
|
|
22
|
+
export interface InvokeModelWithBidirectionalStreamCommandOutput extends InvokeModelWithBidirectionalStreamResponse, __MetadataBearer {
|
|
23
|
+
}
|
|
24
|
+
declare const InvokeModelWithBidirectionalStreamCommand_base: {
|
|
25
|
+
new (input: InvokeModelWithBidirectionalStreamCommandInput): import("@smithy/smithy-client").CommandImpl<InvokeModelWithBidirectionalStreamCommandInput, InvokeModelWithBidirectionalStreamCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
|
|
26
|
+
new (__0_0: InvokeModelWithBidirectionalStreamCommandInput): import("@smithy/smithy-client").CommandImpl<InvokeModelWithBidirectionalStreamCommandInput, InvokeModelWithBidirectionalStreamCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
|
|
27
|
+
getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* <p>Invoke the specified Amazon Bedrock model to run inference using the bidirectional stream. The response is returned in a stream that remains open for 8 minutes. A single session can contain multiple prompts and responses from the model. The prompts to the model are provided as audio files and the model's responses are spoken back to the user and transcribed.</p>
|
|
31
|
+
* <p>It is possible for users to interrupt the model's response with a new prompt, which will halt the response speech. The model will retain contextual awareness of the conversation while pivoting to respond to the new prompt.</p>
|
|
32
|
+
* @example
|
|
33
|
+
* Use a bare-bones client and the command you need to make an API call.
|
|
34
|
+
* ```javascript
|
|
35
|
+
* import { BedrockRuntimeClient, InvokeModelWithBidirectionalStreamCommand } from "@aws-sdk/client-bedrock-runtime"; // ES Modules import
|
|
36
|
+
* // const { BedrockRuntimeClient, InvokeModelWithBidirectionalStreamCommand } = require("@aws-sdk/client-bedrock-runtime"); // CommonJS import
|
|
37
|
+
* const client = new BedrockRuntimeClient(config);
|
|
38
|
+
* const input = { // InvokeModelWithBidirectionalStreamRequest
|
|
39
|
+
* modelId: "STRING_VALUE", // required
|
|
40
|
+
* body: { // InvokeModelWithBidirectionalStreamInput Union: only one key present
|
|
41
|
+
* chunk: { // BidirectionalInputPayloadPart
|
|
42
|
+
* bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
|
|
43
|
+
* },
|
|
44
|
+
* },
|
|
45
|
+
* };
|
|
46
|
+
* const command = new InvokeModelWithBidirectionalStreamCommand(input);
|
|
47
|
+
* const response = await client.send(command);
|
|
48
|
+
* // { // InvokeModelWithBidirectionalStreamResponse
|
|
49
|
+
* // body: { // InvokeModelWithBidirectionalStreamOutput Union: only one key present
|
|
50
|
+
* // chunk: { // BidirectionalOutputPayloadPart
|
|
51
|
+
* // bytes: new Uint8Array(),
|
|
52
|
+
* // },
|
|
53
|
+
* // internalServerException: { // InternalServerException
|
|
54
|
+
* // message: "STRING_VALUE",
|
|
55
|
+
* // },
|
|
56
|
+
* // modelStreamErrorException: { // ModelStreamErrorException
|
|
57
|
+
* // message: "STRING_VALUE",
|
|
58
|
+
* // originalStatusCode: Number("int"),
|
|
59
|
+
* // originalMessage: "STRING_VALUE",
|
|
60
|
+
* // },
|
|
61
|
+
* // validationException: { // ValidationException
|
|
62
|
+
* // message: "STRING_VALUE",
|
|
63
|
+
* // },
|
|
64
|
+
* // throttlingException: { // ThrottlingException
|
|
65
|
+
* // message: "STRING_VALUE",
|
|
66
|
+
* // },
|
|
67
|
+
* // modelTimeoutException: { // ModelTimeoutException
|
|
68
|
+
* // message: "STRING_VALUE",
|
|
69
|
+
* // },
|
|
70
|
+
* // serviceUnavailableException: { // ServiceUnavailableException
|
|
71
|
+
* // message: "STRING_VALUE",
|
|
72
|
+
* // },
|
|
73
|
+
* // },
|
|
74
|
+
* // };
|
|
75
|
+
*
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @param InvokeModelWithBidirectionalStreamCommandInput - {@link InvokeModelWithBidirectionalStreamCommandInput}
|
|
79
|
+
* @returns {@link InvokeModelWithBidirectionalStreamCommandOutput}
|
|
80
|
+
* @see {@link InvokeModelWithBidirectionalStreamCommandInput} for command's `input` shape.
|
|
81
|
+
* @see {@link InvokeModelWithBidirectionalStreamCommandOutput} for command's `response` shape.
|
|
82
|
+
* @see {@link BedrockRuntimeClientResolvedConfig | config} for BedrockRuntimeClient's `config` shape.
|
|
83
|
+
*
|
|
84
|
+
* @throws {@link AccessDeniedException} (client fault)
|
|
85
|
+
* <p>The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error,
|
|
86
|
+
* see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-access-denied">AccessDeniedException</a> in the Amazon Bedrock User Guide</p>
|
|
87
|
+
*
|
|
88
|
+
* @throws {@link InternalServerException} (server fault)
|
|
89
|
+
* <p>An internal server error occurred. For troubleshooting this error,
|
|
90
|
+
* see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-internal-failure">InternalFailure</a> in the Amazon Bedrock User Guide</p>
|
|
91
|
+
*
|
|
92
|
+
* @throws {@link ModelErrorException} (client fault)
|
|
93
|
+
* <p>The request failed due to an error while processing the model.</p>
|
|
94
|
+
*
|
|
95
|
+
* @throws {@link ModelNotReadyException} (client fault)
|
|
96
|
+
* <p>The model specified in the request is not ready to serve inference requests. The AWS SDK
|
|
97
|
+
* will automatically retry the operation up to 5 times. For information about configuring
|
|
98
|
+
* automatic retries, see <a href="https://docs.aws.amazon.com/sdkref/latest/guide/feature-retry-behavior.html">Retry behavior</a> in the <i>AWS SDKs and Tools</i>
|
|
99
|
+
* reference guide.</p>
|
|
100
|
+
*
|
|
101
|
+
* @throws {@link ModelStreamErrorException} (client fault)
|
|
102
|
+
* <p>An error occurred while streaming the response. Retry your request.</p>
|
|
103
|
+
*
|
|
104
|
+
* @throws {@link ModelTimeoutException} (client fault)
|
|
105
|
+
* <p>The request took too long to process. Processing time exceeded the model timeout length.</p>
|
|
106
|
+
*
|
|
107
|
+
* @throws {@link ResourceNotFoundException} (client fault)
|
|
108
|
+
* <p>The specified resource ARN was not found. For troubleshooting this error,
|
|
109
|
+
* see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-resource-not-found">ResourceNotFound</a> in the Amazon Bedrock User Guide</p>
|
|
110
|
+
*
|
|
111
|
+
* @throws {@link ServiceQuotaExceededException} (client fault)
|
|
112
|
+
* <p>Your request exceeds the service quota for your account. You can view your quotas at <a href="https://docs.aws.amazon.com/servicequotas/latest/userguide/gs-request-quota.html">Viewing service quotas</a>. You can resubmit your request later.</p>
|
|
113
|
+
*
|
|
114
|
+
* @throws {@link ServiceUnavailableException} (server fault)
|
|
115
|
+
* <p>The service isn't currently available. For troubleshooting this error,
|
|
116
|
+
* see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-service-unavailable">ServiceUnavailable</a> in the Amazon Bedrock User Guide</p>
|
|
117
|
+
*
|
|
118
|
+
* @throws {@link ThrottlingException} (client fault)
|
|
119
|
+
* <p>Your request was denied due to exceeding the account quotas for <i>Amazon Bedrock</i>. For
|
|
120
|
+
* troubleshooting this error, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-throttling-exception">ThrottlingException</a> in the Amazon Bedrock User Guide</p>
|
|
121
|
+
*
|
|
122
|
+
* @throws {@link ValidationException} (client fault)
|
|
123
|
+
* <p>The input fails to satisfy the constraints specified by <i>Amazon Bedrock</i>. For troubleshooting this error,
|
|
124
|
+
* see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/troubleshooting-api-error-codes.html#ts-validation-error">ValidationError</a> in the Amazon Bedrock User Guide</p>
|
|
125
|
+
*
|
|
126
|
+
* @throws {@link BedrockRuntimeServiceException}
|
|
127
|
+
* <p>Base exception class for all service exceptions from BedrockRuntime service.</p>
|
|
128
|
+
*
|
|
129
|
+
*
|
|
130
|
+
* @public
|
|
131
|
+
*/
|
|
132
|
+
export declare class InvokeModelWithBidirectionalStreamCommand extends InvokeModelWithBidirectionalStreamCommand_base {
|
|
133
|
+
/** @internal type navigation helper, not in runtime. */
|
|
134
|
+
protected static __types: {
|
|
135
|
+
api: {
|
|
136
|
+
input: InvokeModelWithBidirectionalStreamRequest;
|
|
137
|
+
output: InvokeModelWithBidirectionalStreamResponse;
|
|
138
|
+
};
|
|
139
|
+
sdk: {
|
|
140
|
+
input: InvokeModelWithBidirectionalStreamCommandInput;
|
|
141
|
+
output: InvokeModelWithBidirectionalStreamCommandOutput;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
}
|
|
@@ -3,6 +3,7 @@ export * from "./ConverseCommand";
|
|
|
3
3
|
export * from "./ConverseStreamCommand";
|
|
4
4
|
export * from "./GetAsyncInvokeCommand";
|
|
5
5
|
export * from "./InvokeModelCommand";
|
|
6
|
+
export * from "./InvokeModelWithBidirectionalStreamCommand";
|
|
6
7
|
export * from "./InvokeModelWithResponseStreamCommand";
|
|
7
8
|
export * from "./ListAsyncInvokesCommand";
|
|
8
9
|
export * from "./StartAsyncInvokeCommand";
|