@xapp/stentor-service-kendra 1.39.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 ADDED
@@ -0,0 +1 @@
1
+ ### Kendra knowledge base service
@@ -0,0 +1,33 @@
1
+ /*! Copyright (c) 2021, XAPPmedia */
2
+ import { KnowledgeBaseResult, KnowledgeBaseService } from "stentor-models";
3
+ import { Kendra } from "aws-sdk/clients/all";
4
+ import { AttributeFilter } from "aws-sdk/clients/kendra";
5
+ import { KendraServiceConfig } from "./model";
6
+ export declare class KendraService implements KnowledgeBaseService {
7
+ config: KendraServiceConfig;
8
+ private readonly credsReceiver;
9
+ readonly kendraRuntime: Promise<Kendra>;
10
+ constructor(props?: KendraServiceConfig);
11
+ /**
12
+ * Query an input text
13
+ *
14
+ * @param query
15
+ * @param props
16
+ */
17
+ query(query: string, props?: KendraServiceConfig): Promise<KnowledgeBaseResult>;
18
+ /**
19
+ * Convert Kendra response to Stentor KB response
20
+ *
21
+ * @param kendraResult
22
+ */
23
+ static convertResult(kendraResult: Kendra.QueryResult): KnowledgeBaseResult;
24
+ /**
25
+ * Create an attr filter to act as a "multi-tenant" filter. Allow any combinations.
26
+ *
27
+ * @param ids
28
+ */
29
+ static createFilter(ids?: {
30
+ appId?: any;
31
+ orgId?: any;
32
+ }): AttributeFilter;
33
+ }
@@ -0,0 +1,199 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.KendraService = void 0;
13
+ const aws_sdk_1 = require("aws-sdk");
14
+ const all_1 = require("aws-sdk/clients/all");
15
+ const stentor_service_lex_1 = require("@xapp/stentor-service-lex");
16
+ const merge = require("lodash.merge");
17
+ class KendraService {
18
+ constructor(props) {
19
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
20
+ this.config = {};
21
+ if (props) {
22
+ this.config = merge(this.config, props);
23
+ }
24
+ this.credsReceiver = new stentor_service_lex_1.AWSCredentialsRetriever({
25
+ key: {
26
+ accessKeyId: (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.credentials) === null || _b === void 0 ? void 0 : _b.accessKeyId,
27
+ secretAccessKey: (_d = (_c = this.config) === null || _c === void 0 ? void 0 : _c.credentials) === null || _d === void 0 ? void 0 : _d.secretAccessKey,
28
+ },
29
+ role: {
30
+ arn: (_f = (_e = this.config.credentials) === null || _e === void 0 ? void 0 : _e.role) === null || _f === void 0 ? void 0 : _f.arn,
31
+ sessionName: "stentor-kendra-service",
32
+ externalId: (_h = (_g = this.config.credentials) === null || _g === void 0 ? void 0 : _g.role) === null || _h === void 0 ? void 0 : _h.externalId,
33
+ },
34
+ });
35
+ // Use profile?
36
+ if (!((_k = (_j = this.config) === null || _j === void 0 ? void 0 : _j.credentials) === null || _k === void 0 ? void 0 : _k.accessKeyId) && process.env.AWS_PROFILE) {
37
+ const credentials = new aws_sdk_1.SharedIniFileCredentials({ profile: process.env.AWS_PROFILE });
38
+ this.config.credentials = merge(this.config.credentials || {}, credentials);
39
+ }
40
+ this.kendraRuntime = this.credsReceiver.getCredentials().then((credentials) => {
41
+ var _a;
42
+ return new all_1.Kendra({
43
+ region: (_a = this.config.credentials) === null || _a === void 0 ? void 0 : _a.region,
44
+ credentials
45
+ });
46
+ });
47
+ }
48
+ /**
49
+ * Query an input text
50
+ *
51
+ * @param query
52
+ * @param props
53
+ */
54
+ query(query, props) {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ const kendra = yield this.kendraRuntime;
57
+ const queryConfig = merge(this.config, props || {});
58
+ const { indexName, resultType, appId, orgId } = queryConfig;
59
+ let indexId = queryConfig.indexId;
60
+ if (!indexId && !indexName) {
61
+ throw new Error("No index name or id was specified");
62
+ }
63
+ if (!indexId && indexName) {
64
+ const indicesResponse = yield kendra.listIndices().promise();
65
+ if (!indicesResponse) {
66
+ throw new Error("Failed to lookup Kendra indices");
67
+ }
68
+ const index = indicesResponse.IndexConfigurationSummaryItems.find((item) => {
69
+ return item.Name === indexName;
70
+ });
71
+ if (!index) {
72
+ throw new Error(`Failed to lookup Kendra index: ${indexName}`);
73
+ }
74
+ indexId = index.Id;
75
+ }
76
+ const kendraRequest = {
77
+ IndexId: indexId,
78
+ QueryText: query,
79
+ QueryResultTypeFilter: resultType,
80
+ AttributeFilter: KendraService.createFilter({ appId, orgId })
81
+ };
82
+ const kendraResult = yield kendra.query(kendraRequest).promise();
83
+ if (!kendraResult) {
84
+ throw new Error(`Failed to get Kendra results for query: ${query}`);
85
+ }
86
+ return KendraService.convertResult(kendraResult);
87
+ });
88
+ }
89
+ /**
90
+ * Convert Kendra response to Stentor KB response
91
+ *
92
+ * @param kendraResult
93
+ */
94
+ static convertResult(kendraResult) {
95
+ const kbResult = { suggested: [], faqs: [], documents: [] };
96
+ kendraResult.ResultItems.forEach((result) => {
97
+ if (result.Type === "ANSWER") {
98
+ let topAnswer;
99
+ let document;
100
+ const highlights = [];
101
+ result.AdditionalAttributes.forEach((attribute) => {
102
+ if (attribute.Key === "AnswerText") {
103
+ document = attribute.Value.TextWithHighlightsValue.Text;
104
+ const kendraHighlights = attribute.Value.TextWithHighlightsValue.Highlights;
105
+ kendraHighlights.forEach((kendraHighlight) => {
106
+ highlights.push({
107
+ beginOffset: kendraHighlight.BeginOffset,
108
+ topAnswer: kendraHighlight.TopAnswer,
109
+ endOffset: kendraHighlight.EndOffset
110
+ });
111
+ if (kendraHighlight.TopAnswer) {
112
+ topAnswer = document.substring(kendraHighlight.BeginOffset, kendraHighlight.EndOffset);
113
+ }
114
+ });
115
+ }
116
+ });
117
+ kbResult.suggested.push({
118
+ title: result.DocumentTitle.Text,
119
+ uri: result.DocumentURI,
120
+ document,
121
+ topAnswer,
122
+ highlights
123
+ });
124
+ }
125
+ else if (result.Type === "QUESTION_ANSWER") {
126
+ let question;
127
+ let document;
128
+ const highlights = [];
129
+ result.AdditionalAttributes.forEach((attribute) => {
130
+ if (attribute.Key === "AnswerText") {
131
+ document = attribute.Value.TextWithHighlightsValue.Text;
132
+ }
133
+ else if (attribute.Key === "QuestionText") {
134
+ question = attribute.Value.TextWithHighlightsValue.Text;
135
+ }
136
+ });
137
+ const kendraHighlights = result.DocumentExcerpt.Highlights;
138
+ kendraHighlights.forEach((kendraHighlight) => {
139
+ highlights.push({
140
+ beginOffset: kendraHighlight.BeginOffset,
141
+ topAnswer: kendraHighlight.TopAnswer,
142
+ endOffset: kendraHighlight.EndOffset
143
+ });
144
+ });
145
+ kbResult.faqs.push({
146
+ question,
147
+ document,
148
+ uri: result.DocumentURI,
149
+ highlights
150
+ });
151
+ }
152
+ else if (result.Type === "DOCUMENT") {
153
+ const highlights = [];
154
+ const kendraHighlights = result.DocumentExcerpt.Highlights;
155
+ kendraHighlights.forEach((kendraHighlight) => {
156
+ highlights.push({
157
+ beginOffset: kendraHighlight.BeginOffset,
158
+ topAnswer: kendraHighlight.TopAnswer,
159
+ endOffset: kendraHighlight.EndOffset
160
+ });
161
+ });
162
+ kbResult.documents.push({
163
+ title: result.DocumentTitle.Text,
164
+ uri: result.DocumentURI,
165
+ document: result.DocumentExcerpt.Text,
166
+ highlights
167
+ });
168
+ }
169
+ });
170
+ return kbResult;
171
+ }
172
+ /**
173
+ * Create an attr filter to act as a "multi-tenant" filter. Allow any combinations.
174
+ *
175
+ * @param ids
176
+ */
177
+ static createFilter(ids) {
178
+ const { appId, orgId } = ids || {};
179
+ if (!appId && !orgId) {
180
+ return undefined;
181
+ }
182
+ const filter = {
183
+ AndAllFilters: []
184
+ };
185
+ if (appId) {
186
+ filter.AndAllFilters.push({
187
+ EqualsTo: { Key: "appId", Value: { StringValue: appId } }
188
+ });
189
+ }
190
+ if (orgId) {
191
+ filter.AndAllFilters.push({
192
+ EqualsTo: { Key: "orgId", Value: { StringValue: orgId } }
193
+ });
194
+ }
195
+ return filter;
196
+ }
197
+ }
198
+ exports.KendraService = KendraService;
199
+ //# sourceMappingURL=KendraService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KendraService.js","sourceRoot":"","sources":["../src/KendraService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,qCAAmD;AACnD,6CAA6C;AAG7C,mEAAoE;AAGpE,MAAM,KAAK,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAEtC,MAAa,aAAa;IAOtB,YAAY,KAA2B;;QANvC,WAAM,GAAwB,EAAG,CAAC;QAO9B,IAAI,KAAK,EAAE;YACP,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SAC3C;QAED,IAAI,CAAC,aAAa,GAAG,IAAI,6CAAuB,CAAC;YAC7C,GAAG,EAAE;gBACD,WAAW,EAAE,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,WAAW,0CAAE,WAAW;gBAClD,eAAe,EAAE,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,WAAW,0CAAE,eAAe;aAC7D;YACD,IAAI,EAAE;gBACF,GAAG,EAAE,MAAA,MAAA,IAAI,CAAC,MAAM,CAAC,WAAW,0CAAE,IAAI,0CAAE,GAAG;gBACvC,WAAW,EAAE,wBAAwB;gBACrC,UAAU,EAAE,MAAA,MAAA,IAAI,CAAC,MAAM,CAAC,WAAW,0CAAE,IAAI,0CAAE,UAAU;aACxD;SACJ,CAAC,CAAC;QAEH,eAAe;QACf,IAAI,CAAC,CAAA,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,WAAW,0CAAE,WAAW,C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KAAK,EAAE,GAAG,GAAG,IAAI,EAAE,CAAC;QAElC,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE;YAClB,OAAO,SAAS,CAAC;SACpB;QAED,MAAM,MAAM,GAAoB;YAC5B,aAAa,EAAE,EAAE;SACpB,CAAC;QAEF,IAAI,KAAK,EAAE;YACP,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC;gBACtB,QAAQ,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE;aAC5D,CAAC,CAAC;SACN;QAED,IAAI,KAAK,EAAE;YACP,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC;gBACtB,QAAQ,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE;aAC5D,CAAC,CAAC;SACN;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAnND,sCAmNC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ /*! Copyright (c) 2019, XAPPmedia */
2
+ export * from "./KendraService";
3
+ export * from "./model";
package/lib/index.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ /*! Copyright (c) 2019, XAPPmedia */
14
+ __exportStar(require("./KendraService"), exports);
15
+ __exportStar(require("./model"), exports);
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAAoC;AACpC,kDAAgC;AAChC,0CAAwB"}
package/lib/model.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ /*! Copyright (c) 2021, XAPPmedia */
2
+ export interface KendraServiceConfig {
3
+ appId?: string;
4
+ orgId?: string;
5
+ indexId?: string;
6
+ indexName?: string;
7
+ resultType?: "DOCUMENT" | "QUESTION_ANSWER" | "ANSWER";
8
+ credentials?: {
9
+ region?: string;
10
+ accessKeyId?: string;
11
+ secretAccessKey?: string;
12
+ role?: {
13
+ arn: string;
14
+ externalId: string;
15
+ };
16
+ };
17
+ }
package/lib/model.js ADDED
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ /*! Copyright (c) 2021, XAPPmedia */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":";AAAA,oCAAoC"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@xapp/stentor-service-kendra",
3
+ "license": "UNLICENSED",
4
+ "publishConfig": {
5
+ "access": "restricted"
6
+ },
7
+ "version": "1.39.0",
8
+ "description": "Kendra Knowledge Base Service",
9
+ "types": "lib/index",
10
+ "main": "lib/index",
11
+ "files": [
12
+ "lib"
13
+ ],
14
+ "engines": {
15
+ "node": "^10 || ^12 || ^14"
16
+ },
17
+ "devDependencies": {
18
+ "@types/chai": "4.2.22",
19
+ "@types/dialogflow": "0.11.0",
20
+ "@xapp/config": "0.2.3",
21
+ "aws-sdk": "2.1024.0",
22
+ "chai": "4.3.4",
23
+ "mocha": "9.1.3",
24
+ "stentor-constants": "1.48.15",
25
+ "stentor-logger": "1.48.15",
26
+ "stentor-models": "1.48.15",
27
+ "ts-node": "9.1.1",
28
+ "typescript": "4.4.4"
29
+ },
30
+ "dependencies": {
31
+ "@xapp/stentor-service": "1.38.7",
32
+ "@xapp/stentor-service-lex": "1.39.0"
33
+ },
34
+ "peerDependencies": {
35
+ "stentor-constants": "1.x",
36
+ "stentor-logger": "1.x",
37
+ "stentor-models": "1.x"
38
+ },
39
+ "scripts": {
40
+ "build": "tsc -d true -p .",
41
+ "clean": "rm -rf ./lib/*",
42
+ "test": "exit 0"
43
+ },
44
+ "gitHead": "294eda9110f714ec0eadd7d43e119734b6ed8618"
45
+ }