@wildix/wim-knowledge-base-client 0.0.49 → 0.0.51
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/dist-cjs/models/models_0.js +6 -1
- package/dist-cjs/protocols/Aws_restJson1.js +4 -3
- package/dist-es/models/models_0.js +5 -0
- package/dist-es/protocols/Aws_restJson1.js +4 -3
- package/dist-types/commands/GenerateSearchAnswerCommand.d.ts +20 -2
- package/dist-types/commands/SearchKnowledgeBaseCommand.d.ts +6 -1
- package/dist-types/models/models_0.d.ts +38 -3
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SearchThresholdValue = exports.SyncLogLevel = exports.SyncDataSourceStatus = exports.SyncDataSourceMode = exports.DownloadDocumentType = exports.DocumentStatus = exports.DataSourceType = exports.ScheduleConfiguration = exports.DataSourceConfig = exports.KnowledgeBaseNotFoundException = exports.DocumentNotFoundException = exports.DataSourceNotFoundException = exports.UnauthorizedException = exports.ForbiddenException = exports.ValidationException = void 0;
|
|
3
|
+
exports.SearchThresholdValue = exports.SearchStrategy = exports.SyncLogLevel = exports.SyncDataSourceStatus = exports.SyncDataSourceMode = exports.DownloadDocumentType = exports.DocumentStatus = exports.DataSourceType = exports.ScheduleConfiguration = exports.DataSourceConfig = exports.KnowledgeBaseNotFoundException = exports.DocumentNotFoundException = exports.DataSourceNotFoundException = exports.UnauthorizedException = exports.ForbiddenException = exports.ValidationException = void 0;
|
|
4
4
|
const KnowledgeBaseServiceException_1 = require("./KnowledgeBaseServiceException");
|
|
5
5
|
class ValidationException extends KnowledgeBaseServiceException_1.KnowledgeBaseServiceException {
|
|
6
6
|
name = "ValidationException";
|
|
@@ -131,6 +131,11 @@ exports.SyncLogLevel = {
|
|
|
131
131
|
INFO: "info",
|
|
132
132
|
WARN: "warn",
|
|
133
133
|
};
|
|
134
|
+
exports.SearchStrategy = {
|
|
135
|
+
BM25: "bm25",
|
|
136
|
+
HYBRID: "hybrid",
|
|
137
|
+
VECTOR: "vector",
|
|
138
|
+
};
|
|
134
139
|
exports.SearchThresholdValue = {
|
|
135
140
|
HIGH: "high",
|
|
136
141
|
LOW: "low",
|
|
@@ -503,6 +503,7 @@ const se_SearchKnowledgeBaseCommand = async (input, context) => {
|
|
|
503
503
|
'externalSessionId': [],
|
|
504
504
|
'query': [],
|
|
505
505
|
'searchLimit': [],
|
|
506
|
+
'searchStrategy': [],
|
|
506
507
|
'searchThreshold': [],
|
|
507
508
|
'searchUser': [],
|
|
508
509
|
'useQueryOptimization': [],
|
|
@@ -763,8 +764,8 @@ const de_GenerateSearchAnswerCommand = async (output, context) => {
|
|
|
763
764
|
const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await (0, core_1.parseJsonBody)(output.body, context))), "body");
|
|
764
765
|
const doc = (0, smithy_client_1.take)(data, {
|
|
765
766
|
'answer': smithy_client_1.expectString,
|
|
766
|
-
'metadata':
|
|
767
|
-
'sources': _ =>
|
|
767
|
+
'metadata': smithy_client_1._json,
|
|
768
|
+
'sources': _ => de_SearchKnowledgeBaseResults(_, context),
|
|
768
769
|
});
|
|
769
770
|
Object.assign(contents, doc);
|
|
770
771
|
return contents;
|
|
@@ -1011,7 +1012,7 @@ const de_SearchKnowledgeBaseCommand = async (output, context) => {
|
|
|
1011
1012
|
});
|
|
1012
1013
|
const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await (0, core_1.parseJsonBody)(output.body, context))), "body");
|
|
1013
1014
|
const doc = (0, smithy_client_1.take)(data, {
|
|
1014
|
-
'metadata':
|
|
1015
|
+
'metadata': smithy_client_1._json,
|
|
1015
1016
|
'results': _ => de_SearchKnowledgeBaseResults(_, context),
|
|
1016
1017
|
});
|
|
1017
1018
|
Object.assign(contents, doc);
|
|
@@ -122,6 +122,11 @@ export const SyncLogLevel = {
|
|
|
122
122
|
INFO: "info",
|
|
123
123
|
WARN: "warn",
|
|
124
124
|
};
|
|
125
|
+
export const SearchStrategy = {
|
|
126
|
+
BM25: "bm25",
|
|
127
|
+
HYBRID: "hybrid",
|
|
128
|
+
VECTOR: "vector",
|
|
129
|
+
};
|
|
125
130
|
export const SearchThresholdValue = {
|
|
126
131
|
HIGH: "high",
|
|
127
132
|
LOW: "low",
|
|
@@ -473,6 +473,7 @@ export const se_SearchKnowledgeBaseCommand = async (input, context) => {
|
|
|
473
473
|
'externalSessionId': [],
|
|
474
474
|
'query': [],
|
|
475
475
|
'searchLimit': [],
|
|
476
|
+
'searchStrategy': [],
|
|
476
477
|
'searchThreshold': [],
|
|
477
478
|
'searchUser': [],
|
|
478
479
|
'useQueryOptimization': [],
|
|
@@ -717,8 +718,8 @@ export const de_GenerateSearchAnswerCommand = async (output, context) => {
|
|
|
717
718
|
const data = __expectNonNull((__expectObject(await parseBody(output.body, context))), "body");
|
|
718
719
|
const doc = take(data, {
|
|
719
720
|
'answer': __expectString,
|
|
720
|
-
'metadata':
|
|
721
|
-
'sources': _ =>
|
|
721
|
+
'metadata': _json,
|
|
722
|
+
'sources': _ => de_SearchKnowledgeBaseResults(_, context),
|
|
722
723
|
});
|
|
723
724
|
Object.assign(contents, doc);
|
|
724
725
|
return contents;
|
|
@@ -949,7 +950,7 @@ export const de_SearchKnowledgeBaseCommand = async (output, context) => {
|
|
|
949
950
|
});
|
|
950
951
|
const data = __expectNonNull((__expectObject(await parseBody(output.body, context))), "body");
|
|
951
952
|
const doc = take(data, {
|
|
952
|
-
'metadata':
|
|
953
|
+
'metadata': _json,
|
|
953
954
|
'results': _ => de_SearchKnowledgeBaseResults(_, context),
|
|
954
955
|
});
|
|
955
956
|
Object.assign(contents, doc);
|
|
@@ -60,8 +60,26 @@ declare const GenerateSearchAnswerCommand_base: {
|
|
|
60
60
|
* const response = await client.send(command);
|
|
61
61
|
* // { // GenerateSearchAnswerOutput
|
|
62
62
|
* // answer: "STRING_VALUE", // required
|
|
63
|
-
* // metadata:
|
|
64
|
-
* //
|
|
63
|
+
* // metadata: { // AnswerMetadata
|
|
64
|
+
* // model: "STRING_VALUE", // required
|
|
65
|
+
* // inputTokens: Number("int"), // required
|
|
66
|
+
* // outputTokens: Number("int"), // required
|
|
67
|
+
* // duration: Number("int"), // required
|
|
68
|
+
* // },
|
|
69
|
+
* // sources: [ // SearchKnowledgeBaseResults // required
|
|
70
|
+
* // { // SearchKnowledgeBaseResult
|
|
71
|
+
* // documentId: "STRING_VALUE", // required
|
|
72
|
+
* // documentTitle: "STRING_VALUE", // required
|
|
73
|
+
* // documentUrl: "STRING_VALUE", // required
|
|
74
|
+
* // dataSourceId: "STRING_VALUE", // required
|
|
75
|
+
* // dataSourceType: "files" || "confluence" || "gdrive", // required
|
|
76
|
+
* // content: "STRING_VALUE", // required
|
|
77
|
+
* // score: Number("double"), // required
|
|
78
|
+
* // documentHierarchy: [ // StringList
|
|
79
|
+
* // "STRING_VALUE",
|
|
80
|
+
* // ],
|
|
81
|
+
* // },
|
|
82
|
+
* // ],
|
|
65
83
|
* // };
|
|
66
84
|
*
|
|
67
85
|
* ```
|
|
@@ -38,6 +38,7 @@ declare const SearchKnowledgeBaseCommand_base: {
|
|
|
38
38
|
* companyId: "STRING_VALUE",
|
|
39
39
|
* knowledgeBaseId: "STRING_VALUE", // required
|
|
40
40
|
* query: "STRING_VALUE", // required
|
|
41
|
+
* searchStrategy: "bm25" || "vector" || "hybrid",
|
|
41
42
|
* searchLimit: Number("int"),
|
|
42
43
|
* searchThreshold: "low" || "medium" || "high",
|
|
43
44
|
* useQueryOptimization: true || false,
|
|
@@ -61,7 +62,11 @@ declare const SearchKnowledgeBaseCommand_base: {
|
|
|
61
62
|
* // ],
|
|
62
63
|
* // },
|
|
63
64
|
* // ],
|
|
64
|
-
* // metadata:
|
|
65
|
+
* // metadata: { // SearchResultMetadata
|
|
66
|
+
* // duration: Number("int"), // required
|
|
67
|
+
* // inputTokens: Number("int"), // required
|
|
68
|
+
* // outputTokens: Number("int"), // required
|
|
69
|
+
* // },
|
|
65
70
|
* // };
|
|
66
71
|
*
|
|
67
72
|
* ```
|
|
@@ -34,6 +34,15 @@ export declare class UnauthorizedException extends __BaseException {
|
|
|
34
34
|
*/
|
|
35
35
|
constructor(opts: __ExceptionOptionType<UnauthorizedException, __BaseException>);
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export interface AnswerMetadata {
|
|
41
|
+
model: string;
|
|
42
|
+
inputTokens: number;
|
|
43
|
+
outputTokens: number;
|
|
44
|
+
duration: number;
|
|
45
|
+
}
|
|
37
46
|
/**
|
|
38
47
|
* @public
|
|
39
48
|
*/
|
|
@@ -1018,8 +1027,8 @@ export interface GenerateSearchAnswerInput {
|
|
|
1018
1027
|
*/
|
|
1019
1028
|
export interface GenerateSearchAnswerOutput {
|
|
1020
1029
|
answer: string;
|
|
1021
|
-
metadata:
|
|
1022
|
-
sources:
|
|
1030
|
+
metadata: AnswerMetadata;
|
|
1031
|
+
sources: (SearchKnowledgeBaseResult)[];
|
|
1023
1032
|
}
|
|
1024
1033
|
/**
|
|
1025
1034
|
* @public
|
|
@@ -1490,6 +1499,19 @@ export interface ListSearchQueriesHistoryInput {
|
|
|
1490
1499
|
export interface ListSearchQueriesHistoryOutput {
|
|
1491
1500
|
results: (__DocumentType)[];
|
|
1492
1501
|
}
|
|
1502
|
+
/**
|
|
1503
|
+
* @public
|
|
1504
|
+
* @enum
|
|
1505
|
+
*/
|
|
1506
|
+
export declare const SearchStrategy: {
|
|
1507
|
+
readonly BM25: "bm25";
|
|
1508
|
+
readonly HYBRID: "hybrid";
|
|
1509
|
+
readonly VECTOR: "vector";
|
|
1510
|
+
};
|
|
1511
|
+
/**
|
|
1512
|
+
* @public
|
|
1513
|
+
*/
|
|
1514
|
+
export type SearchStrategy = typeof SearchStrategy[keyof typeof SearchStrategy];
|
|
1493
1515
|
/**
|
|
1494
1516
|
* @public
|
|
1495
1517
|
* @enum
|
|
@@ -1522,6 +1544,11 @@ export interface SearchKnowledgeBaseInput {
|
|
|
1522
1544
|
* @public
|
|
1523
1545
|
*/
|
|
1524
1546
|
query: string;
|
|
1547
|
+
/**
|
|
1548
|
+
* Search algorithm strategy: 'bm25' (full-text keyword search), 'vector' (semantic similarity search using embeddings), 'hybrid' (combines both methods for best results). Defaults to 'hybrid' if not specified
|
|
1549
|
+
* @public
|
|
1550
|
+
*/
|
|
1551
|
+
searchStrategy?: SearchStrategy | undefined;
|
|
1525
1552
|
/**
|
|
1526
1553
|
* Maximum number of search results to return. Controls the size of the result set. Valid range: 1-50. Defaults to 10 if not specified. Higher values return more results but may include less relevant matches
|
|
1527
1554
|
* @public
|
|
@@ -1548,12 +1575,20 @@ export interface SearchKnowledgeBaseInput {
|
|
|
1548
1575
|
*/
|
|
1549
1576
|
externalSessionId?: string | undefined;
|
|
1550
1577
|
}
|
|
1578
|
+
/**
|
|
1579
|
+
* @public
|
|
1580
|
+
*/
|
|
1581
|
+
export interface SearchResultMetadata {
|
|
1582
|
+
duration: number;
|
|
1583
|
+
inputTokens: number;
|
|
1584
|
+
outputTokens: number;
|
|
1585
|
+
}
|
|
1551
1586
|
/**
|
|
1552
1587
|
* @public
|
|
1553
1588
|
*/
|
|
1554
1589
|
export interface SearchKnowledgeBaseOutput {
|
|
1555
1590
|
results: (SearchKnowledgeBaseResult)[];
|
|
1556
|
-
metadata
|
|
1591
|
+
metadata: SearchResultMetadata;
|
|
1557
1592
|
}
|
|
1558
1593
|
/**
|
|
1559
1594
|
* @public
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildix/wim-knowledge-base-client",
|
|
3
3
|
"description": "@wildix/wim-knowledge-base-client client",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.51",
|
|
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",
|