@aws-sdk/client-bedrock-runtime 3.1076.0 → 3.1078.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.
Files changed (53) hide show
  1. package/dist-cjs/index.js +28 -134
  2. package/dist-es/commandBuilder.js +14 -0
  3. package/dist-es/commands/ApplyGuardrailCommand.js +2 -14
  4. package/dist-es/commands/ConverseCommand.js +2 -14
  5. package/dist-es/commands/ConverseStreamCommand.js +2 -18
  6. package/dist-es/commands/CountTokensCommand.js +2 -14
  7. package/dist-es/commands/GetAsyncInvokeCommand.js +2 -14
  8. package/dist-es/commands/InvokeGuardrailChecksCommand.js +2 -14
  9. package/dist-es/commands/InvokeModelCommand.js +2 -14
  10. package/dist-es/commands/InvokeModelWithBidirectionalStreamCommand.js +2 -27
  11. package/dist-es/commands/InvokeModelWithResponseStreamCommand.js +2 -18
  12. package/dist-es/commands/ListAsyncInvokesCommand.js +2 -14
  13. package/dist-es/commands/StartAsyncInvokeCommand.js +2 -14
  14. package/dist-es/index.js +1 -0
  15. package/dist-es/runtimeConfig.browser.js +0 -2
  16. package/dist-es/runtimeConfig.js +1 -2
  17. package/dist-es/runtimeConfig.native.js +0 -2
  18. package/dist-es/runtimeConfig.shared.js +2 -0
  19. package/dist-types/commandBuilder.d.ts +22 -0
  20. package/dist-types/commands/ApplyGuardrailCommand.d.ts +3 -8
  21. package/dist-types/commands/ConverseCommand.d.ts +3 -8
  22. package/dist-types/commands/ConverseStreamCommand.d.ts +3 -8
  23. package/dist-types/commands/CountTokensCommand.d.ts +3 -8
  24. package/dist-types/commands/GetAsyncInvokeCommand.d.ts +3 -8
  25. package/dist-types/commands/InvokeGuardrailChecksCommand.d.ts +3 -8
  26. package/dist-types/commands/InvokeModelCommand.d.ts +3 -8
  27. package/dist-types/commands/InvokeModelWithBidirectionalStreamCommand.d.ts +3 -8
  28. package/dist-types/commands/InvokeModelWithResponseStreamCommand.d.ts +3 -8
  29. package/dist-types/commands/ListAsyncInvokesCommand.d.ts +3 -8
  30. package/dist-types/commands/StartAsyncInvokeCommand.d.ts +3 -8
  31. package/dist-types/index.d.ts +1 -0
  32. package/dist-types/runtimeConfig.browser.d.ts +1 -1
  33. package/dist-types/runtimeConfig.d.ts +1 -1
  34. package/dist-types/runtimeConfig.native.d.ts +1 -1
  35. package/dist-types/runtimeConfig.shared.d.ts +1 -0
  36. package/dist-types/ts3.4/commandBuilder.d.ts +52 -0
  37. package/dist-types/ts3.4/commands/ApplyGuardrailCommand.d.ts +7 -16
  38. package/dist-types/ts3.4/commands/ConverseCommand.d.ts +7 -16
  39. package/dist-types/ts3.4/commands/ConverseStreamCommand.d.ts +7 -16
  40. package/dist-types/ts3.4/commands/CountTokensCommand.d.ts +7 -16
  41. package/dist-types/ts3.4/commands/GetAsyncInvokeCommand.d.ts +7 -16
  42. package/dist-types/ts3.4/commands/InvokeGuardrailChecksCommand.d.ts +7 -16
  43. package/dist-types/ts3.4/commands/InvokeModelCommand.d.ts +7 -16
  44. package/dist-types/ts3.4/commands/InvokeModelWithBidirectionalStreamCommand.d.ts +7 -16
  45. package/dist-types/ts3.4/commands/InvokeModelWithResponseStreamCommand.d.ts +7 -16
  46. package/dist-types/ts3.4/commands/ListAsyncInvokesCommand.d.ts +7 -16
  47. package/dist-types/ts3.4/commands/StartAsyncInvokeCommand.d.ts +7 -16
  48. package/dist-types/ts3.4/index.d.ts +1 -0
  49. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -1
  50. package/dist-types/ts3.4/runtimeConfig.d.ts +1 -1
  51. package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -1
  52. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +1 -0
  53. package/package.json +13 -15
package/dist-cjs/index.js CHANGED
@@ -2,8 +2,9 @@ const { awsEndpointFunctions, emitWarningIfUnsupportedVersion: emitWarningIfUnsu
2
2
  const { resolveEventStreamConfig, getEventStreamPlugin } = require("@aws-sdk/middleware-eventstream");
3
3
  const { resolveWebSocketConfig, getWebSocketPlugin } = require("@aws-sdk/middleware-websocket");
4
4
  const { memoizeIdentityProvider, isIdentityExpired, doesIdentityRequireRefresh, HttpBearerAuthSigner, getHttpAuthSchemeEndpointRuleSetPlugin, DefaultIdentityProviderConfig, getHttpSigningPlugin, createPaginator } = require("@smithy/core");
5
- const { normalizeProvider, getSmithyContext, ServiceException, NoOpLogger, emitWarningIfUnsupportedVersion, loadConfigsForDefaultMode, getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig, Client, Command, createAggregatedClient } = require("@smithy/core/client");
6
- exports.$Command = Command;
5
+ const { normalizeProvider, getSmithyContext, ServiceException, NoOpLogger, emitWarningIfUnsupportedVersion, loadConfigsForDefaultMode, getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig, Client, makeBuilder, createAggregatedClient } = require("@smithy/core/client");
6
+ const { Command: $Command } = require("@smithy/core/client");
7
+ exports.$Command = $Command;
7
8
  exports.__Client = Client;
8
9
  const { resolveDefaultsModeConfig, loadConfig, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS, resolveRegionConfig } = require("@smithy/core/config");
9
10
  const { BinaryDecisionDiagram, EndpointCache, decideEndpoint, customEndpointFunctions, resolveEndpointConfig, getEndpointPlugin } = require("@smithy/core/endpoints");
@@ -15,9 +16,10 @@ const { resolveAwsSdkSigV4Config, AwsSdkSigV4Signer, NODE_AUTH_SCHEME_PREFERENCE
15
16
  const { defaultProvider } = require("@aws-sdk/credential-provider-node");
16
17
  const { eventStreamPayloadHandlerProvider } = require("@aws-sdk/eventstream-handler-node");
17
18
  const { fromEnvSigningName, nodeProvider } = require("@aws-sdk/token-providers");
18
- const { toUtf8, fromUtf8, toBase64, fromBase64, Hash, calculateBodyLength } = require("@smithy/core/serde");
19
+ const { toUtf8, fromUtf8, toBase64, fromBase64, calculateBodyLength } = require("@smithy/core/serde");
19
20
  const { streamCollector, NodeHttp2Handler } = require("@smithy/node-http-handler");
20
21
  const { AwsRestJsonProtocol } = require("@aws-sdk/core/protocols");
22
+ const { Sha256 } = require("@smithy/core/checksum");
21
23
 
22
24
  const defaultBedrockRuntimeHttpAuthSchemeParametersProvider = async (config, context, input) => {
23
25
  return {
@@ -88,7 +90,7 @@ const commonParams = {
88
90
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
89
91
  };
90
92
 
91
- var version = "3.1075.0";
93
+ var version = "3.1077.0";
92
94
  var packageInfo = {
93
95
  version: version};
94
96
 
@@ -2018,6 +2020,7 @@ const getRuntimeConfig$1 = (config) => {
2018
2020
  serviceTarget: "AmazonBedrockFrontendService",
2019
2021
  },
2020
2022
  serviceId: config?.serviceId ?? "Bedrock Runtime",
2023
+ sha256: config?.sha256 ?? Sha256,
2021
2024
  urlParser: config?.urlParser ?? parseUrl,
2022
2025
  utf8Decoder: config?.utf8Decoder ?? fromUtf8,
2023
2026
  utf8Encoder: config?.utf8Encoder ?? toUtf8,
@@ -2076,7 +2079,6 @@ const getRuntimeConfig = (config) => {
2076
2079
  ...NODE_RETRY_MODE_CONFIG_OPTIONS,
2077
2080
  default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
2078
2081
  }, config),
2079
- sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
2080
2082
  streamCollector: config?.streamCollector ?? streamCollector,
2081
2083
  useDualstackEndpoint: config?.useDualstackEndpoint ?? loadConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
2082
2084
  useFipsEndpoint: config?.useFipsEndpoint ?? loadConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
@@ -2176,155 +2178,47 @@ class BedrockRuntimeClient extends Client {
2176
2178
  }
2177
2179
  }
2178
2180
 
2179
- class ApplyGuardrailCommand extends Command
2180
- .classBuilder()
2181
- .ep(commonParams)
2182
- .m(function (Command, cs, config, o) {
2183
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
2184
- })
2185
- .s("AmazonBedrockFrontendService", "ApplyGuardrail", {})
2186
- .n("BedrockRuntimeClient", "ApplyGuardrailCommand")
2187
- .sc(ApplyGuardrail$)
2188
- .build() {
2181
+ const command = makeBuilder(commonParams, "AmazonBedrockFrontendService", "BedrockRuntimeClient", getEndpointPlugin);
2182
+ const _ep0 = {};
2183
+ const _mw0 = (Command, cs, config, o) => [];
2184
+ const _mw1 = (Command, cs, config, o) => [
2185
+ getEventStreamPlugin(config),
2186
+ getWebSocketPlugin(config, {
2187
+ headerPrefix: "x-amz-bedrock-",
2188
+ }),
2189
+ ];
2190
+
2191
+ class ApplyGuardrailCommand extends command(_ep0, _mw0, "ApplyGuardrail", ApplyGuardrail$) {
2189
2192
  }
2190
2193
 
2191
- class ConverseCommand extends Command
2192
- .classBuilder()
2193
- .ep(commonParams)
2194
- .m(function (Command, cs, config, o) {
2195
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
2196
- })
2197
- .s("AmazonBedrockFrontendService", "Converse", {})
2198
- .n("BedrockRuntimeClient", "ConverseCommand")
2199
- .sc(Converse$)
2200
- .build() {
2194
+ class ConverseCommand extends command(_ep0, _mw0, "Converse", Converse$) {
2201
2195
  }
2202
2196
 
2203
- class ConverseStreamCommand extends Command
2204
- .classBuilder()
2205
- .ep(commonParams)
2206
- .m(function (Command, cs, config, o) {
2207
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
2208
- })
2209
- .s("AmazonBedrockFrontendService", "ConverseStream", {
2210
- eventStream: {
2211
- output: true,
2212
- },
2213
- })
2214
- .n("BedrockRuntimeClient", "ConverseStreamCommand")
2215
- .sc(ConverseStream$)
2216
- .build() {
2197
+ class ConverseStreamCommand extends command(_ep0, _mw0, "ConverseStream", ConverseStream$) {
2217
2198
  }
2218
2199
 
2219
- class CountTokensCommand extends Command
2220
- .classBuilder()
2221
- .ep(commonParams)
2222
- .m(function (Command, cs, config, o) {
2223
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
2224
- })
2225
- .s("AmazonBedrockFrontendService", "CountTokens", {})
2226
- .n("BedrockRuntimeClient", "CountTokensCommand")
2227
- .sc(CountTokens$)
2228
- .build() {
2200
+ class CountTokensCommand extends command(_ep0, _mw0, "CountTokens", CountTokens$) {
2229
2201
  }
2230
2202
 
2231
- class GetAsyncInvokeCommand extends Command
2232
- .classBuilder()
2233
- .ep(commonParams)
2234
- .m(function (Command, cs, config, o) {
2235
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
2236
- })
2237
- .s("AmazonBedrockFrontendService", "GetAsyncInvoke", {})
2238
- .n("BedrockRuntimeClient", "GetAsyncInvokeCommand")
2239
- .sc(GetAsyncInvoke$)
2240
- .build() {
2203
+ class GetAsyncInvokeCommand extends command(_ep0, _mw0, "GetAsyncInvoke", GetAsyncInvoke$) {
2241
2204
  }
2242
2205
 
2243
- class InvokeGuardrailChecksCommand extends Command
2244
- .classBuilder()
2245
- .ep(commonParams)
2246
- .m(function (Command, cs, config, o) {
2247
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
2248
- })
2249
- .s("AmazonBedrockFrontendService", "InvokeGuardrailChecks", {})
2250
- .n("BedrockRuntimeClient", "InvokeGuardrailChecksCommand")
2251
- .sc(InvokeGuardrailChecks$)
2252
- .build() {
2206
+ class InvokeGuardrailChecksCommand extends command(_ep0, _mw0, "InvokeGuardrailChecks", InvokeGuardrailChecks$) {
2253
2207
  }
2254
2208
 
2255
- class InvokeModelCommand extends Command
2256
- .classBuilder()
2257
- .ep(commonParams)
2258
- .m(function (Command, cs, config, o) {
2259
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
2260
- })
2261
- .s("AmazonBedrockFrontendService", "InvokeModel", {})
2262
- .n("BedrockRuntimeClient", "InvokeModelCommand")
2263
- .sc(InvokeModel$)
2264
- .build() {
2209
+ class InvokeModelCommand extends command(_ep0, _mw0, "InvokeModel", InvokeModel$) {
2265
2210
  }
2266
2211
 
2267
- class InvokeModelWithBidirectionalStreamCommand extends Command
2268
- .classBuilder()
2269
- .ep(commonParams)
2270
- .m(function (Command, cs, config, o) {
2271
- return [
2272
- getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
2273
- getEventStreamPlugin(config),
2274
- getWebSocketPlugin(config, {
2275
- headerPrefix: 'x-amz-bedrock-',
2276
- }),
2277
- ];
2278
- })
2279
- .s("AmazonBedrockFrontendService", "InvokeModelWithBidirectionalStream", {
2280
- eventStream: {
2281
- input: true,
2282
- output: true,
2283
- },
2284
- })
2285
- .n("BedrockRuntimeClient", "InvokeModelWithBidirectionalStreamCommand")
2286
- .sc(InvokeModelWithBidirectionalStream$)
2287
- .build() {
2212
+ class InvokeModelWithBidirectionalStreamCommand extends command(_ep0, _mw1, "InvokeModelWithBidirectionalStream", InvokeModelWithBidirectionalStream$) {
2288
2213
  }
2289
2214
 
2290
- class InvokeModelWithResponseStreamCommand extends Command
2291
- .classBuilder()
2292
- .ep(commonParams)
2293
- .m(function (Command, cs, config, o) {
2294
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
2295
- })
2296
- .s("AmazonBedrockFrontendService", "InvokeModelWithResponseStream", {
2297
- eventStream: {
2298
- output: true,
2299
- },
2300
- })
2301
- .n("BedrockRuntimeClient", "InvokeModelWithResponseStreamCommand")
2302
- .sc(InvokeModelWithResponseStream$)
2303
- .build() {
2215
+ class InvokeModelWithResponseStreamCommand extends command(_ep0, _mw0, "InvokeModelWithResponseStream", InvokeModelWithResponseStream$) {
2304
2216
  }
2305
2217
 
2306
- class ListAsyncInvokesCommand extends Command
2307
- .classBuilder()
2308
- .ep(commonParams)
2309
- .m(function (Command, cs, config, o) {
2310
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
2311
- })
2312
- .s("AmazonBedrockFrontendService", "ListAsyncInvokes", {})
2313
- .n("BedrockRuntimeClient", "ListAsyncInvokesCommand")
2314
- .sc(ListAsyncInvokes$)
2315
- .build() {
2218
+ class ListAsyncInvokesCommand extends command(_ep0, _mw0, "ListAsyncInvokes", ListAsyncInvokes$) {
2316
2219
  }
2317
2220
 
2318
- class StartAsyncInvokeCommand extends Command
2319
- .classBuilder()
2320
- .ep(commonParams)
2321
- .m(function (Command, cs, config, o) {
2322
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
2323
- })
2324
- .s("AmazonBedrockFrontendService", "StartAsyncInvoke", {})
2325
- .n("BedrockRuntimeClient", "StartAsyncInvokeCommand")
2326
- .sc(StartAsyncInvoke$)
2327
- .build() {
2221
+ class StartAsyncInvokeCommand extends command(_ep0, _mw0, "StartAsyncInvoke", StartAsyncInvoke$) {
2328
2222
  }
2329
2223
 
2330
2224
  const paginateListAsyncInvokes = createPaginator(BedrockRuntimeClient, ListAsyncInvokesCommand, "nextToken", "nextToken", "maxResults");
@@ -0,0 +1,14 @@
1
+ import { getEventStreamPlugin } from "@aws-sdk/middleware-eventstream";
2
+ import { getWebSocketPlugin } from "@aws-sdk/middleware-websocket";
3
+ import { makeBuilder } from "@smithy/core/client";
4
+ import { getEndpointPlugin } from "@smithy/core/endpoints";
5
+ import { commonParams } from "./endpoint/EndpointParameters";
6
+ export const command = makeBuilder(commonParams, "AmazonBedrockFrontendService", "BedrockRuntimeClient", getEndpointPlugin);
7
+ export const _ep0 = {};
8
+ export const _mw0 = (Command, cs, config, o) => [];
9
+ export const _mw1 = (Command, cs, config, o) => [
10
+ getEventStreamPlugin(config),
11
+ getWebSocketPlugin(config, {
12
+ headerPrefix: "x-amz-bedrock-",
13
+ }),
14
+ ];
@@ -1,16 +1,4 @@
1
- import { Command as $Command } from "@smithy/core/client";
2
- import { getEndpointPlugin } from "@smithy/core/endpoints";
3
- import { commonParams } from "../endpoint/EndpointParameters";
1
+ import { _ep0, _mw0, command } from "../commandBuilder";
4
2
  import { ApplyGuardrail$ } from "../schemas/schemas_0";
5
- export { $Command };
6
- export class ApplyGuardrailCommand extends $Command
7
- .classBuilder()
8
- .ep(commonParams)
9
- .m(function (Command, cs, config, o) {
10
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
11
- })
12
- .s("AmazonBedrockFrontendService", "ApplyGuardrail", {})
13
- .n("BedrockRuntimeClient", "ApplyGuardrailCommand")
14
- .sc(ApplyGuardrail$)
15
- .build() {
3
+ export class ApplyGuardrailCommand extends command(_ep0, _mw0, "ApplyGuardrail", ApplyGuardrail$) {
16
4
  }
@@ -1,16 +1,4 @@
1
- import { Command as $Command } from "@smithy/core/client";
2
- import { getEndpointPlugin } from "@smithy/core/endpoints";
3
- import { commonParams } from "../endpoint/EndpointParameters";
1
+ import { _ep0, _mw0, command } from "../commandBuilder";
4
2
  import { Converse$ } from "../schemas/schemas_0";
5
- export { $Command };
6
- export class ConverseCommand extends $Command
7
- .classBuilder()
8
- .ep(commonParams)
9
- .m(function (Command, cs, config, o) {
10
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
11
- })
12
- .s("AmazonBedrockFrontendService", "Converse", {})
13
- .n("BedrockRuntimeClient", "ConverseCommand")
14
- .sc(Converse$)
15
- .build() {
3
+ export class ConverseCommand extends command(_ep0, _mw0, "Converse", Converse$) {
16
4
  }
@@ -1,20 +1,4 @@
1
- import { Command as $Command } from "@smithy/core/client";
2
- import { getEndpointPlugin } from "@smithy/core/endpoints";
3
- import { commonParams } from "../endpoint/EndpointParameters";
1
+ import { _ep0, _mw0, command } from "../commandBuilder";
4
2
  import { ConverseStream$ } from "../schemas/schemas_0";
5
- export { $Command };
6
- export class ConverseStreamCommand extends $Command
7
- .classBuilder()
8
- .ep(commonParams)
9
- .m(function (Command, cs, config, o) {
10
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
11
- })
12
- .s("AmazonBedrockFrontendService", "ConverseStream", {
13
- eventStream: {
14
- output: true,
15
- },
16
- })
17
- .n("BedrockRuntimeClient", "ConverseStreamCommand")
18
- .sc(ConverseStream$)
19
- .build() {
3
+ export class ConverseStreamCommand extends command(_ep0, _mw0, "ConverseStream", ConverseStream$) {
20
4
  }
@@ -1,16 +1,4 @@
1
- import { Command as $Command } from "@smithy/core/client";
2
- import { getEndpointPlugin } from "@smithy/core/endpoints";
3
- import { commonParams } from "../endpoint/EndpointParameters";
1
+ import { _ep0, _mw0, command } from "../commandBuilder";
4
2
  import { CountTokens$ } from "../schemas/schemas_0";
5
- export { $Command };
6
- export class CountTokensCommand extends $Command
7
- .classBuilder()
8
- .ep(commonParams)
9
- .m(function (Command, cs, config, o) {
10
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
11
- })
12
- .s("AmazonBedrockFrontendService", "CountTokens", {})
13
- .n("BedrockRuntimeClient", "CountTokensCommand")
14
- .sc(CountTokens$)
15
- .build() {
3
+ export class CountTokensCommand extends command(_ep0, _mw0, "CountTokens", CountTokens$) {
16
4
  }
@@ -1,16 +1,4 @@
1
- import { Command as $Command } from "@smithy/core/client";
2
- import { getEndpointPlugin } from "@smithy/core/endpoints";
3
- import { commonParams } from "../endpoint/EndpointParameters";
1
+ import { _ep0, _mw0, command } from "../commandBuilder";
4
2
  import { GetAsyncInvoke$ } from "../schemas/schemas_0";
5
- export { $Command };
6
- export class GetAsyncInvokeCommand extends $Command
7
- .classBuilder()
8
- .ep(commonParams)
9
- .m(function (Command, cs, config, o) {
10
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
11
- })
12
- .s("AmazonBedrockFrontendService", "GetAsyncInvoke", {})
13
- .n("BedrockRuntimeClient", "GetAsyncInvokeCommand")
14
- .sc(GetAsyncInvoke$)
15
- .build() {
3
+ export class GetAsyncInvokeCommand extends command(_ep0, _mw0, "GetAsyncInvoke", GetAsyncInvoke$) {
16
4
  }
@@ -1,16 +1,4 @@
1
- import { Command as $Command } from "@smithy/core/client";
2
- import { getEndpointPlugin } from "@smithy/core/endpoints";
3
- import { commonParams } from "../endpoint/EndpointParameters";
1
+ import { _ep0, _mw0, command } from "../commandBuilder";
4
2
  import { InvokeGuardrailChecks$ } from "../schemas/schemas_0";
5
- export { $Command };
6
- export class InvokeGuardrailChecksCommand extends $Command
7
- .classBuilder()
8
- .ep(commonParams)
9
- .m(function (Command, cs, config, o) {
10
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
11
- })
12
- .s("AmazonBedrockFrontendService", "InvokeGuardrailChecks", {})
13
- .n("BedrockRuntimeClient", "InvokeGuardrailChecksCommand")
14
- .sc(InvokeGuardrailChecks$)
15
- .build() {
3
+ export class InvokeGuardrailChecksCommand extends command(_ep0, _mw0, "InvokeGuardrailChecks", InvokeGuardrailChecks$) {
16
4
  }
@@ -1,16 +1,4 @@
1
- import { Command as $Command } from "@smithy/core/client";
2
- import { getEndpointPlugin } from "@smithy/core/endpoints";
3
- import { commonParams } from "../endpoint/EndpointParameters";
1
+ import { _ep0, _mw0, command } from "../commandBuilder";
4
2
  import { InvokeModel$ } from "../schemas/schemas_0";
5
- export { $Command };
6
- export class InvokeModelCommand extends $Command
7
- .classBuilder()
8
- .ep(commonParams)
9
- .m(function (Command, cs, config, o) {
10
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
11
- })
12
- .s("AmazonBedrockFrontendService", "InvokeModel", {})
13
- .n("BedrockRuntimeClient", "InvokeModelCommand")
14
- .sc(InvokeModel$)
15
- .build() {
3
+ export class InvokeModelCommand extends command(_ep0, _mw0, "InvokeModel", InvokeModel$) {
16
4
  }
@@ -1,29 +1,4 @@
1
- import { getEventStreamPlugin } from "@aws-sdk/middleware-eventstream";
2
- import { getWebSocketPlugin } from "@aws-sdk/middleware-websocket";
3
- import { Command as $Command } from "@smithy/core/client";
4
- import { getEndpointPlugin } from "@smithy/core/endpoints";
5
- import { commonParams } from "../endpoint/EndpointParameters";
1
+ import { _ep0, _mw1, command } from "../commandBuilder";
6
2
  import { InvokeModelWithBidirectionalStream$ } from "../schemas/schemas_0";
7
- export { $Command };
8
- export class InvokeModelWithBidirectionalStreamCommand extends $Command
9
- .classBuilder()
10
- .ep(commonParams)
11
- .m(function (Command, cs, config, o) {
12
- return [
13
- getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
14
- getEventStreamPlugin(config),
15
- getWebSocketPlugin(config, {
16
- headerPrefix: 'x-amz-bedrock-',
17
- }),
18
- ];
19
- })
20
- .s("AmazonBedrockFrontendService", "InvokeModelWithBidirectionalStream", {
21
- eventStream: {
22
- input: true,
23
- output: true,
24
- },
25
- })
26
- .n("BedrockRuntimeClient", "InvokeModelWithBidirectionalStreamCommand")
27
- .sc(InvokeModelWithBidirectionalStream$)
28
- .build() {
3
+ export class InvokeModelWithBidirectionalStreamCommand extends command(_ep0, _mw1, "InvokeModelWithBidirectionalStream", InvokeModelWithBidirectionalStream$) {
29
4
  }
@@ -1,20 +1,4 @@
1
- import { Command as $Command } from "@smithy/core/client";
2
- import { getEndpointPlugin } from "@smithy/core/endpoints";
3
- import { commonParams } from "../endpoint/EndpointParameters";
1
+ import { _ep0, _mw0, command } from "../commandBuilder";
4
2
  import { InvokeModelWithResponseStream$ } from "../schemas/schemas_0";
5
- export { $Command };
6
- export class InvokeModelWithResponseStreamCommand extends $Command
7
- .classBuilder()
8
- .ep(commonParams)
9
- .m(function (Command, cs, config, o) {
10
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
11
- })
12
- .s("AmazonBedrockFrontendService", "InvokeModelWithResponseStream", {
13
- eventStream: {
14
- output: true,
15
- },
16
- })
17
- .n("BedrockRuntimeClient", "InvokeModelWithResponseStreamCommand")
18
- .sc(InvokeModelWithResponseStream$)
19
- .build() {
3
+ export class InvokeModelWithResponseStreamCommand extends command(_ep0, _mw0, "InvokeModelWithResponseStream", InvokeModelWithResponseStream$) {
20
4
  }
@@ -1,16 +1,4 @@
1
- import { Command as $Command } from "@smithy/core/client";
2
- import { getEndpointPlugin } from "@smithy/core/endpoints";
3
- import { commonParams } from "../endpoint/EndpointParameters";
1
+ import { _ep0, _mw0, command } from "../commandBuilder";
4
2
  import { ListAsyncInvokes$ } from "../schemas/schemas_0";
5
- export { $Command };
6
- export class ListAsyncInvokesCommand extends $Command
7
- .classBuilder()
8
- .ep(commonParams)
9
- .m(function (Command, cs, config, o) {
10
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
11
- })
12
- .s("AmazonBedrockFrontendService", "ListAsyncInvokes", {})
13
- .n("BedrockRuntimeClient", "ListAsyncInvokesCommand")
14
- .sc(ListAsyncInvokes$)
15
- .build() {
3
+ export class ListAsyncInvokesCommand extends command(_ep0, _mw0, "ListAsyncInvokes", ListAsyncInvokes$) {
16
4
  }
@@ -1,16 +1,4 @@
1
- import { Command as $Command } from "@smithy/core/client";
2
- import { getEndpointPlugin } from "@smithy/core/endpoints";
3
- import { commonParams } from "../endpoint/EndpointParameters";
1
+ import { _ep0, _mw0, command } from "../commandBuilder";
4
2
  import { StartAsyncInvoke$ } from "../schemas/schemas_0";
5
- export { $Command };
6
- export class StartAsyncInvokeCommand extends $Command
7
- .classBuilder()
8
- .ep(commonParams)
9
- .m(function (Command, cs, config, o) {
10
- return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
11
- })
12
- .s("AmazonBedrockFrontendService", "StartAsyncInvoke", {})
13
- .n("BedrockRuntimeClient", "StartAsyncInvokeCommand")
14
- .sc(StartAsyncInvoke$)
15
- .build() {
3
+ export class StartAsyncInvokeCommand extends command(_ep0, _mw0, "StartAsyncInvoke", StartAsyncInvoke$) {
16
4
  }
package/dist-es/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./BedrockRuntimeClient";
2
2
  export * from "./BedrockRuntime";
3
3
  export * from "./commands";
4
+ export { Command as $Command } from "@smithy/core/client";
4
5
  export * from "./schemas/schemas_0";
5
6
  export * from "./pagination";
6
7
  export * from "./models/enums";
@@ -1,5 +1,4 @@
1
1
  import packageInfo from "../package.json";
2
- import { Sha256 } from "@aws-crypto/sha256-browser";
3
2
  import { createDefaultUserAgentProvider } from "@aws-sdk/core/client";
4
3
  import { eventStreamPayloadHandlerProvider, WebSocketFetchHandler as WebSocketRequestHandler, } from "@aws-sdk/middleware-websocket";
5
4
  import { invalidProvider, loadConfigsForDefaultMode } from "@smithy/core/client";
@@ -28,7 +27,6 @@ export const getRuntimeConfig = (config) => {
28
27
  requestHandler: WebSocketRequestHandler.create(config?.requestHandler
29
28
  ?? defaultConfigProvider, HttpRequestHandler.create(defaultConfigProvider)),
30
29
  retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE),
31
- sha256: config?.sha256 ?? Sha256,
32
30
  streamCollector: config?.streamCollector ?? streamCollector,
33
31
  useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),
34
32
  useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT)),
@@ -9,7 +9,7 @@ import { emitWarningIfUnsupportedVersion, loadConfigsForDefaultMode } from "@smi
9
9
  import { loadConfig as loadNodeConfig, NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, resolveDefaultsModeConfig, } from "@smithy/core/config";
10
10
  import { eventStreamSerdeProvider } from "@smithy/core/event-streams";
11
11
  import { DEFAULT_RETRY_MODE, NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS, } from "@smithy/core/retry";
12
- import { calculateBodyLength, Hash } from "@smithy/core/serde";
12
+ import { calculateBodyLength } from "@smithy/core/serde";
13
13
  import { NodeHttp2Handler as RequestHandler, streamCollector } from "@smithy/node-http-handler";
14
14
  import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
15
15
  export const getRuntimeConfig = (config) => {
@@ -64,7 +64,6 @@ export const getRuntimeConfig = (config) => {
64
64
  ...NODE_RETRY_MODE_CONFIG_OPTIONS,
65
65
  default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
66
66
  }, config),
67
- sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
68
67
  streamCollector: config?.streamCollector ?? streamCollector,
69
68
  useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
70
69
  useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
@@ -1,4 +1,3 @@
1
- import { Sha256 } from "@aws-crypto/sha256-js";
2
1
  import { invalidFunction } from "@smithy/core/client";
3
2
  import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser";
4
3
  export const getRuntimeConfig = (config) => {
@@ -10,6 +9,5 @@ export const getRuntimeConfig = (config) => {
10
9
  eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ?? (() => ({
11
10
  handle: invalidFunction("event stream request is not supported in ReactNative."),
12
11
  })),
13
- sha256: config?.sha256 ?? Sha256,
14
12
  };
15
13
  };
@@ -1,6 +1,7 @@
1
1
  import { AwsSdkSigV4Signer } from "@aws-sdk/core/httpAuthSchemes";
2
2
  import { AwsRestJsonProtocol } from "@aws-sdk/core/protocols";
3
3
  import { HttpBearerAuthSigner } from "@smithy/core";
4
+ import { Sha256 } from "@smithy/core/checksum";
4
5
  import { NoOpLogger } from "@smithy/core/client";
5
6
  import { parseUrl } from "@smithy/core/protocols";
6
7
  import { fromBase64, fromUtf8, toBase64, toUtf8 } from "@smithy/core/serde";
@@ -37,6 +38,7 @@ export const getRuntimeConfig = (config) => {
37
38
  serviceTarget: "AmazonBedrockFrontendService",
38
39
  },
39
40
  serviceId: config?.serviceId ?? "Bedrock Runtime",
41
+ sha256: config?.sha256 ?? Sha256,
40
42
  urlParser: config?.urlParser ?? parseUrl,
41
43
  utf8Decoder: config?.utf8Decoder ?? fromUtf8,
42
44
  utf8Encoder: config?.utf8Encoder ?? toUtf8,
@@ -0,0 +1,22 @@
1
+ import type { EndpointParameterInstructions } from "@smithy/types";
2
+ import type { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "./BedrockRuntimeClient";
3
+ /**
4
+ * @internal
5
+ */
6
+ export declare const command: <I extends ServiceInputTypes, O extends ServiceOutputTypes>(added: EndpointParameterInstructions, plugins: (CommandCtor: any, clientStack: any, config: any, options: any) => import("@smithy/types").Pluggable<any, any>[], op: string, $: import("@smithy/types").StaticOperationSchema, smithyContext?: Record<string, unknown>) => {
7
+ new (input: I): import("@smithy/core/client").CommandImpl<I, O, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
8
+ new (...[input]: import("@smithy/types").OptionalParameter<I>): import("@smithy/core/client").CommandImpl<I, O, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
9
+ getEndpointParameterInstructions(): EndpointParameterInstructions;
10
+ };
11
+ /**
12
+ * @internal
13
+ */
14
+ export declare const _ep0: EndpointParameterInstructions;
15
+ /**
16
+ * @internal
17
+ */
18
+ export declare const _mw0: (Command: any, cs: any, config: any, o: any) => never[];
19
+ /**
20
+ * @internal
21
+ */
22
+ export declare const _mw1: (Command: any, cs: any, config: any, o: any) => import("@smithy/types").Pluggable<any, any>[];
@@ -1,12 +1,9 @@
1
- import { Command as $Command } from "@smithy/core/client";
2
1
  import type { MetadataBearer as __MetadataBearer } from "@smithy/types";
3
- import type { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockRuntimeClient";
4
2
  import type { ApplyGuardrailRequest, ApplyGuardrailResponse } from "../models/models_0";
5
3
  /**
6
4
  * @public
7
5
  */
8
6
  export type { __MetadataBearer };
9
- export { $Command };
10
7
  /**
11
8
  * @public
12
9
  *
@@ -22,11 +19,9 @@ export interface ApplyGuardrailCommandInput extends ApplyGuardrailRequest {
22
19
  export interface ApplyGuardrailCommandOutput extends ApplyGuardrailResponse, __MetadataBearer {
23
20
  }
24
21
  declare const ApplyGuardrailCommand_base: {
25
- new (input: ApplyGuardrailCommandInput): import("@smithy/core/client").CommandImpl<ApplyGuardrailCommandInput, ApplyGuardrailCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
26
- new (input: ApplyGuardrailCommandInput): import("@smithy/core/client").CommandImpl<ApplyGuardrailCommandInput, ApplyGuardrailCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
27
- getEndpointParameterInstructions(): {
28
- [x: string]: unknown;
29
- };
22
+ new (input: ApplyGuardrailCommandInput): import("@smithy/core/client").CommandImpl<ApplyGuardrailCommandInput, ApplyGuardrailCommandOutput, import("..").BedrockRuntimeClientResolvedConfig, import("..").ServiceInputTypes, import("..").ServiceOutputTypes>;
23
+ new (input: ApplyGuardrailCommandInput): import("@smithy/core/client").CommandImpl<ApplyGuardrailCommandInput, ApplyGuardrailCommandOutput, import("..").BedrockRuntimeClientResolvedConfig, import("..").ServiceInputTypes, import("..").ServiceOutputTypes>;
24
+ getEndpointParameterInstructions(): import("@smithy/types").EndpointParameterInstructions;
30
25
  };
31
26
  /**
32
27
  * <p>The action to apply a guardrail.</p> <p>For troubleshooting some of the common errors you might encounter when using the <code>ApplyGuardrail</code> API, 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>
@@ -1,12 +1,9 @@
1
- import { Command as $Command } from "@smithy/core/client";
2
1
  import type { MetadataBearer as __MetadataBearer } from "@smithy/types";
3
- import type { BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockRuntimeClient";
4
2
  import type { ConverseRequest, ConverseResponse } from "../models/models_0";
5
3
  /**
6
4
  * @public
7
5
  */
8
6
  export type { __MetadataBearer };
9
- export { $Command };
10
7
  /**
11
8
  * @public
12
9
  *
@@ -22,11 +19,9 @@ export interface ConverseCommandInput extends ConverseRequest {
22
19
  export interface ConverseCommandOutput extends ConverseResponse, __MetadataBearer {
23
20
  }
24
21
  declare const ConverseCommand_base: {
25
- new (input: ConverseCommandInput): import("@smithy/core/client").CommandImpl<ConverseCommandInput, ConverseCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
26
- new (input: ConverseCommandInput): import("@smithy/core/client").CommandImpl<ConverseCommandInput, ConverseCommandOutput, BedrockRuntimeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes>;
27
- getEndpointParameterInstructions(): {
28
- [x: string]: unknown;
29
- };
22
+ new (input: ConverseCommandInput): import("@smithy/core/client").CommandImpl<ConverseCommandInput, ConverseCommandOutput, import("..").BedrockRuntimeClientResolvedConfig, import("..").ServiceInputTypes, import("..").ServiceOutputTypes>;
23
+ new (input: ConverseCommandInput): import("@smithy/core/client").CommandImpl<ConverseCommandInput, ConverseCommandOutput, import("..").BedrockRuntimeClientResolvedConfig, import("..").ServiceInputTypes, import("..").ServiceOutputTypes>;
24
+ getEndpointParameterInstructions(): import("@smithy/types").EndpointParameterInstructions;
30
25
  };
31
26
  /**
32
27
  * <p>Sends messages to the specified Amazon Bedrock model. <code>Converse</code> provides a consistent interface that works with all models that support messages. This allows you to write code once and use it with different models. If a model has unique inference parameters, you can also pass those unique parameters to the model.</p> <p>Amazon Bedrock doesn't store any text, images, or documents that you provide as content. The data is only used to generate the response.</p> <p>You can submit a prompt by including it in the <code>messages</code> field, specifying the <code>modelId</code> of a foundation model or inference profile to run inference on it, and including any other fields that are relevant to your use case.</p> <p>You can also submit a prompt from Prompt management by specifying the ARN of the prompt version and including a map of variables to values in the <code>promptVariables</code> field. You can append more messages to the prompt by using the <code>messages</code> field. If you use a prompt from Prompt management, you can't include the following fields in the request: <code>additionalModelRequestFields</code>, <code>inferenceConfig</code>, <code>system</code>, or <code>toolConfig</code>. Instead, these fields must be defined through Prompt management. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management-use.html">Use a prompt from Prompt management</a>.</p> <p>For information about the Converse API, see <i>Use the Converse API</i> in the <i>Amazon Bedrock User Guide</i>. To use a guardrail, see <i>Use a guardrail with the Converse API</i> in the <i>Amazon Bedrock User Guide</i>. To use a tool with a model, see <i>Tool use (Function calling)</i> in the <i>Amazon Bedrock User Guide</i> </p> <p>For example code, see <i>Converse API examples</i> in the <i>Amazon Bedrock User Guide</i>. </p> <p>This operation requires permission for the <code>bedrock:InvokeModel</code> action. </p> <important> <p>To deny all inference access to resources that you specify in the modelId field, you need to deny access to the <code>bedrock:InvokeModel</code> and <code>bedrock:InvokeModelWithResponseStream</code> actions. Doing this also denies access to the resource through the base inference actions (<a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InvokeModel.html">InvokeModel</a> and <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InvokeModelWithResponseStream.html">InvokeModelWithResponseStream</a>). For more information see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/security_iam_id-based-policy-examples.html#security_iam_id-based-policy-examples-deny-inference">Deny access for inference on specific models</a>. </p> </important> <p>For troubleshooting some of the common errors you might encounter when using the <code>Converse</code> API, 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>