@aws-sdk/client-bedrock-runtime 3.835.0 → 3.840.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 (35) hide show
  1. package/dist-cjs/auth/httpAuthSchemeProvider.js +17 -0
  2. package/dist-cjs/index.js +80 -2
  3. package/dist-cjs/runtimeConfig.js +23 -0
  4. package/dist-cjs/runtimeConfig.shared.js +6 -0
  5. package/dist-es/BedrockRuntimeClient.js +1 -0
  6. package/dist-es/auth/httpAuthExtensionConfiguration.js +8 -0
  7. package/dist-es/auth/httpAuthSchemeProvider.js +17 -0
  8. package/dist-es/models/models_0.js +48 -0
  9. package/dist-es/protocols/Aws_restJson1.js +25 -0
  10. package/dist-es/runtimeConfig.js +24 -1
  11. package/dist-es/runtimeConfig.shared.js +6 -0
  12. package/dist-types/auth/httpAuthExtensionConfiguration.d.ts +4 -1
  13. package/dist-types/auth/httpAuthSchemeProvider.d.ts +9 -1
  14. package/dist-types/commands/ApplyGuardrailCommand.d.ts +6 -13
  15. package/dist-types/commands/ConverseCommand.d.ts +120 -44
  16. package/dist-types/commands/ConverseStreamCommand.d.ts +89 -48
  17. package/dist-types/commands/GetAsyncInvokeCommand.d.ts +4 -8
  18. package/dist-types/commands/InvokeModelCommand.d.ts +8 -30
  19. package/dist-types/commands/InvokeModelWithBidirectionalStreamCommand.d.ts +8 -18
  20. package/dist-types/commands/InvokeModelWithResponseStreamCommand.d.ts +8 -35
  21. package/dist-types/commands/ListAsyncInvokesCommand.d.ts +4 -8
  22. package/dist-types/commands/StartAsyncInvokeCommand.d.ts +7 -21
  23. package/dist-types/models/models_0.d.ts +432 -296
  24. package/dist-types/runtimeConfig.browser.d.ts +10 -1
  25. package/dist-types/runtimeConfig.d.ts +13 -1
  26. package/dist-types/runtimeConfig.native.d.ts +10 -1
  27. package/dist-types/runtimeConfig.shared.d.ts +12 -1
  28. package/dist-types/ts3.4/auth/httpAuthExtensionConfiguration.d.ts +5 -0
  29. package/dist-types/ts3.4/auth/httpAuthSchemeProvider.d.ts +4 -0
  30. package/dist-types/ts3.4/models/models_0.d.ts +192 -1
  31. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +27 -1
  32. package/dist-types/ts3.4/runtimeConfig.d.ts +30 -1
  33. package/dist-types/ts3.4/runtimeConfig.native.d.ts +27 -1
  34. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +27 -1
  35. package/package.json +21 -20
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveHttpAuthSchemeConfig = exports.defaultBedrockRuntimeHttpAuthSchemeProvider = exports.defaultBedrockRuntimeHttpAuthSchemeParametersProvider = void 0;
4
4
  const core_1 = require("@aws-sdk/core");
5
+ const core_2 = require("@smithy/core");
5
6
  const util_middleware_1 = require("@smithy/util-middleware");
6
7
  const defaultBedrockRuntimeHttpAuthSchemeParametersProvider = async (config, context, input) => {
7
8
  return {
@@ -28,20 +29,36 @@ function createAwsAuthSigv4HttpAuthOption(authParameters) {
28
29
  }),
29
30
  };
30
31
  }
32
+ function createSmithyApiHttpBearerAuthHttpAuthOption(authParameters) {
33
+ return {
34
+ schemeId: "smithy.api#httpBearerAuth",
35
+ propertiesExtractor: ({ profile, filepath, configFilepath, ignoreCache }, context) => ({
36
+ identityProperties: {
37
+ profile,
38
+ filepath,
39
+ configFilepath,
40
+ ignoreCache,
41
+ },
42
+ }),
43
+ };
44
+ }
31
45
  const defaultBedrockRuntimeHttpAuthSchemeProvider = (authParameters) => {
32
46
  const options = [];
33
47
  switch (authParameters.operation) {
34
48
  default: {
35
49
  options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
50
+ options.push(createSmithyApiHttpBearerAuthHttpAuthOption(authParameters));
36
51
  }
37
52
  }
38
53
  return options;
39
54
  };
40
55
  exports.defaultBedrockRuntimeHttpAuthSchemeProvider = defaultBedrockRuntimeHttpAuthSchemeProvider;
41
56
  const resolveHttpAuthSchemeConfig = (config) => {
57
+ const token = (0, core_2.memoizeIdentityProvider)(config.token, core_2.isIdentityExpired, core_2.doesIdentityRequireRefresh);
42
58
  const config_0 = (0, core_1.resolveAwsSdkSigV4Config)(config);
43
59
  return Object.assign(config_0, {
44
60
  authSchemePreference: (0, util_middleware_1.normalizeProvider)(config.authSchemePreference ?? []),
61
+ token,
45
62
  });
46
63
  };
47
64
  exports.resolveHttpAuthSchemeConfig = resolveHttpAuthSchemeConfig;
package/dist-cjs/index.js CHANGED
@@ -33,6 +33,9 @@ __export(index_exports, {
33
33
  BidirectionalInputPayloadPartFilterSensitiveLog: () => BidirectionalInputPayloadPartFilterSensitiveLog,
34
34
  BidirectionalOutputPayloadPartFilterSensitiveLog: () => BidirectionalOutputPayloadPartFilterSensitiveLog,
35
35
  CachePointType: () => CachePointType,
36
+ CitationGeneratedContent: () => CitationGeneratedContent,
37
+ CitationLocation: () => CitationLocation,
38
+ CitationSourceContent: () => CitationSourceContent,
36
39
  ConflictException: () => ConflictException,
37
40
  ContentBlock: () => ContentBlock,
38
41
  ContentBlockDelta: () => ContentBlockDelta,
@@ -51,6 +54,7 @@ __export(index_exports, {
51
54
  ConverseStreamOutputFilterSensitiveLog: () => ConverseStreamOutputFilterSensitiveLog,
52
55
  ConverseStreamRequestFilterSensitiveLog: () => ConverseStreamRequestFilterSensitiveLog,
53
56
  ConverseStreamResponseFilterSensitiveLog: () => ConverseStreamResponseFilterSensitiveLog,
57
+ DocumentContentBlock: () => DocumentContentBlock,
54
58
  DocumentFormat: () => DocumentFormat,
55
59
  DocumentSource: () => DocumentSource,
56
60
  GetAsyncInvokeCommand: () => GetAsyncInvokeCommand,
@@ -187,6 +191,7 @@ var getHttpAuthExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) =
187
191
  const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
188
192
  let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
189
193
  let _credentials = runtimeConfig.credentials;
194
+ let _token = runtimeConfig.token;
190
195
  return {
191
196
  setHttpAuthScheme(httpAuthScheme) {
192
197
  const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
@@ -210,6 +215,12 @@ var getHttpAuthExtensionConfiguration = /* @__PURE__ */ __name((runtimeConfig) =
210
215
  },
211
216
  credentials() {
212
217
  return _credentials;
218
+ },
219
+ setToken(token) {
220
+ _token = token;
221
+ },
222
+ token() {
223
+ return _token;
213
224
  }
214
225
  };
215
226
  }, "getHttpAuthExtensionConfiguration");
@@ -217,7 +228,8 @@ var resolveHttpAuthRuntimeConfig = /* @__PURE__ */ __name((config) => {
217
228
  return {
218
229
  httpAuthSchemes: config.httpAuthSchemes(),
219
230
  httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
220
- credentials: config.credentials()
231
+ credentials: config.credentials(),
232
+ token: config.token()
221
233
  };
222
234
  }, "resolveHttpAuthRuntimeConfig");
223
235
 
@@ -273,7 +285,8 @@ var BedrockRuntimeClient = class extends import_smithy_client.Client {
273
285
  (0, import_core.getHttpAuthSchemeEndpointRuleSetPlugin)(this.config, {
274
286
  httpAuthSchemeParametersProvider: import_httpAuthSchemeProvider.defaultBedrockRuntimeHttpAuthSchemeParametersProvider,
275
287
  identityProviderConfigProvider: /* @__PURE__ */ __name(async (config) => new import_core.DefaultIdentityProviderConfig({
276
- "aws.auth#sigv4": config.credentials
288
+ "aws.auth#sigv4": config.credentials,
289
+ "smithy.api#httpBearerAuth": config.token
277
290
  }), "identityProviderConfigProvider")
278
291
  })
279
292
  );
@@ -607,6 +620,29 @@ var GuardrailTrace = {
607
620
  var CachePointType = {
608
621
  DEFAULT: "default"
609
622
  };
623
+ var CitationLocation;
624
+ ((CitationLocation3) => {
625
+ CitationLocation3.visit = /* @__PURE__ */ __name((value, visitor) => {
626
+ if (value.documentChar !== void 0) return visitor.documentChar(value.documentChar);
627
+ if (value.documentPage !== void 0) return visitor.documentPage(value.documentPage);
628
+ if (value.documentChunk !== void 0) return visitor.documentChunk(value.documentChunk);
629
+ return visitor._(value.$unknown[0], value.$unknown[1]);
630
+ }, "visit");
631
+ })(CitationLocation || (CitationLocation = {}));
632
+ var CitationSourceContent;
633
+ ((CitationSourceContent3) => {
634
+ CitationSourceContent3.visit = /* @__PURE__ */ __name((value, visitor) => {
635
+ if (value.text !== void 0) return visitor.text(value.text);
636
+ return visitor._(value.$unknown[0], value.$unknown[1]);
637
+ }, "visit");
638
+ })(CitationSourceContent || (CitationSourceContent = {}));
639
+ var CitationGeneratedContent;
640
+ ((CitationGeneratedContent3) => {
641
+ CitationGeneratedContent3.visit = /* @__PURE__ */ __name((value, visitor) => {
642
+ if (value.text !== void 0) return visitor.text(value.text);
643
+ return visitor._(value.$unknown[0], value.$unknown[1]);
644
+ }, "visit");
645
+ })(CitationGeneratedContent || (CitationGeneratedContent = {}));
610
646
  var DocumentFormat = {
611
647
  CSV: "csv",
612
648
  DOC: "doc",
@@ -618,11 +654,20 @@ var DocumentFormat = {
618
654
  XLS: "xls",
619
655
  XLSX: "xlsx"
620
656
  };
657
+ var DocumentContentBlock;
658
+ ((DocumentContentBlock3) => {
659
+ DocumentContentBlock3.visit = /* @__PURE__ */ __name((value, visitor) => {
660
+ if (value.text !== void 0) return visitor.text(value.text);
661
+ return visitor._(value.$unknown[0], value.$unknown[1]);
662
+ }, "visit");
663
+ })(DocumentContentBlock || (DocumentContentBlock = {}));
621
664
  var DocumentSource;
622
665
  ((DocumentSource2) => {
623
666
  DocumentSource2.visit = /* @__PURE__ */ __name((value, visitor) => {
624
667
  if (value.bytes !== void 0) return visitor.bytes(value.bytes);
625
668
  if (value.s3Location !== void 0) return visitor.s3Location(value.s3Location);
669
+ if (value.text !== void 0) return visitor.text(value.text);
670
+ if (value.content !== void 0) return visitor.content(value.content);
626
671
  return visitor._(value.$unknown[0], value.$unknown[1]);
627
672
  }, "visit");
628
673
  })(DocumentSource || (DocumentSource = {}));
@@ -718,6 +763,7 @@ var ContentBlock;
718
763
  if (value.guardContent !== void 0) return visitor.guardContent(value.guardContent);
719
764
  if (value.cachePoint !== void 0) return visitor.cachePoint(value.cachePoint);
720
765
  if (value.reasoningContent !== void 0) return visitor.reasoningContent(value.reasoningContent);
766
+ if (value.citationsContent !== void 0) return visitor.citationsContent(value.citationsContent);
721
767
  return visitor._(value.$unknown[0], value.$unknown[1]);
722
768
  }, "visit");
723
769
  })(ContentBlock || (ContentBlock = {}));
@@ -870,6 +916,7 @@ var ContentBlockDelta;
870
916
  if (value.text !== void 0) return visitor.text(value.text);
871
917
  if (value.toolUse !== void 0) return visitor.toolUse(value.toolUse);
872
918
  if (value.reasoningContent !== void 0) return visitor.reasoningContent(value.reasoningContent);
919
+ if (value.citation !== void 0) return visitor.citation(value.citation);
873
920
  return visitor._(value.$unknown[0], value.$unknown[1]);
874
921
  }, "visit");
875
922
  })(ContentBlockDelta || (ContentBlockDelta = {}));
@@ -1044,6 +1091,7 @@ var ContentBlockFilterSensitiveLog = /* @__PURE__ */ __name((obj) => {
1044
1091
  return { guardContent: GuardrailConverseContentBlockFilterSensitiveLog(obj.guardContent) };
1045
1092
  if (obj.cachePoint !== void 0) return { cachePoint: obj.cachePoint };
1046
1093
  if (obj.reasoningContent !== void 0) return { reasoningContent: import_smithy_client.SENSITIVE_STRING };
1094
+ if (obj.citationsContent !== void 0) return { citationsContent: obj.citationsContent };
1047
1095
  if (obj.$unknown !== void 0) return { [obj.$unknown[0]]: "UNKNOWN" };
1048
1096
  }, "ContentBlockFilterSensitiveLog");
1049
1097
  var MessageFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
@@ -1091,6 +1139,7 @@ var ContentBlockDeltaFilterSensitiveLog = /* @__PURE__ */ __name((obj) => {
1091
1139
  if (obj.text !== void 0) return { text: obj.text };
1092
1140
  if (obj.toolUse !== void 0) return { toolUse: obj.toolUse };
1093
1141
  if (obj.reasoningContent !== void 0) return { reasoningContent: import_smithy_client.SENSITIVE_STRING };
1142
+ if (obj.citation !== void 0) return { citation: obj.citation };
1094
1143
  if (obj.$unknown !== void 0) return { [obj.$unknown[0]]: "UNKNOWN" };
1095
1144
  }, "ContentBlockDeltaFilterSensitiveLog");
1096
1145
  var ContentBlockDeltaEventFilterSensitiveLog = /* @__PURE__ */ __name((obj) => ({
@@ -1976,6 +2025,7 @@ var se_BidirectionalInputPayloadPart = /* @__PURE__ */ __name((input, context) =
1976
2025
  var se_ContentBlock = /* @__PURE__ */ __name((input, context) => {
1977
2026
  return ContentBlock.visit(input, {
1978
2027
  cachePoint: /* @__PURE__ */ __name((value) => ({ cachePoint: (0, import_smithy_client._json)(value) }), "cachePoint"),
2028
+ citationsContent: /* @__PURE__ */ __name((value) => ({ citationsContent: (0, import_smithy_client._json)(value) }), "citationsContent"),
1979
2029
  document: /* @__PURE__ */ __name((value) => ({ document: se_DocumentBlock(value, context) }), "document"),
1980
2030
  guardContent: /* @__PURE__ */ __name((value) => ({ guardContent: se_GuardrailConverseContentBlock(value, context) }), "guardContent"),
1981
2031
  image: /* @__PURE__ */ __name((value) => ({ image: se_ImageBlock(value, context) }), "image"),
@@ -1994,6 +2044,8 @@ var se_ContentBlocks = /* @__PURE__ */ __name((input, context) => {
1994
2044
  }, "se_ContentBlocks");
1995
2045
  var se_DocumentBlock = /* @__PURE__ */ __name((input, context) => {
1996
2046
  return (0, import_smithy_client.take)(input, {
2047
+ citations: import_smithy_client._json,
2048
+ context: [],
1997
2049
  format: [],
1998
2050
  name: [],
1999
2051
  source: /* @__PURE__ */ __name((_) => se_DocumentSource(_, context), "source")
@@ -2002,7 +2054,9 @@ var se_DocumentBlock = /* @__PURE__ */ __name((input, context) => {
2002
2054
  var se_DocumentSource = /* @__PURE__ */ __name((input, context) => {
2003
2055
  return DocumentSource.visit(input, {
2004
2056
  bytes: /* @__PURE__ */ __name((value) => ({ bytes: context.base64Encoder(value) }), "bytes"),
2057
+ content: /* @__PURE__ */ __name((value) => ({ content: (0, import_smithy_client._json)(value) }), "content"),
2005
2058
  s3Location: /* @__PURE__ */ __name((value) => ({ s3Location: (0, import_smithy_client._json)(value) }), "s3Location"),
2059
+ text: /* @__PURE__ */ __name((value) => ({ text: value }), "text"),
2006
2060
  _: /* @__PURE__ */ __name((name, value) => ({ [name]: value }), "_")
2007
2061
  });
2008
2062
  }, "se_DocumentSource");
@@ -2210,6 +2264,11 @@ var de_ContentBlock = /* @__PURE__ */ __name((output, context) => {
2210
2264
  cachePoint: (0, import_smithy_client._json)(output.cachePoint)
2211
2265
  };
2212
2266
  }
2267
+ if (output.citationsContent != null) {
2268
+ return {
2269
+ citationsContent: (0, import_smithy_client._json)(output.citationsContent)
2270
+ };
2271
+ }
2213
2272
  if (output.document != null) {
2214
2273
  return {
2215
2274
  document: de_DocumentBlock(output.document, context)
@@ -2251,6 +2310,11 @@ var de_ContentBlock = /* @__PURE__ */ __name((output, context) => {
2251
2310
  return { $unknown: Object.entries(output)[0] };
2252
2311
  }, "de_ContentBlock");
2253
2312
  var de_ContentBlockDelta = /* @__PURE__ */ __name((output, context) => {
2313
+ if (output.citation != null) {
2314
+ return {
2315
+ citation: (0, import_smithy_client._json)(output.citation)
2316
+ };
2317
+ }
2254
2318
  if (output.reasoningContent != null) {
2255
2319
  return {
2256
2320
  reasoningContent: de_ReasoningContentBlockDelta((0, import_core2.awsExpectUnion)(output.reasoningContent), context)
@@ -2308,6 +2372,8 @@ var de_ConverseTrace = /* @__PURE__ */ __name((output, context) => {
2308
2372
  }, "de_ConverseTrace");
2309
2373
  var de_DocumentBlock = /* @__PURE__ */ __name((output, context) => {
2310
2374
  return (0, import_smithy_client.take)(output, {
2375
+ citations: import_smithy_client._json,
2376
+ context: import_smithy_client.expectString,
2311
2377
  format: import_smithy_client.expectString,
2312
2378
  name: import_smithy_client.expectString,
2313
2379
  source: /* @__PURE__ */ __name((_) => de_DocumentSource((0, import_core2.awsExpectUnion)(_), context), "source")
@@ -2319,11 +2385,19 @@ var de_DocumentSource = /* @__PURE__ */ __name((output, context) => {
2319
2385
  bytes: context.base64Decoder(output.bytes)
2320
2386
  };
2321
2387
  }
2388
+ if (output.content != null) {
2389
+ return {
2390
+ content: (0, import_smithy_client._json)(output.content)
2391
+ };
2392
+ }
2322
2393
  if (output.s3Location != null) {
2323
2394
  return {
2324
2395
  s3Location: (0, import_smithy_client._json)(output.s3Location)
2325
2396
  };
2326
2397
  }
2398
+ if ((0, import_smithy_client.expectString)(output.text) !== void 0) {
2399
+ return { text: (0, import_smithy_client.expectString)(output.text) };
2400
+ }
2327
2401
  return { $unknown: Object.entries(output)[0] };
2328
2402
  }, "de_DocumentSource");
2329
2403
  var de_GuardrailAssessment = /* @__PURE__ */ __name((output, context) => {
@@ -2805,7 +2879,11 @@ var paginateListAsyncInvokes = (0, import_core.createPaginator)(BedrockRuntimeCl
2805
2879
  GuardrailManagedWordType,
2806
2880
  GuardrailTrace,
2807
2881
  CachePointType,
2882
+ CitationLocation,
2883
+ CitationSourceContent,
2884
+ CitationGeneratedContent,
2808
2885
  DocumentFormat,
2886
+ DocumentContentBlock,
2809
2887
  DocumentSource,
2810
2888
  GuardrailConverseImageFormat,
2811
2889
  GuardrailConverseImageSource,
@@ -6,8 +6,10 @@ const package_json_1 = tslib_1.__importDefault(require("../package.json"));
6
6
  const core_1 = require("@aws-sdk/core");
7
7
  const credential_provider_node_1 = require("@aws-sdk/credential-provider-node");
8
8
  const eventstream_handler_node_1 = require("@aws-sdk/eventstream-handler-node");
9
+ const token_providers_1 = require("@aws-sdk/token-providers");
9
10
  const util_user_agent_node_1 = require("@aws-sdk/util-user-agent-node");
10
11
  const config_resolver_1 = require("@smithy/config-resolver");
12
+ const core_2 = require("@smithy/core");
11
13
  const eventstream_serde_node_1 = require("@smithy/eventstream-serde-node");
12
14
  const hash_node_1 = require("@smithy/hash-node");
13
15
  const middleware_retry_1 = require("@smithy/middleware-retry");
@@ -28,6 +30,7 @@ const getRuntimeConfig = (config) => {
28
30
  const loaderConfig = {
29
31
  profile: config?.profile,
30
32
  logger: clientSharedValues.logger,
33
+ signingName: "bedrock",
31
34
  };
32
35
  return {
33
36
  ...clientSharedValues,
@@ -41,6 +44,26 @@ const getRuntimeConfig = (config) => {
41
44
  (0, util_user_agent_node_1.createDefaultUserAgentProvider)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
42
45
  eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ?? eventstream_handler_node_1.eventStreamPayloadHandlerProvider,
43
46
  eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventstream_serde_node_1.eventStreamSerdeProvider,
47
+ httpAuthSchemes: config?.httpAuthSchemes ?? [
48
+ {
49
+ schemeId: "aws.auth#sigv4",
50
+ identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
51
+ signer: new core_1.AwsSdkSigV4Signer(),
52
+ },
53
+ {
54
+ schemeId: "smithy.api#httpBearerAuth",
55
+ identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#httpBearerAuth") ||
56
+ (async (idProps) => {
57
+ try {
58
+ return await (0, token_providers_1.fromEnvSigningName)({ signingName: "bedrock" })();
59
+ }
60
+ catch (error) {
61
+ return await (0, token_providers_1.nodeProvider)(idProps)(idProps);
62
+ }
63
+ }),
64
+ signer: new core_2.HttpBearerAuthSigner(),
65
+ },
66
+ ],
44
67
  maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
45
68
  region: config?.region ??
46
69
  (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, { ...config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRuntimeConfig = void 0;
4
4
  const core_1 = require("@aws-sdk/core");
5
+ const core_2 = require("@smithy/core");
5
6
  const smithy_client_1 = require("@smithy/smithy-client");
6
7
  const url_parser_1 = require("@smithy/url-parser");
7
8
  const util_base64_1 = require("@smithy/util-base64");
@@ -23,6 +24,11 @@ const getRuntimeConfig = (config) => {
23
24
  identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
24
25
  signer: new core_1.AwsSdkSigV4Signer(),
25
26
  },
27
+ {
28
+ schemeId: "smithy.api#httpBearerAuth",
29
+ identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#httpBearerAuth"),
30
+ signer: new core_2.HttpBearerAuthSigner(),
31
+ },
26
32
  ],
27
33
  logger: config?.logger ?? new smithy_client_1.NoOpLogger(),
28
34
  serviceId: config?.serviceId ?? "Bedrock Runtime",
@@ -42,6 +42,7 @@ export class BedrockRuntimeClient extends __Client {
42
42
  httpAuthSchemeParametersProvider: defaultBedrockRuntimeHttpAuthSchemeParametersProvider,
43
43
  identityProviderConfigProvider: async (config) => new DefaultIdentityProviderConfig({
44
44
  "aws.auth#sigv4": config.credentials,
45
+ "smithy.api#httpBearerAuth": config.token,
45
46
  }),
46
47
  }));
47
48
  this.middlewareStack.use(getHttpSigningPlugin(this.config));
@@ -2,6 +2,7 @@ export const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
2
2
  const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
3
3
  let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
4
4
  let _credentials = runtimeConfig.credentials;
5
+ let _token = runtimeConfig.token;
5
6
  return {
6
7
  setHttpAuthScheme(httpAuthScheme) {
7
8
  const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
@@ -27,6 +28,12 @@ export const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
27
28
  credentials() {
28
29
  return _credentials;
29
30
  },
31
+ setToken(token) {
32
+ _token = token;
33
+ },
34
+ token() {
35
+ return _token;
36
+ },
30
37
  };
31
38
  };
32
39
  export const resolveHttpAuthRuntimeConfig = (config) => {
@@ -34,5 +41,6 @@ export const resolveHttpAuthRuntimeConfig = (config) => {
34
41
  httpAuthSchemes: config.httpAuthSchemes(),
35
42
  httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
36
43
  credentials: config.credentials(),
44
+ token: config.token(),
37
45
  };
38
46
  };
@@ -1,4 +1,5 @@
1
1
  import { resolveAwsSdkSigV4Config, } from "@aws-sdk/core";
2
+ import { doesIdentityRequireRefresh, isIdentityExpired, memoizeIdentityProvider } from "@smithy/core";
2
3
  import { getSmithyContext, normalizeProvider } from "@smithy/util-middleware";
3
4
  export const defaultBedrockRuntimeHttpAuthSchemeParametersProvider = async (config, context, input) => {
4
5
  return {
@@ -24,18 +25,34 @@ function createAwsAuthSigv4HttpAuthOption(authParameters) {
24
25
  }),
25
26
  };
26
27
  }
28
+ function createSmithyApiHttpBearerAuthHttpAuthOption(authParameters) {
29
+ return {
30
+ schemeId: "smithy.api#httpBearerAuth",
31
+ propertiesExtractor: ({ profile, filepath, configFilepath, ignoreCache }, context) => ({
32
+ identityProperties: {
33
+ profile,
34
+ filepath,
35
+ configFilepath,
36
+ ignoreCache,
37
+ },
38
+ }),
39
+ };
40
+ }
27
41
  export const defaultBedrockRuntimeHttpAuthSchemeProvider = (authParameters) => {
28
42
  const options = [];
29
43
  switch (authParameters.operation) {
30
44
  default: {
31
45
  options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
46
+ options.push(createSmithyApiHttpBearerAuthHttpAuthOption(authParameters));
32
47
  }
33
48
  }
34
49
  return options;
35
50
  };
36
51
  export const resolveHttpAuthSchemeConfig = (config) => {
52
+ const token = memoizeIdentityProvider(config.token, isIdentityExpired, doesIdentityRequireRefresh);
37
53
  const config_0 = resolveAwsSdkSigV4Config(config);
38
54
  return Object.assign(config_0, {
39
55
  authSchemePreference: normalizeProvider(config.authSchemePreference ?? []),
56
+ token,
40
57
  });
41
58
  };
@@ -247,6 +247,34 @@ export const GuardrailTrace = {
247
247
  export const CachePointType = {
248
248
  DEFAULT: "default",
249
249
  };
250
+ export var CitationLocation;
251
+ (function (CitationLocation) {
252
+ CitationLocation.visit = (value, visitor) => {
253
+ if (value.documentChar !== undefined)
254
+ return visitor.documentChar(value.documentChar);
255
+ if (value.documentPage !== undefined)
256
+ return visitor.documentPage(value.documentPage);
257
+ if (value.documentChunk !== undefined)
258
+ return visitor.documentChunk(value.documentChunk);
259
+ return visitor._(value.$unknown[0], value.$unknown[1]);
260
+ };
261
+ })(CitationLocation || (CitationLocation = {}));
262
+ export var CitationSourceContent;
263
+ (function (CitationSourceContent) {
264
+ CitationSourceContent.visit = (value, visitor) => {
265
+ if (value.text !== undefined)
266
+ return visitor.text(value.text);
267
+ return visitor._(value.$unknown[0], value.$unknown[1]);
268
+ };
269
+ })(CitationSourceContent || (CitationSourceContent = {}));
270
+ export var CitationGeneratedContent;
271
+ (function (CitationGeneratedContent) {
272
+ CitationGeneratedContent.visit = (value, visitor) => {
273
+ if (value.text !== undefined)
274
+ return visitor.text(value.text);
275
+ return visitor._(value.$unknown[0], value.$unknown[1]);
276
+ };
277
+ })(CitationGeneratedContent || (CitationGeneratedContent = {}));
250
278
  export const DocumentFormat = {
251
279
  CSV: "csv",
252
280
  DOC: "doc",
@@ -258,6 +286,14 @@ export const DocumentFormat = {
258
286
  XLS: "xls",
259
287
  XLSX: "xlsx",
260
288
  };
289
+ export var DocumentContentBlock;
290
+ (function (DocumentContentBlock) {
291
+ DocumentContentBlock.visit = (value, visitor) => {
292
+ if (value.text !== undefined)
293
+ return visitor.text(value.text);
294
+ return visitor._(value.$unknown[0], value.$unknown[1]);
295
+ };
296
+ })(DocumentContentBlock || (DocumentContentBlock = {}));
261
297
  export var DocumentSource;
262
298
  (function (DocumentSource) {
263
299
  DocumentSource.visit = (value, visitor) => {
@@ -265,6 +301,10 @@ export var DocumentSource;
265
301
  return visitor.bytes(value.bytes);
266
302
  if (value.s3Location !== undefined)
267
303
  return visitor.s3Location(value.s3Location);
304
+ if (value.text !== undefined)
305
+ return visitor.text(value.text);
306
+ if (value.content !== undefined)
307
+ return visitor.content(value.content);
268
308
  return visitor._(value.$unknown[0], value.$unknown[1]);
269
309
  };
270
310
  })(DocumentSource || (DocumentSource = {}));
@@ -383,6 +423,8 @@ export var ContentBlock;
383
423
  return visitor.cachePoint(value.cachePoint);
384
424
  if (value.reasoningContent !== undefined)
385
425
  return visitor.reasoningContent(value.reasoningContent);
426
+ if (value.citationsContent !== undefined)
427
+ return visitor.citationsContent(value.citationsContent);
386
428
  return visitor._(value.$unknown[0], value.$unknown[1]);
387
429
  };
388
430
  })(ContentBlock || (ContentBlock = {}));
@@ -526,6 +568,8 @@ export var ContentBlockDelta;
526
568
  return visitor.toolUse(value.toolUse);
527
569
  if (value.reasoningContent !== undefined)
528
570
  return visitor.reasoningContent(value.reasoningContent);
571
+ if (value.citation !== undefined)
572
+ return visitor.citation(value.citation);
529
573
  return visitor._(value.$unknown[0], value.$unknown[1]);
530
574
  };
531
575
  })(ContentBlockDelta || (ContentBlockDelta = {}));
@@ -725,6 +769,8 @@ export const ContentBlockFilterSensitiveLog = (obj) => {
725
769
  return { cachePoint: obj.cachePoint };
726
770
  if (obj.reasoningContent !== undefined)
727
771
  return { reasoningContent: SENSITIVE_STRING };
772
+ if (obj.citationsContent !== undefined)
773
+ return { citationsContent: obj.citationsContent };
728
774
  if (obj.$unknown !== undefined)
729
775
  return { [obj.$unknown[0]]: "UNKNOWN" };
730
776
  };
@@ -785,6 +831,8 @@ export const ContentBlockDeltaFilterSensitiveLog = (obj) => {
785
831
  return { toolUse: obj.toolUse };
786
832
  if (obj.reasoningContent !== undefined)
787
833
  return { reasoningContent: SENSITIVE_STRING };
834
+ if (obj.citation !== undefined)
835
+ return { citation: obj.citation };
788
836
  if (obj.$unknown !== undefined)
789
837
  return { [obj.$unknown[0]]: "UNKNOWN" };
790
838
  };
@@ -769,6 +769,7 @@ const se_BidirectionalInputPayloadPart = (input, context) => {
769
769
  const se_ContentBlock = (input, context) => {
770
770
  return ContentBlock.visit(input, {
771
771
  cachePoint: (value) => ({ cachePoint: _json(value) }),
772
+ citationsContent: (value) => ({ citationsContent: _json(value) }),
772
773
  document: (value) => ({ document: se_DocumentBlock(value, context) }),
773
774
  guardContent: (value) => ({ guardContent: se_GuardrailConverseContentBlock(value, context) }),
774
775
  image: (value) => ({ image: se_ImageBlock(value, context) }),
@@ -789,6 +790,8 @@ const se_ContentBlocks = (input, context) => {
789
790
  };
790
791
  const se_DocumentBlock = (input, context) => {
791
792
  return take(input, {
793
+ citations: _json,
794
+ context: [],
792
795
  format: [],
793
796
  name: [],
794
797
  source: (_) => se_DocumentSource(_, context),
@@ -797,7 +800,9 @@ const se_DocumentBlock = (input, context) => {
797
800
  const se_DocumentSource = (input, context) => {
798
801
  return DocumentSource.visit(input, {
799
802
  bytes: (value) => ({ bytes: context.base64Encoder(value) }),
803
+ content: (value) => ({ content: _json(value) }),
800
804
  s3Location: (value) => ({ s3Location: _json(value) }),
805
+ text: (value) => ({ text: value }),
801
806
  _: (name, value) => ({ [name]: value }),
802
807
  });
803
808
  };
@@ -1017,6 +1022,11 @@ const de_ContentBlock = (output, context) => {
1017
1022
  cachePoint: _json(output.cachePoint),
1018
1023
  };
1019
1024
  }
1025
+ if (output.citationsContent != null) {
1026
+ return {
1027
+ citationsContent: _json(output.citationsContent),
1028
+ };
1029
+ }
1020
1030
  if (output.document != null) {
1021
1031
  return {
1022
1032
  document: de_DocumentBlock(output.document, context),
@@ -1058,6 +1068,11 @@ const de_ContentBlock = (output, context) => {
1058
1068
  return { $unknown: Object.entries(output)[0] };
1059
1069
  };
1060
1070
  const de_ContentBlockDelta = (output, context) => {
1071
+ if (output.citation != null) {
1072
+ return {
1073
+ citation: _json(output.citation),
1074
+ };
1075
+ }
1061
1076
  if (output.reasoningContent != null) {
1062
1077
  return {
1063
1078
  reasoningContent: de_ReasoningContentBlockDelta(__expectUnion(output.reasoningContent), context),
@@ -1117,6 +1132,8 @@ const de_ConverseTrace = (output, context) => {
1117
1132
  };
1118
1133
  const de_DocumentBlock = (output, context) => {
1119
1134
  return take(output, {
1135
+ citations: _json,
1136
+ context: __expectString,
1120
1137
  format: __expectString,
1121
1138
  name: __expectString,
1122
1139
  source: (_) => de_DocumentSource(__expectUnion(_), context),
@@ -1128,11 +1145,19 @@ const de_DocumentSource = (output, context) => {
1128
1145
  bytes: context.base64Decoder(output.bytes),
1129
1146
  };
1130
1147
  }
1148
+ if (output.content != null) {
1149
+ return {
1150
+ content: _json(output.content),
1151
+ };
1152
+ }
1131
1153
  if (output.s3Location != null) {
1132
1154
  return {
1133
1155
  s3Location: _json(output.s3Location),
1134
1156
  };
1135
1157
  }
1158
+ if (__expectString(output.text) !== undefined) {
1159
+ return { text: __expectString(output.text) };
1160
+ }
1136
1161
  return { $unknown: Object.entries(output)[0] };
1137
1162
  };
1138
1163
  const de_GuardrailAssessment = (output, context) => {
@@ -1,9 +1,11 @@
1
1
  import packageInfo from "../package.json";
2
- import { NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, emitWarningIfUnsupportedVersion as awsCheckVersion } from "@aws-sdk/core";
2
+ import { AwsSdkSigV4Signer, NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, emitWarningIfUnsupportedVersion as awsCheckVersion, } from "@aws-sdk/core";
3
3
  import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node";
4
4
  import { eventStreamPayloadHandlerProvider } from "@aws-sdk/eventstream-handler-node";
5
+ import { fromEnvSigningName, nodeProvider } from "@aws-sdk/token-providers";
5
6
  import { NODE_APP_ID_CONFIG_OPTIONS, createDefaultUserAgentProvider } from "@aws-sdk/util-user-agent-node";
6
7
  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";
8
+ import { HttpBearerAuthSigner } from "@smithy/core";
7
9
  import { eventStreamSerdeProvider } from "@smithy/eventstream-serde-node";
8
10
  import { Hash } from "@smithy/hash-node";
9
11
  import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@smithy/middleware-retry";
@@ -24,6 +26,7 @@ export const getRuntimeConfig = (config) => {
24
26
  const loaderConfig = {
25
27
  profile: config?.profile,
26
28
  logger: clientSharedValues.logger,
29
+ signingName: "bedrock",
27
30
  };
28
31
  return {
29
32
  ...clientSharedValues,
@@ -37,6 +40,26 @@ export const getRuntimeConfig = (config) => {
37
40
  createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
38
41
  eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ?? eventStreamPayloadHandlerProvider,
39
42
  eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventStreamSerdeProvider,
43
+ httpAuthSchemes: config?.httpAuthSchemes ?? [
44
+ {
45
+ schemeId: "aws.auth#sigv4",
46
+ identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
47
+ signer: new AwsSdkSigV4Signer(),
48
+ },
49
+ {
50
+ schemeId: "smithy.api#httpBearerAuth",
51
+ identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#httpBearerAuth") ||
52
+ (async (idProps) => {
53
+ try {
54
+ return await fromEnvSigningName({ signingName: "bedrock" })();
55
+ }
56
+ catch (error) {
57
+ return await nodeProvider(idProps)(idProps);
58
+ }
59
+ }),
60
+ signer: new HttpBearerAuthSigner(),
61
+ },
62
+ ],
40
63
  maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
41
64
  region: config?.region ??
42
65
  loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
@@ -1,4 +1,5 @@
1
1
  import { AwsSdkSigV4Signer } from "@aws-sdk/core";
2
+ import { HttpBearerAuthSigner } from "@smithy/core";
2
3
  import { NoOpLogger } from "@smithy/smithy-client";
3
4
  import { parseUrl } from "@smithy/url-parser";
4
5
  import { fromBase64, toBase64 } from "@smithy/util-base64";
@@ -20,6 +21,11 @@ export const getRuntimeConfig = (config) => {
20
21
  identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
21
22
  signer: new AwsSdkSigV4Signer(),
22
23
  },
24
+ {
25
+ schemeId: "smithy.api#httpBearerAuth",
26
+ identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#httpBearerAuth"),
27
+ signer: new HttpBearerAuthSigner(),
28
+ },
23
29
  ],
24
30
  logger: config?.logger ?? new NoOpLogger(),
25
31
  serviceId: config?.serviceId ?? "Bedrock Runtime",