@aws-sdk/client-bedrock-agent-runtime 3.474.0 → 3.477.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.
@@ -2,20 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.de_RetrieveAndGenerateCommand = exports.de_RetrieveCommand = exports.de_InvokeAgentCommand = exports.se_RetrieveAndGenerateCommand = exports.se_RetrieveCommand = exports.se_InvokeAgentCommand = void 0;
4
4
  const core_1 = require("@aws-sdk/core");
5
- const protocol_http_1 = require("@smithy/protocol-http");
5
+ const core_2 = require("@smithy/core");
6
6
  const smithy_client_1 = require("@smithy/smithy-client");
7
7
  const BedrockAgentRuntimeServiceException_1 = require("../models/BedrockAgentRuntimeServiceException");
8
8
  const models_0_1 = require("../models/models_0");
9
9
  const se_InvokeAgentCommand = async (input, context) => {
10
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
10
+ const b = (0, core_2.requestBuilder)(input, context);
11
11
  const headers = {
12
12
  "content-type": "application/json",
13
13
  };
14
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
15
- "/agents/{agentId}/agentAliases/{agentAliasId}/sessions/{sessionId}/text";
16
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "agentId", () => input.agentId, "{agentId}", false);
17
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "agentAliasId", () => input.agentAliasId, "{agentAliasId}", false);
18
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
14
+ b.bp("/agents/{agentId}/agentAliases/{agentAliasId}/sessions/{sessionId}/text");
15
+ b.p("agentId", () => input.agentId, "{agentId}", false);
16
+ b.p("agentAliasId", () => input.agentAliasId, "{agentAliasId}", false);
17
+ b.p("sessionId", () => input.sessionId, "{sessionId}", false);
19
18
  let body;
20
19
  body = JSON.stringify((0, smithy_client_1.take)(input, {
21
20
  enableTrace: [],
@@ -23,48 +22,33 @@ const se_InvokeAgentCommand = async (input, context) => {
23
22
  inputText: [],
24
23
  sessionState: (_) => (0, smithy_client_1._json)(_),
25
24
  }));
26
- return new protocol_http_1.HttpRequest({
27
- protocol,
28
- hostname,
29
- port,
30
- method: "POST",
31
- headers,
32
- path: resolvedPath,
33
- body,
34
- });
25
+ b.m("POST").h(headers).b(body);
26
+ return b.build();
35
27
  };
36
28
  exports.se_InvokeAgentCommand = se_InvokeAgentCommand;
37
29
  const se_RetrieveCommand = async (input, context) => {
38
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
30
+ const b = (0, core_2.requestBuilder)(input, context);
39
31
  const headers = {
40
32
  "content-type": "application/json",
41
33
  };
42
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
43
- "/knowledgebases/{knowledgeBaseId}/retrieve";
44
- resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
34
+ b.bp("/knowledgebases/{knowledgeBaseId}/retrieve");
35
+ b.p("knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
45
36
  let body;
46
37
  body = JSON.stringify((0, smithy_client_1.take)(input, {
47
38
  nextToken: [],
48
39
  retrievalConfiguration: (_) => (0, smithy_client_1._json)(_),
49
40
  retrievalQuery: (_) => (0, smithy_client_1._json)(_),
50
41
  }));
51
- return new protocol_http_1.HttpRequest({
52
- protocol,
53
- hostname,
54
- port,
55
- method: "POST",
56
- headers,
57
- path: resolvedPath,
58
- body,
59
- });
42
+ b.m("POST").h(headers).b(body);
43
+ return b.build();
60
44
  };
61
45
  exports.se_RetrieveCommand = se_RetrieveCommand;
62
46
  const se_RetrieveAndGenerateCommand = async (input, context) => {
63
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
47
+ const b = (0, core_2.requestBuilder)(input, context);
64
48
  const headers = {
65
49
  "content-type": "application/json",
66
50
  };
67
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/retrieveAndGenerate";
51
+ b.bp("/retrieveAndGenerate");
68
52
  let body;
69
53
  body = JSON.stringify((0, smithy_client_1.take)(input, {
70
54
  input: (_) => (0, smithy_client_1._json)(_),
@@ -72,15 +56,8 @@ const se_RetrieveAndGenerateCommand = async (input, context) => {
72
56
  sessionConfiguration: (_) => (0, smithy_client_1._json)(_),
73
57
  sessionId: [],
74
58
  }));
75
- return new protocol_http_1.HttpRequest({
76
- protocol,
77
- hostname,
78
- port,
79
- method: "POST",
80
- headers,
81
- path: resolvedPath,
82
- body,
83
- });
59
+ b.m("POST").h(headers).b(body);
60
+ return b.build();
84
61
  };
85
62
  exports.se_RetrieveAndGenerateCommand = se_RetrieveAndGenerateCommand;
86
63
  const de_InvokeAgentCommand = async (output, context) => {
@@ -89,8 +66,8 @@ const de_InvokeAgentCommand = async (output, context) => {
89
66
  }
90
67
  const contents = (0, smithy_client_1.map)({
91
68
  $metadata: deserializeMetadata(output),
92
- contentType: [, output.headers["x-amzn-bedrock-agent-content-type"]],
93
- sessionId: [, output.headers["x-amz-bedrock-agent-session-id"]],
69
+ [_cT]: [, output.headers[_xabact]],
70
+ [_sI]: [, output.headers[_xabasi]],
94
71
  });
95
72
  const data = output.body;
96
73
  contents.completion = de_ResponseStream(data, context);
@@ -647,6 +624,10 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
647
624
  value !== "" &&
648
625
  (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
649
626
  (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
627
+ const _cT = "contentType";
628
+ const _sI = "sessionId";
629
+ const _xabact = "x-amzn-bedrock-agent-content-type";
630
+ const _xabasi = "x-amz-bedrock-agent-session-id";
650
631
  const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
651
632
  if (encoded.length) {
652
633
  return JSON.parse(encoded);
@@ -1,18 +1,17 @@
1
1
  import { awsExpectUnion as __expectUnion } from "@aws-sdk/core";
2
- import { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
3
- import { _json, collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, limitedParseFloat32 as __limitedParseFloat32, map, resolvedPath as __resolvedPath, take, withBaseException, } from "@smithy/smithy-client";
2
+ import { requestBuilder as rb } from "@smithy/core";
3
+ import { _json, collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, limitedParseFloat32 as __limitedParseFloat32, map, take, withBaseException, } from "@smithy/smithy-client";
4
4
  import { BedrockAgentRuntimeServiceException as __BaseException } from "../models/BedrockAgentRuntimeServiceException";
5
5
  import { AccessDeniedException, BadGatewayException, ConflictException, DependencyFailedException, InternalServerException, ResourceNotFoundException, ServiceQuotaExceededException, ThrottlingException, ValidationException, } from "../models/models_0";
6
6
  export const se_InvokeAgentCommand = async (input, context) => {
7
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
7
+ const b = rb(input, context);
8
8
  const headers = {
9
9
  "content-type": "application/json",
10
10
  };
11
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
12
- "/agents/{agentId}/agentAliases/{agentAliasId}/sessions/{sessionId}/text";
13
- resolvedPath = __resolvedPath(resolvedPath, input, "agentId", () => input.agentId, "{agentId}", false);
14
- resolvedPath = __resolvedPath(resolvedPath, input, "agentAliasId", () => input.agentAliasId, "{agentAliasId}", false);
15
- resolvedPath = __resolvedPath(resolvedPath, input, "sessionId", () => input.sessionId, "{sessionId}", false);
11
+ b.bp("/agents/{agentId}/agentAliases/{agentAliasId}/sessions/{sessionId}/text");
12
+ b.p("agentId", () => input.agentId, "{agentId}", false);
13
+ b.p("agentAliasId", () => input.agentAliasId, "{agentAliasId}", false);
14
+ b.p("sessionId", () => input.sessionId, "{sessionId}", false);
16
15
  let body;
17
16
  body = JSON.stringify(take(input, {
18
17
  enableTrace: [],
@@ -20,46 +19,31 @@ export const se_InvokeAgentCommand = async (input, context) => {
20
19
  inputText: [],
21
20
  sessionState: (_) => _json(_),
22
21
  }));
23
- return new __HttpRequest({
24
- protocol,
25
- hostname,
26
- port,
27
- method: "POST",
28
- headers,
29
- path: resolvedPath,
30
- body,
31
- });
22
+ b.m("POST").h(headers).b(body);
23
+ return b.build();
32
24
  };
33
25
  export const se_RetrieveCommand = async (input, context) => {
34
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
26
+ const b = rb(input, context);
35
27
  const headers = {
36
28
  "content-type": "application/json",
37
29
  };
38
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
39
- "/knowledgebases/{knowledgeBaseId}/retrieve";
40
- resolvedPath = __resolvedPath(resolvedPath, input, "knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
30
+ b.bp("/knowledgebases/{knowledgeBaseId}/retrieve");
31
+ b.p("knowledgeBaseId", () => input.knowledgeBaseId, "{knowledgeBaseId}", false);
41
32
  let body;
42
33
  body = JSON.stringify(take(input, {
43
34
  nextToken: [],
44
35
  retrievalConfiguration: (_) => _json(_),
45
36
  retrievalQuery: (_) => _json(_),
46
37
  }));
47
- return new __HttpRequest({
48
- protocol,
49
- hostname,
50
- port,
51
- method: "POST",
52
- headers,
53
- path: resolvedPath,
54
- body,
55
- });
38
+ b.m("POST").h(headers).b(body);
39
+ return b.build();
56
40
  };
57
41
  export const se_RetrieveAndGenerateCommand = async (input, context) => {
58
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
42
+ const b = rb(input, context);
59
43
  const headers = {
60
44
  "content-type": "application/json",
61
45
  };
62
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/retrieveAndGenerate";
46
+ b.bp("/retrieveAndGenerate");
63
47
  let body;
64
48
  body = JSON.stringify(take(input, {
65
49
  input: (_) => _json(_),
@@ -67,15 +51,8 @@ export const se_RetrieveAndGenerateCommand = async (input, context) => {
67
51
  sessionConfiguration: (_) => _json(_),
68
52
  sessionId: [],
69
53
  }));
70
- return new __HttpRequest({
71
- protocol,
72
- hostname,
73
- port,
74
- method: "POST",
75
- headers,
76
- path: resolvedPath,
77
- body,
78
- });
54
+ b.m("POST").h(headers).b(body);
55
+ return b.build();
79
56
  };
80
57
  export const de_InvokeAgentCommand = async (output, context) => {
81
58
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -83,8 +60,8 @@ export const de_InvokeAgentCommand = async (output, context) => {
83
60
  }
84
61
  const contents = map({
85
62
  $metadata: deserializeMetadata(output),
86
- contentType: [, output.headers["x-amzn-bedrock-agent-content-type"]],
87
- sessionId: [, output.headers["x-amz-bedrock-agent-session-id"]],
63
+ [_cT]: [, output.headers[_xabact]],
64
+ [_sI]: [, output.headers[_xabasi]],
88
65
  });
89
66
  const data = output.body;
90
67
  contents.completion = de_ResponseStream(data, context);
@@ -638,6 +615,10 @@ const isSerializableHeaderValue = (value) => value !== undefined &&
638
615
  value !== "" &&
639
616
  (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
640
617
  (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
618
+ const _cT = "contentType";
619
+ const _sI = "sessionId";
620
+ const _xabact = "x-amzn-bedrock-agent-content-type";
621
+ const _xabasi = "x-amz-bedrock-agent-session-id";
641
622
  const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
642
623
  if (encoded.length) {
643
624
  return JSON.parse(encoded);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-bedrock-agent-runtime",
3
3
  "description": "AWS SDK for JavaScript Bedrock Agent Runtime Client for Node.js, Browser and React Native",
4
- "version": "3.474.0",
4
+ "version": "3.477.0",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -20,9 +20,9 @@
20
20
  "dependencies": {
21
21
  "@aws-crypto/sha256-browser": "3.0.0",
22
22
  "@aws-crypto/sha256-js": "3.0.0",
23
- "@aws-sdk/client-sts": "3.474.0",
24
- "@aws-sdk/core": "3.474.0",
25
- "@aws-sdk/credential-provider-node": "3.474.0",
23
+ "@aws-sdk/client-sts": "3.477.0",
24
+ "@aws-sdk/core": "3.477.0",
25
+ "@aws-sdk/credential-provider-node": "3.477.0",
26
26
  "@aws-sdk/middleware-host-header": "3.468.0",
27
27
  "@aws-sdk/middleware-logger": "3.468.0",
28
28
  "@aws-sdk/middleware-recursion-detection": "3.468.0",
@@ -34,6 +34,7 @@
34
34
  "@aws-sdk/util-user-agent-browser": "3.468.0",
35
35
  "@aws-sdk/util-user-agent-node": "3.470.0",
36
36
  "@smithy/config-resolver": "^2.0.21",
37
+ "@smithy/core": "^1.2.0",
37
38
  "@smithy/eventstream-serde-browser": "^2.0.15",
38
39
  "@smithy/eventstream-serde-config-resolver": "^2.0.15",
39
40
  "@smithy/eventstream-serde-node": "^2.0.15",