@wildix/wim-knowledge-base-client 0.0.50 → 0.0.52

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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;
3
+ exports.SearchThresholdValue = exports.SearchStrategy = exports.SyncLogLevel = exports.SyncDataSourceStatus = exports.SyncDataSourceMode = 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";
@@ -111,10 +111,6 @@ exports.DocumentStatus = {
111
111
  PENDING: "pending",
112
112
  PROCESSING: "processing",
113
113
  };
114
- exports.DownloadDocumentType = {
115
- MARKDOWN: "markdown",
116
- ORIGINAL: "original",
117
- };
118
114
  exports.SyncDataSourceMode = {
119
115
  FULL: "full",
120
116
  INCREMENTAL: "incremental",
@@ -10,7 +10,7 @@ const smithy_client_1 = require("@smithy/smithy-client");
10
10
  const se_CleanDataSourceCommand = async (input, context) => {
11
11
  const b = (0, core_2.requestBuilder)(input, context);
12
12
  const headers = {};
13
- b.bp("/api/v1/data-sources/{dataSourceId}/clean");
13
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/clean");
14
14
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
15
15
  const query = (0, smithy_client_1.map)({
16
16
  [_c]: [, input[_cI]],
@@ -26,7 +26,7 @@ exports.se_CleanDataSourceCommand = se_CleanDataSourceCommand;
26
26
  const se_CloneDataSourceCommand = async (input, context) => {
27
27
  const b = (0, core_2.requestBuilder)(input, context);
28
28
  const headers = {};
29
- b.bp("/api/v1/data-sources/{dataSourceId}/clone");
29
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/clone");
30
30
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
31
31
  const query = (0, smithy_client_1.map)({
32
32
  [_c]: [, input[_cI]],
@@ -44,7 +44,7 @@ const se_ConfigureDataSourceCommand = async (input, context) => {
44
44
  const headers = {
45
45
  'content-type': 'application/json',
46
46
  };
47
- b.bp("/api/v1/data-sources/{dataSourceId}/configure");
47
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/configure");
48
48
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
49
49
  const query = (0, smithy_client_1.map)({
50
50
  [_c]: [, input[_cI]],
@@ -66,7 +66,7 @@ const se_CreateDataSourceCommand = async (input, context) => {
66
66
  const headers = {
67
67
  'content-type': 'application/json',
68
68
  };
69
- b.bp("/api/v1/data-sources");
69
+ b.bp("/api/v1/knowledge-bases/data-sources");
70
70
  const query = (0, smithy_client_1.map)({
71
71
  [_c]: [, input[_cI]],
72
72
  });
@@ -88,7 +88,7 @@ const se_CreateDocumentCommand = async (input, context) => {
88
88
  const headers = {
89
89
  'content-type': 'application/json',
90
90
  };
91
- b.bp("/api/v1/data-sources/{dataSourceId}/documents");
91
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents");
92
92
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
93
93
  const query = (0, smithy_client_1.map)({
94
94
  [_c]: [, input[_cI]],
@@ -135,7 +135,7 @@ exports.se_CreateKnowledgeBaseCommand = se_CreateKnowledgeBaseCommand;
135
135
  const se_DeleteDataSourceCommand = async (input, context) => {
136
136
  const b = (0, core_2.requestBuilder)(input, context);
137
137
  const headers = {};
138
- b.bp("/api/v1/data-sources/{dataSourceId}");
138
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}");
139
139
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
140
140
  const query = (0, smithy_client_1.map)({
141
141
  [_c]: [, input[_cI]],
@@ -151,7 +151,7 @@ exports.se_DeleteDataSourceCommand = se_DeleteDataSourceCommand;
151
151
  const se_DeleteDocumentCommand = async (input, context) => {
152
152
  const b = (0, core_2.requestBuilder)(input, context);
153
153
  const headers = {};
154
- b.bp("/api/v1/data-sources/{dataSourceId}/documents/{documentId}");
154
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents/{documentId}");
155
155
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
156
156
  b.p('documentId', () => input.documentId, '{documentId}', false);
157
157
  const query = (0, smithy_client_1.map)({
@@ -186,7 +186,7 @@ const se_DescribeDataSourceCommand = async (input, context) => {
186
186
  const headers = {
187
187
  'content-type': 'application/json',
188
188
  };
189
- b.bp("/api/v1/data-sources/{dataSourceId}/describe");
189
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/describe");
190
190
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
191
191
  const query = (0, smithy_client_1.map)({
192
192
  [_c]: [, input[_cI]],
@@ -230,7 +230,7 @@ exports.se_GenerateSearchAnswerCommand = se_GenerateSearchAnswerCommand;
230
230
  const se_GetDataSourceCommand = async (input, context) => {
231
231
  const b = (0, core_2.requestBuilder)(input, context);
232
232
  const headers = {};
233
- b.bp("/api/v1/data-sources/{dataSourceId}");
233
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}");
234
234
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
235
235
  const query = (0, smithy_client_1.map)({
236
236
  [_c]: [, input[_cI]],
@@ -246,7 +246,7 @@ exports.se_GetDataSourceCommand = se_GetDataSourceCommand;
246
246
  const se_GetDataSourceSyncStatusCommand = async (input, context) => {
247
247
  const b = (0, core_2.requestBuilder)(input, context);
248
248
  const headers = {};
249
- b.bp("/api/v1/data-sources/{dataSourceId}/sync-status");
249
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/sync-status");
250
250
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
251
251
  const query = (0, smithy_client_1.map)({
252
252
  [_c]: [, input[_cI]],
@@ -262,12 +262,11 @@ exports.se_GetDataSourceSyncStatusCommand = se_GetDataSourceSyncStatusCommand;
262
262
  const se_GetDocumentCommand = async (input, context) => {
263
263
  const b = (0, core_2.requestBuilder)(input, context);
264
264
  const headers = {};
265
- b.bp("/api/v1/data-sources/{dataSourceId}/documents/{documentId}");
265
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents/{documentId}");
266
266
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
267
267
  b.p('documentId', () => input.documentId, '{documentId}', false);
268
268
  const query = (0, smithy_client_1.map)({
269
269
  [_c]: [, input[_cI]],
270
- [_wC]: [() => input.withChunks !== void 0, () => (input[_wC].toString())],
271
270
  });
272
271
  let body;
273
272
  b.m("GET")
@@ -280,7 +279,7 @@ exports.se_GetDocumentCommand = se_GetDocumentCommand;
280
279
  const se_GetDocumentChunksCommand = async (input, context) => {
281
280
  const b = (0, core_2.requestBuilder)(input, context);
282
281
  const headers = {};
283
- b.bp("/api/v1/data-sources/{dataSourceId}/documents/{documentId}/chunks");
282
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents/{documentId}/chunks");
284
283
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
285
284
  b.p('documentId', () => input.documentId, '{documentId}', false);
286
285
  const query = (0, smithy_client_1.map)({
@@ -297,12 +296,11 @@ exports.se_GetDocumentChunksCommand = se_GetDocumentChunksCommand;
297
296
  const se_GetDocumentDownloadUrlCommand = async (input, context) => {
298
297
  const b = (0, core_2.requestBuilder)(input, context);
299
298
  const headers = {};
300
- b.bp("/api/v1/data-sources/{dataSourceId}/documents/{documentId}/download_url");
299
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents/{documentId}/download-url");
301
300
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
302
301
  b.p('documentId', () => input.documentId, '{documentId}', false);
303
302
  const query = (0, smithy_client_1.map)({
304
303
  [_c]: [, input[_cI]],
305
- [_dT]: [, input[_dT]],
306
304
  });
307
305
  let body;
308
306
  b.m("GET")
@@ -315,7 +313,7 @@ exports.se_GetDocumentDownloadUrlCommand = se_GetDocumentDownloadUrlCommand;
315
313
  const se_GetDocumentMarkdownCommand = async (input, context) => {
316
314
  const b = (0, core_2.requestBuilder)(input, context);
317
315
  const headers = {};
318
- b.bp("/api/v1/data-sources/{dataSourceId}/documents/{documentId}/markdown");
316
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents/{documentId}/markdown");
319
317
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
320
318
  b.p('documentId', () => input.documentId, '{documentId}', false);
321
319
  const query = (0, smithy_client_1.map)({
@@ -332,7 +330,7 @@ exports.se_GetDocumentMarkdownCommand = se_GetDocumentMarkdownCommand;
332
330
  const se_GetDocumentUploadUrlCommand = async (input, context) => {
333
331
  const b = (0, core_2.requestBuilder)(input, context);
334
332
  const headers = {};
335
- b.bp("/api/v1/data-sources/{dataSourceId}/documents/{documentId}/upload_url");
333
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents/{documentId}/upload-url");
336
334
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
337
335
  b.p('documentId', () => input.documentId, '{documentId}', false);
338
336
  const query = (0, smithy_client_1.map)({
@@ -349,7 +347,7 @@ exports.se_GetDocumentUploadUrlCommand = se_GetDocumentUploadUrlCommand;
349
347
  const se_GetDocumentWithContentAndChunksCommand = async (input, context) => {
350
348
  const b = (0, core_2.requestBuilder)(input, context);
351
349
  const headers = {};
352
- b.bp("/api/v1/data-sources/{dataSourceId}/documents/{documentId}/with-content-and-chunks");
350
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents/{documentId}/with-content-and-chunks");
353
351
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
354
352
  b.p('documentId', () => input.documentId, '{documentId}', false);
355
353
  const query = (0, smithy_client_1.map)({
@@ -382,7 +380,7 @@ exports.se_GetKnowledgeBaseCommand = se_GetKnowledgeBaseCommand;
382
380
  const se_ListDataSourcesCommand = async (input, context) => {
383
381
  const b = (0, core_2.requestBuilder)(input, context);
384
382
  const headers = {};
385
- b.bp("/api/v1/data-sources");
383
+ b.bp("/api/v1/knowledge-bases/data-sources");
386
384
  const query = (0, smithy_client_1.map)({
387
385
  [_c]: [, input[_cI]],
388
386
  });
@@ -397,7 +395,7 @@ exports.se_ListDataSourcesCommand = se_ListDataSourcesCommand;
397
395
  const se_ListDataSourceStatisticsCommand = async (input, context) => {
398
396
  const b = (0, core_2.requestBuilder)(input, context);
399
397
  const headers = {};
400
- b.bp("/api/v1/data-sources/{dataSourceId}/statistics");
398
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/statistics");
401
399
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
402
400
  const query = (0, smithy_client_1.map)({
403
401
  [_c]: [, input[_cI]],
@@ -413,7 +411,7 @@ exports.se_ListDataSourceStatisticsCommand = se_ListDataSourceStatisticsCommand;
413
411
  const se_ListDataSourceSynchronizationLogsCommand = async (input, context) => {
414
412
  const b = (0, core_2.requestBuilder)(input, context);
415
413
  const headers = {};
416
- b.bp("/api/v1/data-sources/{dataSourceId}/sync-logs");
414
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/sync-logs");
417
415
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
418
416
  const query = (0, smithy_client_1.map)({
419
417
  [_c]: [, input[_cI]],
@@ -434,12 +432,14 @@ exports.se_ListDataSourceSynchronizationLogsCommand = se_ListDataSourceSynchroni
434
432
  const se_ListDocumentsCommand = async (input, context) => {
435
433
  const b = (0, core_2.requestBuilder)(input, context);
436
434
  const headers = {};
437
- b.bp("/api/v1/data-sources/{dataSourceId}/documents");
435
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents");
438
436
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
439
437
  const query = (0, smithy_client_1.map)({
440
438
  [_c]: [, input[_cI]],
441
439
  [_l]: [() => input.limit !== void 0, () => (input[_l].toString())],
442
440
  [_o]: [() => input.offset !== void 0, () => (input[_o].toString())],
441
+ [_s]: [, input[_s]],
442
+ [_se]: [, input[_se]],
443
443
  });
444
444
  let body;
445
445
  b.m("GET")
@@ -469,7 +469,7 @@ const se_ListSearchQueriesHistoryCommand = async (input, context) => {
469
469
  const headers = {
470
470
  'content-type': 'application/json',
471
471
  };
472
- b.bp("/api/v1/history/search-queries");
472
+ b.bp("/api/v1/knowledge-bases/history/search-queries");
473
473
  const query = (0, smithy_client_1.map)({
474
474
  [_c]: [, input[_cI]],
475
475
  [_l]: [() => input.limit !== void 0, () => (input[_l].toString())],
@@ -518,7 +518,7 @@ exports.se_SearchKnowledgeBaseCommand = se_SearchKnowledgeBaseCommand;
518
518
  const se_StartSyncDataSourceCommand = async (input, context) => {
519
519
  const b = (0, core_2.requestBuilder)(input, context);
520
520
  const headers = {};
521
- b.bp("/api/v1/data-sources/{dataSourceId}/start-sync");
521
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/start-sync");
522
522
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
523
523
  const query = (0, smithy_client_1.map)({
524
524
  [_c]: [, input[_cI]],
@@ -535,7 +535,7 @@ exports.se_StartSyncDataSourceCommand = se_StartSyncDataSourceCommand;
535
535
  const se_StopSyncDataSourceCommand = async (input, context) => {
536
536
  const b = (0, core_2.requestBuilder)(input, context);
537
537
  const headers = {};
538
- b.bp("/api/v1/data-sources/{dataSourceId}/stop-sync");
538
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/stop-sync");
539
539
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
540
540
  const query = (0, smithy_client_1.map)({
541
541
  [_c]: [, input[_cI]],
@@ -553,7 +553,7 @@ const se_UpdateDataSourceCommand = async (input, context) => {
553
553
  const headers = {
554
554
  'content-type': 'application/json',
555
555
  };
556
- b.bp("/api/v1/data-sources/{dataSourceId}");
556
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}");
557
557
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
558
558
  const query = (0, smithy_client_1.map)({
559
559
  [_c]: [, input[_cI]],
@@ -575,7 +575,7 @@ const se_UpdateDocumentCommand = async (input, context) => {
575
575
  const headers = {
576
576
  'content-type': 'application/json',
577
577
  };
578
- b.bp("/api/v1/data-sources/{dataSourceId}/documents/{documentId}");
578
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents/{documentId}");
579
579
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
580
580
  b.p('documentId', () => input.documentId, '{documentId}', false);
581
581
  const query = (0, smithy_client_1.map)({
@@ -764,8 +764,8 @@ const de_GenerateSearchAnswerCommand = async (output, context) => {
764
764
  const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await (0, core_1.parseJsonBody)(output.body, context))), "body");
765
765
  const doc = (0, smithy_client_1.take)(data, {
766
766
  'answer': smithy_client_1.expectString,
767
- 'metadata': _ => de_Document(_, context),
768
- 'sources': _ => de_Document(_, context),
767
+ 'metadata': smithy_client_1._json,
768
+ 'sources': _ => de_SearchKnowledgeBaseResults(_, context),
769
769
  });
770
770
  Object.assign(contents, doc);
771
771
  return contents;
@@ -813,7 +813,6 @@ const de_GetDocumentCommand = async (output, context) => {
813
813
  });
814
814
  const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await (0, core_1.parseJsonBody)(output.body, context))), "body");
815
815
  const doc = (0, smithy_client_1.take)(data, {
816
- 'chunks': smithy_client_1._json,
817
816
  'document': smithy_client_1._json,
818
817
  });
819
818
  Object.assign(contents, doc);
@@ -1012,7 +1011,7 @@ const de_SearchKnowledgeBaseCommand = async (output, context) => {
1012
1011
  });
1013
1012
  const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await (0, core_1.parseJsonBody)(output.body, context))), "body");
1014
1013
  const doc = (0, smithy_client_1.take)(data, {
1015
- 'metadata': _ => de_Document(_, context),
1014
+ 'metadata': smithy_client_1._json,
1016
1015
  'results': _ => de_SearchKnowledgeBaseResults(_, context),
1017
1016
  });
1018
1017
  Object.assign(contents, doc);
@@ -1227,7 +1226,9 @@ const se_SearchKnowledgeBaseResult = (input, context) => {
1227
1226
  'documentId': [],
1228
1227
  'documentTitle': [],
1229
1228
  'documentUrl': [],
1229
+ 'fullTextScore': smithy_client_1.serializeFloat,
1230
1230
  'score': smithy_client_1.serializeFloat,
1231
+ 'semanticScore': smithy_client_1.serializeFloat,
1231
1232
  });
1232
1233
  };
1233
1234
  const se_SearchKnowledgeBaseResults = (input, context) => {
@@ -1283,9 +1284,56 @@ const de_DescribeDataSourceResult = (output, context) => {
1283
1284
  'proxy': (_) => de_Document(_, context),
1284
1285
  });
1285
1286
  };
1287
+ const de_SearchHistoryRequest = (output, context) => {
1288
+ return (0, smithy_client_1.take)(output, {
1289
+ 'externalSessionId': smithy_client_1.expectString,
1290
+ 'knowledgeBaseId': smithy_client_1.expectString,
1291
+ 'query': smithy_client_1.expectString,
1292
+ 'searchLimit': smithy_client_1.expectInt32,
1293
+ 'searchStrategy': smithy_client_1.expectString,
1294
+ 'searchThreshold': smithy_client_1.limitedParseDouble,
1295
+ 'user': smithy_client_1.expectString,
1296
+ });
1297
+ };
1298
+ const de_SearchHistoryResponse = (output, context) => {
1299
+ return (0, smithy_client_1.take)(output, {
1300
+ 'results': (_) => de_SearchHistorySearchResults(_, context),
1301
+ });
1302
+ };
1303
+ const de_SearchHistoryResult = (output, context) => {
1304
+ return (0, smithy_client_1.take)(output, {
1305
+ 'companyId': smithy_client_1.expectString,
1306
+ 'createdAt': (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
1307
+ 'request': (_) => de_SearchHistoryRequest(_, context),
1308
+ 'response': (_) => de_SearchHistoryResponse(_, context),
1309
+ 'resultsCount': smithy_client_1.expectInt32,
1310
+ 'sessionId': smithy_client_1.expectString,
1311
+ 'stages': smithy_client_1._json,
1312
+ 'totalDuration': smithy_client_1.expectInt32,
1313
+ });
1314
+ };
1286
1315
  const de_SearchHistoryResultsList = (output, context) => {
1287
1316
  const retVal = (output || []).filter((e) => e != null).map((entry) => {
1288
- return de_Document(entry, context);
1317
+ return de_SearchHistoryResult(entry, context);
1318
+ });
1319
+ return retVal;
1320
+ };
1321
+ const de_SearchHistorySearchResult = (output, context) => {
1322
+ return (0, smithy_client_1.take)(output, {
1323
+ 'bm25Score': smithy_client_1.limitedParseDouble,
1324
+ 'chunkId': smithy_client_1.expectString,
1325
+ 'dataSourceId': smithy_client_1.expectString,
1326
+ 'dataSourceType': smithy_client_1.expectString,
1327
+ 'documentId': smithy_client_1.expectString,
1328
+ 'documentTitle': smithy_client_1.expectString,
1329
+ 'documentUrl': smithy_client_1.expectString,
1330
+ 'knnScore': smithy_client_1.limitedParseDouble,
1331
+ 'score': smithy_client_1.limitedParseDouble,
1332
+ });
1333
+ };
1334
+ const de_SearchHistorySearchResults = (output, context) => {
1335
+ const retVal = (output || []).filter((e) => e != null).map((entry) => {
1336
+ return de_SearchHistorySearchResult(entry, context);
1289
1337
  });
1290
1338
  return retVal;
1291
1339
  };
@@ -1298,7 +1346,9 @@ const de_SearchKnowledgeBaseResult = (output, context) => {
1298
1346
  'documentId': smithy_client_1.expectString,
1299
1347
  'documentTitle': smithy_client_1.expectString,
1300
1348
  'documentUrl': smithy_client_1.expectString,
1349
+ 'fullTextScore': smithy_client_1.limitedParseDouble,
1301
1350
  'score': smithy_client_1.limitedParseDouble,
1351
+ 'semanticScore': smithy_client_1.limitedParseDouble,
1302
1352
  });
1303
1353
  };
1304
1354
  const de_SearchKnowledgeBaseResults = (output, context) => {
@@ -1316,11 +1366,9 @@ const deserializeMetadata = (output) => ({
1316
1366
  const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then(body => context.utf8Encoder(body));
1317
1367
  const _c = "company";
1318
1368
  const _cI = "companyId";
1319
- const _dT = "documentType";
1320
1369
  const _l = "limit";
1321
1370
  const _lL = "logLevel";
1322
1371
  const _o = "offset";
1323
1372
  const _s = "sort";
1324
1373
  const _sT = "syncType";
1325
1374
  const _se = "search";
1326
- const _wC = "withChunks";
@@ -102,10 +102,6 @@ export const DocumentStatus = {
102
102
  PENDING: "pending",
103
103
  PROCESSING: "processing",
104
104
  };
105
- export const DownloadDocumentType = {
106
- MARKDOWN: "markdown",
107
- ORIGINAL: "original",
108
- };
109
105
  export const SyncDataSourceMode = {
110
106
  FULL: "full",
111
107
  INCREMENTAL: "incremental",
@@ -2,11 +2,11 @@ import { KnowledgeBaseServiceException as __BaseException } from "../models/Know
2
2
  import { DataSourceConfig, DataSourceNotFoundException, DocumentNotFoundException, ForbiddenException, KnowledgeBaseNotFoundException, UnauthorizedException, ValidationException, } from "../models/models_0";
3
3
  import { awsExpectUnion as __expectUnion, loadRestJsonErrorCode, parseJsonBody as parseBody, parseJsonErrorBody as parseErrorBody, } from "@aws-sdk/core";
4
4
  import { requestBuilder as rb } from "@smithy/core";
5
- import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, serializeFloat as __serializeFloat, _json, collectBody, map, take, withBaseException, } from "@smithy/smithy-client";
5
+ import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, limitedParseDouble as __limitedParseDouble, parseEpochTimestamp as __parseEpochTimestamp, serializeFloat as __serializeFloat, _json, collectBody, map, take, withBaseException, } from "@smithy/smithy-client";
6
6
  export const se_CleanDataSourceCommand = async (input, context) => {
7
7
  const b = rb(input, context);
8
8
  const headers = {};
9
- b.bp("/api/v1/data-sources/{dataSourceId}/clean");
9
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/clean");
10
10
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
11
11
  const query = map({
12
12
  [_c]: [, input[_cI]],
@@ -21,7 +21,7 @@ export const se_CleanDataSourceCommand = async (input, context) => {
21
21
  export const se_CloneDataSourceCommand = async (input, context) => {
22
22
  const b = rb(input, context);
23
23
  const headers = {};
24
- b.bp("/api/v1/data-sources/{dataSourceId}/clone");
24
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/clone");
25
25
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
26
26
  const query = map({
27
27
  [_c]: [, input[_cI]],
@@ -38,7 +38,7 @@ export const se_ConfigureDataSourceCommand = async (input, context) => {
38
38
  const headers = {
39
39
  'content-type': 'application/json',
40
40
  };
41
- b.bp("/api/v1/data-sources/{dataSourceId}/configure");
41
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/configure");
42
42
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
43
43
  const query = map({
44
44
  [_c]: [, input[_cI]],
@@ -59,7 +59,7 @@ export const se_CreateDataSourceCommand = async (input, context) => {
59
59
  const headers = {
60
60
  'content-type': 'application/json',
61
61
  };
62
- b.bp("/api/v1/data-sources");
62
+ b.bp("/api/v1/knowledge-bases/data-sources");
63
63
  const query = map({
64
64
  [_c]: [, input[_cI]],
65
65
  });
@@ -80,7 +80,7 @@ export const se_CreateDocumentCommand = async (input, context) => {
80
80
  const headers = {
81
81
  'content-type': 'application/json',
82
82
  };
83
- b.bp("/api/v1/data-sources/{dataSourceId}/documents");
83
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents");
84
84
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
85
85
  const query = map({
86
86
  [_c]: [, input[_cI]],
@@ -125,7 +125,7 @@ export const se_CreateKnowledgeBaseCommand = async (input, context) => {
125
125
  export const se_DeleteDataSourceCommand = async (input, context) => {
126
126
  const b = rb(input, context);
127
127
  const headers = {};
128
- b.bp("/api/v1/data-sources/{dataSourceId}");
128
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}");
129
129
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
130
130
  const query = map({
131
131
  [_c]: [, input[_cI]],
@@ -140,7 +140,7 @@ export const se_DeleteDataSourceCommand = async (input, context) => {
140
140
  export const se_DeleteDocumentCommand = async (input, context) => {
141
141
  const b = rb(input, context);
142
142
  const headers = {};
143
- b.bp("/api/v1/data-sources/{dataSourceId}/documents/{documentId}");
143
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents/{documentId}");
144
144
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
145
145
  b.p('documentId', () => input.documentId, '{documentId}', false);
146
146
  const query = map({
@@ -173,7 +173,7 @@ export const se_DescribeDataSourceCommand = async (input, context) => {
173
173
  const headers = {
174
174
  'content-type': 'application/json',
175
175
  };
176
- b.bp("/api/v1/data-sources/{dataSourceId}/describe");
176
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/describe");
177
177
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
178
178
  const query = map({
179
179
  [_c]: [, input[_cI]],
@@ -215,7 +215,7 @@ export const se_GenerateSearchAnswerCommand = async (input, context) => {
215
215
  export const se_GetDataSourceCommand = async (input, context) => {
216
216
  const b = rb(input, context);
217
217
  const headers = {};
218
- b.bp("/api/v1/data-sources/{dataSourceId}");
218
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}");
219
219
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
220
220
  const query = map({
221
221
  [_c]: [, input[_cI]],
@@ -230,7 +230,7 @@ export const se_GetDataSourceCommand = async (input, context) => {
230
230
  export const se_GetDataSourceSyncStatusCommand = async (input, context) => {
231
231
  const b = rb(input, context);
232
232
  const headers = {};
233
- b.bp("/api/v1/data-sources/{dataSourceId}/sync-status");
233
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/sync-status");
234
234
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
235
235
  const query = map({
236
236
  [_c]: [, input[_cI]],
@@ -245,12 +245,11 @@ export const se_GetDataSourceSyncStatusCommand = async (input, context) => {
245
245
  export const se_GetDocumentCommand = async (input, context) => {
246
246
  const b = rb(input, context);
247
247
  const headers = {};
248
- b.bp("/api/v1/data-sources/{dataSourceId}/documents/{documentId}");
248
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents/{documentId}");
249
249
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
250
250
  b.p('documentId', () => input.documentId, '{documentId}', false);
251
251
  const query = map({
252
252
  [_c]: [, input[_cI]],
253
- [_wC]: [() => input.withChunks !== void 0, () => (input[_wC].toString())],
254
253
  });
255
254
  let body;
256
255
  b.m("GET")
@@ -262,7 +261,7 @@ export const se_GetDocumentCommand = async (input, context) => {
262
261
  export const se_GetDocumentChunksCommand = async (input, context) => {
263
262
  const b = rb(input, context);
264
263
  const headers = {};
265
- b.bp("/api/v1/data-sources/{dataSourceId}/documents/{documentId}/chunks");
264
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents/{documentId}/chunks");
266
265
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
267
266
  b.p('documentId', () => input.documentId, '{documentId}', false);
268
267
  const query = map({
@@ -278,12 +277,11 @@ export const se_GetDocumentChunksCommand = async (input, context) => {
278
277
  export const se_GetDocumentDownloadUrlCommand = async (input, context) => {
279
278
  const b = rb(input, context);
280
279
  const headers = {};
281
- b.bp("/api/v1/data-sources/{dataSourceId}/documents/{documentId}/download_url");
280
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents/{documentId}/download-url");
282
281
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
283
282
  b.p('documentId', () => input.documentId, '{documentId}', false);
284
283
  const query = map({
285
284
  [_c]: [, input[_cI]],
286
- [_dT]: [, input[_dT]],
287
285
  });
288
286
  let body;
289
287
  b.m("GET")
@@ -295,7 +293,7 @@ export const se_GetDocumentDownloadUrlCommand = async (input, context) => {
295
293
  export const se_GetDocumentMarkdownCommand = async (input, context) => {
296
294
  const b = rb(input, context);
297
295
  const headers = {};
298
- b.bp("/api/v1/data-sources/{dataSourceId}/documents/{documentId}/markdown");
296
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents/{documentId}/markdown");
299
297
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
300
298
  b.p('documentId', () => input.documentId, '{documentId}', false);
301
299
  const query = map({
@@ -311,7 +309,7 @@ export const se_GetDocumentMarkdownCommand = async (input, context) => {
311
309
  export const se_GetDocumentUploadUrlCommand = async (input, context) => {
312
310
  const b = rb(input, context);
313
311
  const headers = {};
314
- b.bp("/api/v1/data-sources/{dataSourceId}/documents/{documentId}/upload_url");
312
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents/{documentId}/upload-url");
315
313
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
316
314
  b.p('documentId', () => input.documentId, '{documentId}', false);
317
315
  const query = map({
@@ -327,7 +325,7 @@ export const se_GetDocumentUploadUrlCommand = async (input, context) => {
327
325
  export const se_GetDocumentWithContentAndChunksCommand = async (input, context) => {
328
326
  const b = rb(input, context);
329
327
  const headers = {};
330
- b.bp("/api/v1/data-sources/{dataSourceId}/documents/{documentId}/with-content-and-chunks");
328
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents/{documentId}/with-content-and-chunks");
331
329
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
332
330
  b.p('documentId', () => input.documentId, '{documentId}', false);
333
331
  const query = map({
@@ -358,7 +356,7 @@ export const se_GetKnowledgeBaseCommand = async (input, context) => {
358
356
  export const se_ListDataSourcesCommand = async (input, context) => {
359
357
  const b = rb(input, context);
360
358
  const headers = {};
361
- b.bp("/api/v1/data-sources");
359
+ b.bp("/api/v1/knowledge-bases/data-sources");
362
360
  const query = map({
363
361
  [_c]: [, input[_cI]],
364
362
  });
@@ -372,7 +370,7 @@ export const se_ListDataSourcesCommand = async (input, context) => {
372
370
  export const se_ListDataSourceStatisticsCommand = async (input, context) => {
373
371
  const b = rb(input, context);
374
372
  const headers = {};
375
- b.bp("/api/v1/data-sources/{dataSourceId}/statistics");
373
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/statistics");
376
374
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
377
375
  const query = map({
378
376
  [_c]: [, input[_cI]],
@@ -387,7 +385,7 @@ export const se_ListDataSourceStatisticsCommand = async (input, context) => {
387
385
  export const se_ListDataSourceSynchronizationLogsCommand = async (input, context) => {
388
386
  const b = rb(input, context);
389
387
  const headers = {};
390
- b.bp("/api/v1/data-sources/{dataSourceId}/sync-logs");
388
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/sync-logs");
391
389
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
392
390
  const query = map({
393
391
  [_c]: [, input[_cI]],
@@ -407,12 +405,14 @@ export const se_ListDataSourceSynchronizationLogsCommand = async (input, context
407
405
  export const se_ListDocumentsCommand = async (input, context) => {
408
406
  const b = rb(input, context);
409
407
  const headers = {};
410
- b.bp("/api/v1/data-sources/{dataSourceId}/documents");
408
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents");
411
409
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
412
410
  const query = map({
413
411
  [_c]: [, input[_cI]],
414
412
  [_l]: [() => input.limit !== void 0, () => (input[_l].toString())],
415
413
  [_o]: [() => input.offset !== void 0, () => (input[_o].toString())],
414
+ [_s]: [, input[_s]],
415
+ [_se]: [, input[_se]],
416
416
  });
417
417
  let body;
418
418
  b.m("GET")
@@ -440,7 +440,7 @@ export const se_ListSearchQueriesHistoryCommand = async (input, context) => {
440
440
  const headers = {
441
441
  'content-type': 'application/json',
442
442
  };
443
- b.bp("/api/v1/history/search-queries");
443
+ b.bp("/api/v1/knowledge-bases/history/search-queries");
444
444
  const query = map({
445
445
  [_c]: [, input[_cI]],
446
446
  [_l]: [() => input.limit !== void 0, () => (input[_l].toString())],
@@ -487,7 +487,7 @@ export const se_SearchKnowledgeBaseCommand = async (input, context) => {
487
487
  export const se_StartSyncDataSourceCommand = async (input, context) => {
488
488
  const b = rb(input, context);
489
489
  const headers = {};
490
- b.bp("/api/v1/data-sources/{dataSourceId}/start-sync");
490
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/start-sync");
491
491
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
492
492
  const query = map({
493
493
  [_c]: [, input[_cI]],
@@ -503,7 +503,7 @@ export const se_StartSyncDataSourceCommand = async (input, context) => {
503
503
  export const se_StopSyncDataSourceCommand = async (input, context) => {
504
504
  const b = rb(input, context);
505
505
  const headers = {};
506
- b.bp("/api/v1/data-sources/{dataSourceId}/stop-sync");
506
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/stop-sync");
507
507
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
508
508
  const query = map({
509
509
  [_c]: [, input[_cI]],
@@ -520,7 +520,7 @@ export const se_UpdateDataSourceCommand = async (input, context) => {
520
520
  const headers = {
521
521
  'content-type': 'application/json',
522
522
  };
523
- b.bp("/api/v1/data-sources/{dataSourceId}");
523
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}");
524
524
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
525
525
  const query = map({
526
526
  [_c]: [, input[_cI]],
@@ -541,7 +541,7 @@ export const se_UpdateDocumentCommand = async (input, context) => {
541
541
  const headers = {
542
542
  'content-type': 'application/json',
543
543
  };
544
- b.bp("/api/v1/data-sources/{dataSourceId}/documents/{documentId}");
544
+ b.bp("/api/v1/knowledge-bases/data-sources/{dataSourceId}/documents/{documentId}");
545
545
  b.p('dataSourceId', () => input.dataSourceId, '{dataSourceId}', false);
546
546
  b.p('documentId', () => input.documentId, '{documentId}', false);
547
547
  const query = map({
@@ -718,8 +718,8 @@ export const de_GenerateSearchAnswerCommand = async (output, context) => {
718
718
  const data = __expectNonNull((__expectObject(await parseBody(output.body, context))), "body");
719
719
  const doc = take(data, {
720
720
  'answer': __expectString,
721
- 'metadata': _ => de_Document(_, context),
722
- 'sources': _ => de_Document(_, context),
721
+ 'metadata': _json,
722
+ 'sources': _ => de_SearchKnowledgeBaseResults(_, context),
723
723
  });
724
724
  Object.assign(contents, doc);
725
725
  return contents;
@@ -764,7 +764,6 @@ export const de_GetDocumentCommand = async (output, context) => {
764
764
  });
765
765
  const data = __expectNonNull((__expectObject(await parseBody(output.body, context))), "body");
766
766
  const doc = take(data, {
767
- 'chunks': _json,
768
767
  'document': _json,
769
768
  });
770
769
  Object.assign(contents, doc);
@@ -950,7 +949,7 @@ export const de_SearchKnowledgeBaseCommand = async (output, context) => {
950
949
  });
951
950
  const data = __expectNonNull((__expectObject(await parseBody(output.body, context))), "body");
952
951
  const doc = take(data, {
953
- 'metadata': _ => de_Document(_, context),
952
+ 'metadata': _json,
954
953
  'results': _ => de_SearchKnowledgeBaseResults(_, context),
955
954
  });
956
955
  Object.assign(contents, doc);
@@ -1159,7 +1158,9 @@ const se_SearchKnowledgeBaseResult = (input, context) => {
1159
1158
  'documentId': [],
1160
1159
  'documentTitle': [],
1161
1160
  'documentUrl': [],
1161
+ 'fullTextScore': __serializeFloat,
1162
1162
  'score': __serializeFloat,
1163
+ 'semanticScore': __serializeFloat,
1163
1164
  });
1164
1165
  };
1165
1166
  const se_SearchKnowledgeBaseResults = (input, context) => {
@@ -1215,9 +1216,56 @@ const de_DescribeDataSourceResult = (output, context) => {
1215
1216
  'proxy': (_) => de_Document(_, context),
1216
1217
  });
1217
1218
  };
1219
+ const de_SearchHistoryRequest = (output, context) => {
1220
+ return take(output, {
1221
+ 'externalSessionId': __expectString,
1222
+ 'knowledgeBaseId': __expectString,
1223
+ 'query': __expectString,
1224
+ 'searchLimit': __expectInt32,
1225
+ 'searchStrategy': __expectString,
1226
+ 'searchThreshold': __limitedParseDouble,
1227
+ 'user': __expectString,
1228
+ });
1229
+ };
1230
+ const de_SearchHistoryResponse = (output, context) => {
1231
+ return take(output, {
1232
+ 'results': (_) => de_SearchHistorySearchResults(_, context),
1233
+ });
1234
+ };
1235
+ const de_SearchHistoryResult = (output, context) => {
1236
+ return take(output, {
1237
+ 'companyId': __expectString,
1238
+ 'createdAt': (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
1239
+ 'request': (_) => de_SearchHistoryRequest(_, context),
1240
+ 'response': (_) => de_SearchHistoryResponse(_, context),
1241
+ 'resultsCount': __expectInt32,
1242
+ 'sessionId': __expectString,
1243
+ 'stages': _json,
1244
+ 'totalDuration': __expectInt32,
1245
+ });
1246
+ };
1218
1247
  const de_SearchHistoryResultsList = (output, context) => {
1219
1248
  const retVal = (output || []).filter((e) => e != null).map((entry) => {
1220
- return de_Document(entry, context);
1249
+ return de_SearchHistoryResult(entry, context);
1250
+ });
1251
+ return retVal;
1252
+ };
1253
+ const de_SearchHistorySearchResult = (output, context) => {
1254
+ return take(output, {
1255
+ 'bm25Score': __limitedParseDouble,
1256
+ 'chunkId': __expectString,
1257
+ 'dataSourceId': __expectString,
1258
+ 'dataSourceType': __expectString,
1259
+ 'documentId': __expectString,
1260
+ 'documentTitle': __expectString,
1261
+ 'documentUrl': __expectString,
1262
+ 'knnScore': __limitedParseDouble,
1263
+ 'score': __limitedParseDouble,
1264
+ });
1265
+ };
1266
+ const de_SearchHistorySearchResults = (output, context) => {
1267
+ const retVal = (output || []).filter((e) => e != null).map((entry) => {
1268
+ return de_SearchHistorySearchResult(entry, context);
1221
1269
  });
1222
1270
  return retVal;
1223
1271
  };
@@ -1230,7 +1278,9 @@ const de_SearchKnowledgeBaseResult = (output, context) => {
1230
1278
  'documentId': __expectString,
1231
1279
  'documentTitle': __expectString,
1232
1280
  'documentUrl': __expectString,
1281
+ 'fullTextScore': __limitedParseDouble,
1233
1282
  'score': __limitedParseDouble,
1283
+ 'semanticScore': __limitedParseDouble,
1234
1284
  });
1235
1285
  };
1236
1286
  const de_SearchKnowledgeBaseResults = (output, context) => {
@@ -1248,11 +1298,9 @@ const deserializeMetadata = (output) => ({
1248
1298
  const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then(body => context.utf8Encoder(body));
1249
1299
  const _c = "company";
1250
1300
  const _cI = "companyId";
1251
- const _dT = "documentType";
1252
1301
  const _l = "limit";
1253
1302
  const _lL = "logLevel";
1254
1303
  const _o = "offset";
1255
1304
  const _s = "sort";
1256
1305
  const _sT = "syncType";
1257
1306
  const _se = "search";
1258
- const _wC = "withChunks";
@@ -46,6 +46,8 @@ declare const GenerateSearchAnswerCommand_base: {
46
46
  * dataSourceType: "files" || "confluence" || "gdrive", // required
47
47
  * content: "STRING_VALUE", // required
48
48
  * score: Number("double"), // required
49
+ * fullTextScore: Number("double"),
50
+ * semanticScore: Number("double"),
49
51
  * documentHierarchy: [ // StringList
50
52
  * "STRING_VALUE",
51
53
  * ],
@@ -60,8 +62,28 @@ declare const GenerateSearchAnswerCommand_base: {
60
62
  * const response = await client.send(command);
61
63
  * // { // GenerateSearchAnswerOutput
62
64
  * // answer: "STRING_VALUE", // required
63
- * // metadata: "DOCUMENT_VALUE", // required
64
- * // sources: "DOCUMENT_VALUE", // required
65
+ * // metadata: { // AnswerMetadata
66
+ * // model: "STRING_VALUE", // required
67
+ * // inputTokens: Number("int"), // required
68
+ * // outputTokens: Number("int"), // required
69
+ * // duration: Number("int"), // required
70
+ * // },
71
+ * // sources: [ // SearchKnowledgeBaseResults // required
72
+ * // { // SearchKnowledgeBaseResult
73
+ * // documentId: "STRING_VALUE", // required
74
+ * // documentTitle: "STRING_VALUE", // required
75
+ * // documentUrl: "STRING_VALUE", // required
76
+ * // dataSourceId: "STRING_VALUE", // required
77
+ * // dataSourceType: "files" || "confluence" || "gdrive", // required
78
+ * // content: "STRING_VALUE", // required
79
+ * // score: Number("double"), // required
80
+ * // fullTextScore: Number("double"),
81
+ * // semanticScore: Number("double"),
82
+ * // documentHierarchy: [ // StringList
83
+ * // "STRING_VALUE",
84
+ * // ],
85
+ * // },
86
+ * // ],
65
87
  * // };
66
88
  *
67
89
  * ```
@@ -42,9 +42,9 @@ declare const GetDataSourceSyncStatusCommand_base: {
42
42
  * const response = await client.send(command);
43
43
  * // { // GetDataSourceSyncStatusOutput
44
44
  * // syncStatus: "idle" || "running" || "success" || "failed", // required
45
- * // lastSyncedAt: "STRING_VALUE", // required
46
- * // lastSyncMode: "full" || "incremental", // required
47
- * // lastSyncErrorMessage: "STRING_VALUE", // required
45
+ * // lastSyncedAt: "STRING_VALUE",
46
+ * // lastSyncMode: "full" || "incremental",
47
+ * // lastSyncErrorMessage: "STRING_VALUE",
48
48
  * // };
49
49
  *
50
50
  * ```
@@ -38,7 +38,6 @@ declare const GetDocumentCommand_base: {
38
38
  * companyId: "STRING_VALUE",
39
39
  * dataSourceId: "STRING_VALUE", // required
40
40
  * documentId: "STRING_VALUE", // required
41
- * withChunks: true || false,
42
41
  * };
43
42
  * const command = new GetDocumentCommand(input);
44
43
  * const response = await client.send(command);
@@ -61,15 +60,6 @@ declare const GetDocumentCommand_base: {
61
60
  * // processingDuration: Number("int"),
62
61
  * // errorMessage: "STRING_VALUE",
63
62
  * // },
64
- * // chunks: [ // ChunksList
65
- * // { // ChunkItem
66
- * // id: "STRING_VALUE", // required
67
- * // documentId: "STRING_VALUE", // required
68
- * // content: "STRING_VALUE", // required
69
- * // createdAt: "STRING_VALUE", // required
70
- * // updatedAt: "STRING_VALUE", // required
71
- * // },
72
- * // ],
73
63
  * // };
74
64
  *
75
65
  * ```
@@ -38,7 +38,6 @@ declare const GetDocumentDownloadUrlCommand_base: {
38
38
  * companyId: "STRING_VALUE",
39
39
  * dataSourceId: "STRING_VALUE", // required
40
40
  * documentId: "STRING_VALUE", // required
41
- * documentType: "original" || "markdown",
42
41
  * };
43
42
  * const command = new GetDocumentDownloadUrlCommand(input);
44
43
  * const response = await client.send(command);
@@ -60,7 +60,7 @@ declare const GetDocumentWithContentAndChunksCommand_base: {
60
60
  * // processingDuration: Number("int"),
61
61
  * // errorMessage: "STRING_VALUE",
62
62
  * // },
63
- * // content: "STRING_VALUE",
63
+ * // content: "STRING_VALUE", // required
64
64
  * // chunks: [ // ChunksList // required
65
65
  * // { // ChunkItem
66
66
  * // id: "STRING_VALUE", // required
@@ -36,9 +36,11 @@ declare const ListDocumentsCommand_base: {
36
36
  * const client = new KnowledgeBaseClient(config);
37
37
  * const input = { // ListDocumentsInput
38
38
  * companyId: "STRING_VALUE",
39
- * dataSourceId: "STRING_VALUE", // required
40
39
  * limit: Number("int"),
41
40
  * offset: Number("int"),
41
+ * sort: "STRING_VALUE",
42
+ * dataSourceId: "STRING_VALUE", // required
43
+ * search: "STRING_VALUE",
42
44
  * };
43
45
  * const command = new ListDocumentsCommand(input);
44
46
  * const response = await client.send(command);
@@ -52,7 +52,63 @@ declare const ListSearchQueriesHistoryCommand_base: {
52
52
  * const response = await client.send(command);
53
53
  * // { // ListSearchQueriesHistoryOutput
54
54
  * // results: [ // SearchHistoryResultsList // required
55
- * // "DOCUMENT_VALUE",
55
+ * // { // SearchHistoryResult
56
+ * // sessionId: "STRING_VALUE", // required
57
+ * // companyId: "STRING_VALUE", // required
58
+ * // request: { // SearchHistoryRequest
59
+ * // query: "STRING_VALUE", // required
60
+ * // user: "STRING_VALUE", // required
61
+ * // externalSessionId: "STRING_VALUE", // required
62
+ * // knowledgeBaseId: "STRING_VALUE", // required
63
+ * // searchStrategy: "bm25" || "vector" || "hybrid", // required
64
+ * // searchLimit: Number("int"), // required
65
+ * // searchThreshold: Number("double"), // required
66
+ * // },
67
+ * // stages: { // SearchHistoryStages
68
+ * // overall: { // SearchHistoryStage
69
+ * // startTime: Number("long"), // required
70
+ * // endTime: Number("long"), // required
71
+ * // duration: Number("int"), // required
72
+ * // },
73
+ * // generateQueryEmbedding: { // SearchHistoryEmbeddingStage
74
+ * // startTime: Number("long"), // required
75
+ * // endTime: Number("long"), // required
76
+ * // duration: Number("int"), // required
77
+ * // provider: "STRING_VALUE", // required
78
+ * // model: "STRING_VALUE", // required
79
+ * // inputTokens: Number("int"), // required
80
+ * // outputTokens: Number("int"), // required
81
+ * // },
82
+ * // search: {
83
+ * // startTime: Number("long"), // required
84
+ * // endTime: Number("long"), // required
85
+ * // duration: Number("int"), // required
86
+ * // },
87
+ * // enrichData: {
88
+ * // startTime: Number("long"), // required
89
+ * // endTime: Number("long"), // required
90
+ * // duration: Number("int"), // required
91
+ * // },
92
+ * // },
93
+ * // response: { // SearchHistoryResponse
94
+ * // results: [ // SearchHistorySearchResults // required
95
+ * // { // SearchHistorySearchResult
96
+ * // chunkId: "STRING_VALUE", // required
97
+ * // documentId: "STRING_VALUE", // required
98
+ * // documentTitle: "STRING_VALUE", // required
99
+ * // documentUrl: "STRING_VALUE", // required
100
+ * // dataSourceId: "STRING_VALUE", // required
101
+ * // dataSourceType: "files" || "confluence" || "gdrive", // required
102
+ * // score: Number("double"), // required
103
+ * // bm25Score: Number("double"),
104
+ * // knnScore: Number("double"),
105
+ * // },
106
+ * // ],
107
+ * // },
108
+ * // createdAt: new Date("TIMESTAMP"), // required
109
+ * // totalDuration: Number("int"), // required
110
+ * // resultsCount: Number("int"), // required
111
+ * // },
56
112
  * // ],
57
113
  * // };
58
114
  *
@@ -57,12 +57,17 @@ declare const SearchKnowledgeBaseCommand_base: {
57
57
  * // dataSourceType: "files" || "confluence" || "gdrive", // required
58
58
  * // content: "STRING_VALUE", // required
59
59
  * // score: Number("double"), // required
60
+ * // fullTextScore: Number("double"),
61
+ * // semanticScore: Number("double"),
60
62
  * // documentHierarchy: [ // StringList
61
63
  * // "STRING_VALUE",
62
64
  * // ],
63
65
  * // },
64
66
  * // ],
65
- * // metadata: "DOCUMENT_VALUE",
67
+ * // metadata: { // SearchResultMetadata
68
+ * // sessionId: "STRING_VALUE", // required
69
+ * // duration: Number("int"), // required
70
+ * // },
66
71
  * // };
67
72
  *
68
73
  * ```
@@ -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
  */
@@ -932,18 +941,6 @@ export interface DescribeDataSourceResult {
932
941
  export interface DescribeDataSourceOutput {
933
942
  result: DescribeDataSourceResult;
934
943
  }
935
- /**
936
- * @public
937
- * @enum
938
- */
939
- export declare const DownloadDocumentType: {
940
- readonly MARKDOWN: "markdown";
941
- readonly ORIGINAL: "original";
942
- };
943
- /**
944
- * @public
945
- */
946
- export type DownloadDocumentType = typeof DownloadDocumentType[keyof typeof DownloadDocumentType];
947
944
  /**
948
945
  * @public
949
946
  */
@@ -967,6 +964,16 @@ export interface SearchKnowledgeBaseResult {
967
964
  * @public
968
965
  */
969
966
  score: number;
967
+ /**
968
+ * The score of the result, calculated from the full-text search score.
969
+ * @public
970
+ */
971
+ fullTextScore?: number | undefined;
972
+ /**
973
+ * The score of the result, calculated from the semantic search score.
974
+ * @public
975
+ */
976
+ semanticScore?: number | undefined;
970
977
  /**
971
978
  * The hierarchy of the document. The hierarchy is a list of document IDs that are the parents of the current document. The hierarchy is used to build the document hierarchy in the search results.
972
979
  * @public
@@ -1018,8 +1025,8 @@ export interface GenerateSearchAnswerInput {
1018
1025
  */
1019
1026
  export interface GenerateSearchAnswerOutput {
1020
1027
  answer: string;
1021
- metadata: __DocumentType;
1022
- sources: __DocumentType;
1028
+ metadata: AnswerMetadata;
1029
+ sources: (SearchKnowledgeBaseResult)[];
1023
1030
  }
1024
1031
  /**
1025
1032
  * @public
@@ -1088,9 +1095,9 @@ export type SyncDataSourceStatus = typeof SyncDataSourceStatus[keyof typeof Sync
1088
1095
  */
1089
1096
  export interface GetDataSourceSyncStatusOutput {
1090
1097
  syncStatus: SyncDataSourceStatus;
1091
- lastSyncedAt: string;
1092
- lastSyncMode: SyncDataSourceMode;
1093
- lastSyncErrorMessage: string;
1098
+ lastSyncedAt?: string | undefined;
1099
+ lastSyncMode?: SyncDataSourceMode | undefined;
1100
+ lastSyncErrorMessage?: string | undefined;
1094
1101
  }
1095
1102
  /**
1096
1103
  * @public
@@ -1111,18 +1118,12 @@ export interface GetDocumentInput {
1111
1118
  * @public
1112
1119
  */
1113
1120
  documentId: string;
1114
- /**
1115
- * When true, includes the list of text chunks that the document was split into for embedding and search. Useful for understanding how the document was processed. Defaults to false if not specified
1116
- * @public
1117
- */
1118
- withChunks?: boolean | undefined;
1119
1121
  }
1120
1122
  /**
1121
1123
  * @public
1122
1124
  */
1123
1125
  export interface GetDocumentOutput {
1124
1126
  document: DocumentItem;
1125
- chunks?: (ChunkItem)[] | undefined;
1126
1127
  }
1127
1128
  /**
1128
1129
  * @public
@@ -1169,11 +1170,6 @@ export interface GetDocumentDownloadUrlInput {
1169
1170
  * @public
1170
1171
  */
1171
1172
  documentId: string;
1172
- /**
1173
- * Format of the document to download. 'original' returns the file in its original format (pdf, docx, etc.), 'markdown' returns a markdown-converted version. Defaults to 'markdown' if not specified
1174
- * @public
1175
- */
1176
- documentType?: DownloadDocumentType | undefined;
1177
1173
  }
1178
1174
  /**
1179
1175
  * @public
@@ -1258,7 +1254,7 @@ export interface GetDocumentWithContentAndChunksInput {
1258
1254
  */
1259
1255
  export interface GetDocumentWithContentAndChunksOutput {
1260
1256
  document: DocumentItem;
1261
- content?: string | undefined;
1257
+ content: string;
1262
1258
  chunks: (ChunkItem)[];
1263
1259
  }
1264
1260
  /**
@@ -1389,21 +1385,23 @@ export interface ListDocumentsInput {
1389
1385
  * @public
1390
1386
  */
1391
1387
  companyId?: string | undefined;
1388
+ limit?: number | undefined;
1389
+ offset?: number | undefined;
1392
1390
  /**
1393
- * Unique identifier of the data source
1391
+ * Sort order of the results. If there is a '-' prefix, the results will be sorted in descending order. Otherwise, the results will be sorted in ascending order. Example: '-createdAt' will sort the results by createdAt in descending order. 'createdAt' will sort the results by createdAt in ascending order.
1394
1392
  * @public
1395
1393
  */
1396
- dataSourceId: string;
1394
+ sort?: string | undefined;
1397
1395
  /**
1398
- * Maximum number of documents to return in a single page. Enables pagination for retrieving large document sets efficiently. Valid range: 1-500. Defaults to 50 if not specified
1396
+ * Unique identifier of the data source
1399
1397
  * @public
1400
1398
  */
1401
- limit?: number | undefined;
1399
+ dataSourceId: string;
1402
1400
  /**
1403
- * Number of documents to skip from the beginning for pagination. Use with limit to retrieve specific document pages. Example: 0 for first page, 50 for second page with limit=50. Defaults to 0 if not specified
1401
+ * The search query string for filtering the documents results.
1404
1402
  * @public
1405
1403
  */
1406
- offset?: number | undefined;
1404
+ search?: string | undefined;
1407
1405
  }
1408
1406
  /**
1409
1407
  * @public
@@ -1484,12 +1482,6 @@ export interface ListSearchQueriesHistoryInput {
1484
1482
  */
1485
1483
  search?: string | undefined;
1486
1484
  }
1487
- /**
1488
- * @public
1489
- */
1490
- export interface ListSearchQueriesHistoryOutput {
1491
- results: (__DocumentType)[];
1492
- }
1493
1485
  /**
1494
1486
  * @public
1495
1487
  * @enum
@@ -1503,6 +1495,102 @@ export declare const SearchStrategy: {
1503
1495
  * @public
1504
1496
  */
1505
1497
  export type SearchStrategy = typeof SearchStrategy[keyof typeof SearchStrategy];
1498
+ /**
1499
+ * @public
1500
+ */
1501
+ export interface SearchHistoryRequest {
1502
+ query: string;
1503
+ user: string;
1504
+ externalSessionId: string;
1505
+ /**
1506
+ * Unique identifier of the knowledge base
1507
+ * @public
1508
+ */
1509
+ knowledgeBaseId: string;
1510
+ searchStrategy: SearchStrategy;
1511
+ searchLimit: number;
1512
+ searchThreshold: number;
1513
+ }
1514
+ /**
1515
+ * @public
1516
+ */
1517
+ export interface SearchHistorySearchResult {
1518
+ /**
1519
+ * The ID of the chunk. Example: 123e4567-e89b-12d3-a456-426614174000
1520
+ * @public
1521
+ */
1522
+ chunkId: string;
1523
+ /**
1524
+ * Unique identifier of the document
1525
+ * @public
1526
+ */
1527
+ documentId: string;
1528
+ documentTitle: string;
1529
+ documentUrl: string;
1530
+ /**
1531
+ * Unique identifier of the data source
1532
+ * @public
1533
+ */
1534
+ dataSourceId: string;
1535
+ dataSourceType: DataSourceType;
1536
+ score: number;
1537
+ bm25Score?: number | undefined;
1538
+ knnScore?: number | undefined;
1539
+ }
1540
+ /**
1541
+ * @public
1542
+ */
1543
+ export interface SearchHistoryResponse {
1544
+ results: (SearchHistorySearchResult)[];
1545
+ }
1546
+ /**
1547
+ * @public
1548
+ */
1549
+ export interface SearchHistoryStage {
1550
+ startTime: number;
1551
+ endTime: number;
1552
+ duration: number;
1553
+ }
1554
+ /**
1555
+ * @public
1556
+ */
1557
+ export interface SearchHistoryEmbeddingStage {
1558
+ startTime: number;
1559
+ endTime: number;
1560
+ duration: number;
1561
+ provider: string;
1562
+ model: string;
1563
+ inputTokens: number;
1564
+ outputTokens: number;
1565
+ }
1566
+ /**
1567
+ * @public
1568
+ */
1569
+ export interface SearchHistoryStages {
1570
+ overall: SearchHistoryStage;
1571
+ generateQueryEmbedding?: SearchHistoryEmbeddingStage | undefined;
1572
+ search?: SearchHistoryStage | undefined;
1573
+ enrichData?: SearchHistoryStage | undefined;
1574
+ }
1575
+ /**
1576
+ * @public
1577
+ */
1578
+ export interface SearchHistoryResult {
1579
+ sessionId: string;
1580
+ companyId: string;
1581
+ request: SearchHistoryRequest;
1582
+ stages: SearchHistoryStages;
1583
+ response: SearchHistoryResponse;
1584
+ createdAt: Date;
1585
+ totalDuration: number;
1586
+ resultsCount: number;
1587
+ }
1588
+ /**
1589
+ * @public
1590
+ */
1591
+ export interface ListSearchQueriesHistoryOutput {
1592
+ results: (SearchHistoryResult)[];
1593
+ }
1506
1594
  /**
1507
1595
  * @public
1508
1596
  * @enum
@@ -1566,12 +1654,19 @@ export interface SearchKnowledgeBaseInput {
1566
1654
  */
1567
1655
  externalSessionId?: string | undefined;
1568
1656
  }
1657
+ /**
1658
+ * @public
1659
+ */
1660
+ export interface SearchResultMetadata {
1661
+ sessionId: string;
1662
+ duration: number;
1663
+ }
1569
1664
  /**
1570
1665
  * @public
1571
1666
  */
1572
1667
  export interface SearchKnowledgeBaseOutput {
1573
1668
  results: (SearchKnowledgeBaseResult)[];
1574
- metadata?: __DocumentType | undefined;
1669
+ metadata: SearchResultMetadata;
1575
1670
  }
1576
1671
  /**
1577
1672
  * @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.50",
4
+ "version": "0.0.52",
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",