@botonic/plugin-knowledge-bases 0.43.0 → 0.44.0-alpha.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/lib/cjs/hubtype-knowledge-api-service.js +37 -41
- package/lib/cjs/hubtype-knowledge-api-service.js.map +1 -1
- package/lib/cjs/index.js +13 -20
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/hubtype-knowledge-api-service.js +44 -44
- package/lib/esm/hubtype-knowledge-api-service.js.map +1 -1
- package/lib/esm/index.js +19 -23
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/types.js +2 -1
- package/package.json +3 -3
|
@@ -11,52 +11,48 @@ class HubtypeApiService {
|
|
|
11
11
|
this.timeout = timeout || DEFAULT_TIMEOUT;
|
|
12
12
|
this.verbose = verbose || false;
|
|
13
13
|
}
|
|
14
|
-
inferenceV2(authToken, sources, instructions, messageId, memoryLength) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
async inferenceV2(authToken, sources, instructions, messageId, memoryLength) {
|
|
15
|
+
const url = `${this.host}/external/v2/ai/knowledge_base/inference/`;
|
|
16
|
+
const data = {
|
|
17
|
+
sources,
|
|
18
|
+
instructions,
|
|
19
|
+
message: messageId,
|
|
20
|
+
memory_length: memoryLength,
|
|
21
|
+
};
|
|
22
|
+
const response = await (0, axios_1.default)({
|
|
23
|
+
method: 'POST',
|
|
24
|
+
url,
|
|
25
|
+
headers: {
|
|
26
|
+
Authorization: `Bearer ${authToken}`,
|
|
27
|
+
'Content-Type': 'application/json',
|
|
28
|
+
},
|
|
29
|
+
data,
|
|
30
|
+
timeout: this.timeout,
|
|
31
|
+
});
|
|
32
|
+
if (this.verbose) {
|
|
33
|
+
console.log('Data and response', {
|
|
25
34
|
url,
|
|
26
|
-
headers: {
|
|
27
|
-
Authorization: `Bearer ${authToken}`,
|
|
28
|
-
'Content-Type': 'application/json',
|
|
29
|
-
},
|
|
30
35
|
data,
|
|
31
36
|
timeout: this.timeout,
|
|
37
|
+
response,
|
|
32
38
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
url,
|
|
36
|
-
data,
|
|
37
|
-
timeout: this.timeout,
|
|
38
|
-
response,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
return response;
|
|
42
|
-
});
|
|
39
|
+
}
|
|
40
|
+
return response;
|
|
43
41
|
}
|
|
44
|
-
testInference(authToken, instructions, messages, sources) {
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
timeout: this.timeout,
|
|
59
|
-
});
|
|
42
|
+
async testInference(authToken, instructions, messages, sources) {
|
|
43
|
+
return await (0, axios_1.default)({
|
|
44
|
+
method: 'POST',
|
|
45
|
+
url: `${this.host}/external/v1/ai/knowledge_base/test_inference/`,
|
|
46
|
+
headers: {
|
|
47
|
+
Authorization: `Bearer ${authToken}`,
|
|
48
|
+
'Content-Type': 'application/json',
|
|
49
|
+
},
|
|
50
|
+
data: {
|
|
51
|
+
sources,
|
|
52
|
+
instructions,
|
|
53
|
+
messages,
|
|
54
|
+
},
|
|
55
|
+
timeout: this.timeout,
|
|
60
56
|
});
|
|
61
57
|
}
|
|
62
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hubtype-knowledge-api-service.js","sourceRoot":"","sources":["../../src/hubtype-knowledge-api-service.ts"],"names":[],"mappings":";;;;AAAA,yDAAyD;AACzD,0DAA4C;AAI5C,MAAM,eAAe,GAAG,KAAK,CAAA;AAU7B,MAAa,iBAAiB;IAK5B,YAAY,IAAY,EAAE,OAAgB,EAAE,OAAiB;QAC3D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,eAAe,CAAA;QACzC,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,KAAK,CAAA;IACjC,CAAC;
|
|
1
|
+
{"version":3,"file":"hubtype-knowledge-api-service.js","sourceRoot":"","sources":["../../src/hubtype-knowledge-api-service.ts"],"names":[],"mappings":";;;;AAAA,yDAAyD;AACzD,0DAA4C;AAI5C,MAAM,eAAe,GAAG,KAAK,CAAA;AAU7B,MAAa,iBAAiB;IAK5B,YAAY,IAAY,EAAE,OAAgB,EAAE,OAAiB;QAC3D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,eAAe,CAAA;QACzC,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,KAAK,CAAA;IACjC,CAAC;IAED,KAAK,CAAC,WAAW,CACf,SAAiB,EACjB,OAAiB,EACjB,YAAoB,EACpB,SAAiB,EACjB,YAAoB;QAEpB,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,2CAA2C,CAAA;QACnE,MAAM,IAAI,GAAG;YACX,OAAO;YACP,YAAY;YACZ,OAAO,EAAE,SAAS;YAClB,aAAa,EAAE,YAAY;SAC5B,CAAA;QACD,MAAM,QAAQ,GAAG,MAAM,IAAA,eAAK,EAAC;YAC3B,MAAM,EAAE,MAAM;YACd,GAAG;YACH,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,SAAS,EAAE;gBACpC,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI;YACJ,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAA;QAEF,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE;gBAC/B,GAAG;gBACH,IAAI;gBACJ,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,QAAQ;aACT,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,SAAiB,EACjB,YAAoB,EACpB,QAAe,EACf,OAAiB;QAEjB,OAAO,MAAM,IAAA,eAAK,EAAC;YACjB,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,gDAAgD;YACjE,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,SAAS,EAAE;gBACpC,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE;gBACJ,OAAO;gBACP,YAAY;gBACZ,QAAQ;aACT;YACD,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAA;IACJ,CAAC;CACF;AArED,8CAqEC"}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const hubtype_knowledge_api_service_1 = require("./hubtype-knowledge-api-service");
|
|
5
4
|
const isProd = process.env.NODE_ENV === 'production';
|
|
6
5
|
const isDev = process.env.NODE_ENV === 'development';
|
|
@@ -9,27 +8,21 @@ class BotonicPluginKnowledgeBases {
|
|
|
9
8
|
this.apiService = new hubtype_knowledge_api_service_1.HubtypeApiService(options.host, options.timeout, options.verbose);
|
|
10
9
|
this.authToken = options.authToken || '';
|
|
11
10
|
}
|
|
12
|
-
pre(_request) {
|
|
13
|
-
return
|
|
14
|
-
return;
|
|
15
|
-
});
|
|
11
|
+
async pre(_request) {
|
|
12
|
+
return;
|
|
16
13
|
}
|
|
17
|
-
getInference(request, sources, instructions, messageId, memoryLength) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return this.mapApiResponse(response);
|
|
25
|
-
});
|
|
14
|
+
async getInference(request, sources, instructions, messageId, memoryLength) {
|
|
15
|
+
const authToken = isProd ? request.session._access_token : this.authToken;
|
|
16
|
+
if (isDev) {
|
|
17
|
+
return this.getTestInference(authToken, request, instructions, sources);
|
|
18
|
+
}
|
|
19
|
+
const response = await this.apiService.inferenceV2(authToken, sources, instructions, messageId, memoryLength);
|
|
20
|
+
return this.mapApiResponse(response);
|
|
26
21
|
}
|
|
27
|
-
getTestInference(authToken, request, instructions, sources) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return this.mapApiResponse(response);
|
|
32
|
-
});
|
|
22
|
+
async getTestInference(authToken, request, instructions, sources) {
|
|
23
|
+
const messages = [{ role: 'human', content: request.input.data }];
|
|
24
|
+
const response = await this.apiService.testInference(authToken, instructions, messages, sources);
|
|
25
|
+
return this.mapApiResponse(response);
|
|
33
26
|
}
|
|
34
27
|
mapApiResponse(response) {
|
|
35
28
|
return {
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAGA,mFAGwC;AAGxC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAA;AACpD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAA;AAEpD,MAAqB,2BAA2B;IAI9C,YAAY,OAAmC;QAC7C,IAAI,CAAC,UAAU,GAAG,IAAI,iDAAiB,CACrC,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,OAAO,CAChB,CAAA;QACD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAA;IAC1C,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,QAA0B;QAClC,OAAM;IACR,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,OAAmB,EACnB,O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M;SAC7B,CAAA;IACH,CAAC;CACF;AAtED,8CAsEC"}
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HubtypeApiService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
2
5
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
-
|
|
6
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
4
7
|
const DEFAULT_TIMEOUT = 20000;
|
|
5
|
-
|
|
8
|
+
class HubtypeApiService {
|
|
6
9
|
constructor(host, timeout, verbose) {
|
|
7
10
|
this.host = host;
|
|
8
11
|
this.timeout = timeout || DEFAULT_TIMEOUT;
|
|
9
12
|
this.verbose = verbose || false;
|
|
10
13
|
}
|
|
11
|
-
inferenceV2(authToken, sources, instructions, messageId, memoryLength) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
async inferenceV2(authToken, sources, instructions, messageId, memoryLength) {
|
|
15
|
+
const url = `${this.host}/external/v2/ai/knowledge_base/inference/`;
|
|
16
|
+
const data = {
|
|
17
|
+
sources,
|
|
18
|
+
instructions,
|
|
19
|
+
message: messageId,
|
|
20
|
+
memory_length: memoryLength,
|
|
21
|
+
};
|
|
22
|
+
const response = await (0, axios_1.default)({
|
|
23
|
+
method: 'POST',
|
|
24
|
+
url,
|
|
25
|
+
headers: {
|
|
26
|
+
Authorization: `Bearer ${authToken}`,
|
|
27
|
+
'Content-Type': 'application/json',
|
|
28
|
+
},
|
|
29
|
+
data,
|
|
30
|
+
timeout: this.timeout,
|
|
31
|
+
});
|
|
32
|
+
if (this.verbose) {
|
|
33
|
+
console.log('Data and response', {
|
|
22
34
|
url,
|
|
23
|
-
headers: {
|
|
24
|
-
Authorization: `Bearer ${authToken}`,
|
|
25
|
-
'Content-Type': 'application/json',
|
|
26
|
-
},
|
|
27
35
|
data,
|
|
28
36
|
timeout: this.timeout,
|
|
37
|
+
response,
|
|
29
38
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
url,
|
|
33
|
-
data,
|
|
34
|
-
timeout: this.timeout,
|
|
35
|
-
response,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return response;
|
|
39
|
-
});
|
|
39
|
+
}
|
|
40
|
+
return response;
|
|
40
41
|
}
|
|
41
|
-
testInference(authToken, instructions, messages, sources) {
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
timeout: this.timeout,
|
|
56
|
-
});
|
|
42
|
+
async testInference(authToken, instructions, messages, sources) {
|
|
43
|
+
return await (0, axios_1.default)({
|
|
44
|
+
method: 'POST',
|
|
45
|
+
url: `${this.host}/external/v1/ai/knowledge_base/test_inference/`,
|
|
46
|
+
headers: {
|
|
47
|
+
Authorization: `Bearer ${authToken}`,
|
|
48
|
+
'Content-Type': 'application/json',
|
|
49
|
+
},
|
|
50
|
+
data: {
|
|
51
|
+
sources,
|
|
52
|
+
instructions,
|
|
53
|
+
messages,
|
|
54
|
+
},
|
|
55
|
+
timeout: this.timeout,
|
|
57
56
|
});
|
|
58
57
|
}
|
|
59
58
|
}
|
|
59
|
+
exports.HubtypeApiService = HubtypeApiService;
|
|
60
60
|
//# sourceMappingURL=hubtype-knowledge-api-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hubtype-knowledge-api-service.js","sourceRoot":"","sources":["../../src/hubtype-knowledge-api-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hubtype-knowledge-api-service.js","sourceRoot":"","sources":["../../src/hubtype-knowledge-api-service.ts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AAO,EAAE;gBACP,aAAa,EAAE,UAAU,SAAS,EAAE;gBACpC,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE;gBACJ,OAAO;gBACP,YAAY;gBACZ,QAAQ;aACT;YACD,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAA;IACJ,CAAC;CACF;AArED,8CAqEC"}
|
package/lib/esm/index.js
CHANGED
|
@@ -1,33 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const hubtype_knowledge_api_service_1 = require("./hubtype-knowledge-api-service");
|
|
3
4
|
const isProd = process.env.NODE_ENV === 'production';
|
|
4
5
|
const isDev = process.env.NODE_ENV === 'development';
|
|
5
|
-
|
|
6
|
+
class BotonicPluginKnowledgeBases {
|
|
6
7
|
constructor(options) {
|
|
7
|
-
this.apiService = new HubtypeApiService(options.host, options.timeout, options.verbose);
|
|
8
|
+
this.apiService = new hubtype_knowledge_api_service_1.HubtypeApiService(options.host, options.timeout, options.verbose);
|
|
8
9
|
this.authToken = options.authToken || '';
|
|
9
10
|
}
|
|
10
|
-
pre(_request) {
|
|
11
|
-
return
|
|
12
|
-
return;
|
|
13
|
-
});
|
|
11
|
+
async pre(_request) {
|
|
12
|
+
return;
|
|
14
13
|
}
|
|
15
|
-
getInference(request, sources, instructions, messageId, memoryLength) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return this.mapApiResponse(response);
|
|
23
|
-
});
|
|
14
|
+
async getInference(request, sources, instructions, messageId, memoryLength) {
|
|
15
|
+
const authToken = isProd ? request.session._access_token : this.authToken;
|
|
16
|
+
if (isDev) {
|
|
17
|
+
return this.getTestInference(authToken, request, instructions, sources);
|
|
18
|
+
}
|
|
19
|
+
const response = await this.apiService.inferenceV2(authToken, sources, instructions, messageId, memoryLength);
|
|
20
|
+
return this.mapApiResponse(response);
|
|
24
21
|
}
|
|
25
|
-
getTestInference(authToken, request, instructions, sources) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return this.mapApiResponse(response);
|
|
30
|
-
});
|
|
22
|
+
async getTestInference(authToken, request, instructions, sources) {
|
|
23
|
+
const messages = [{ role: 'human', content: request.input.data }];
|
|
24
|
+
const response = await this.apiService.testInference(authToken, instructions, messages, sources);
|
|
25
|
+
return this.mapApiResponse(response);
|
|
31
26
|
}
|
|
32
27
|
mapApiResponse(response) {
|
|
33
28
|
return {
|
|
@@ -39,4 +34,5 @@ export default class BotonicPluginKnowledgeBases {
|
|
|
39
34
|
};
|
|
40
35
|
}
|
|
41
36
|
}
|
|
37
|
+
exports.default = BotonicPluginKnowledgeBases;
|
|
42
38
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAGA,mFAGwC;AAGxC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAA;AACpD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAA;AAEpD,MAAqB,2BAA2B;IAI9C,YAAY,OAAmC;QAC7C,IAAI,CAAC,UAAU,GAAG,IAAI,iDAAiB,CACrC,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,OAAO,CAChB,CAAA;QACD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAA;IAC1C,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,QAA0B;QAClC,OAAM;IACR,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,OAAmB,EACnB,OAA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SAC7B,CAAA;IACH,CAAC;CACF;AAtED,8CAsEC"}
|
package/lib/esm/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botonic/plugin-knowledge-bases",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.0-alpha.0",
|
|
4
4
|
"description": "Use a Hubtype to make the bot respond through a knowledge base.",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.26.0",
|
|
18
|
-
"@botonic/core": "^0.
|
|
18
|
+
"@botonic/core": "^0.44.0-alpha.0",
|
|
19
19
|
"axios": "^1.13.2"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
@@ -49,4 +49,4 @@
|
|
|
49
49
|
"root": true
|
|
50
50
|
},
|
|
51
51
|
"license": "MIT"
|
|
52
|
-
}
|
|
52
|
+
}
|