@or-sdk/knowledge-models 0.24.39 → 0.24.40-beta.3611.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.
@@ -1,4 +1,6 @@
1
1
  import { Base, List, makeList, CalApiParams } from '@or-sdk/base';
2
+
3
+ import { SERVICE_KEY } from './constants';
2
4
  import {
3
5
  KnowledgeModelsConfig,
4
6
  KnowledgeModel,
@@ -29,7 +31,6 @@ import {
29
31
  CloneResponse,
30
32
  } from './types';
31
33
  import { getEntityBody } from './utils';
32
- import { SERVICE_KEY } from './constants';
33
34
 
34
35
  export class KnowledgeModels extends Base {
35
36
 
@@ -44,7 +45,11 @@ export class KnowledgeModels extends Base {
44
45
  });
45
46
  }
46
47
 
47
- private async getFullList<T>(method: CalApiParams['method'], route: string, queryParams: { [key: string]: unknown; } = {}): Promise<List<T>> {
48
+ private async getFullList<T>(
49
+ method: CalApiParams['method'],
50
+ route: string,
51
+ queryParams: { [key: string]: unknown; } = {}
52
+ ): Promise<List<T>> {
48
53
  const params = {
49
54
  ...queryParams,
50
55
  last: undefined as unknown,
@@ -103,7 +108,14 @@ export class KnowledgeModels extends Base {
103
108
  * });
104
109
  * ```
105
110
  */
106
- public async createKnowledgeModel({ name, desc, imageSrc, config, culture, extensions }: KnowledgeModelCreateParams): Promise<KnowledgeModel> {
111
+ public async createKnowledgeModel({
112
+ name,
113
+ desc,
114
+ imageSrc,
115
+ config,
116
+ culture,
117
+ extensions,
118
+ }: KnowledgeModelCreateParams): Promise<KnowledgeModel> {
107
119
  const data = {
108
120
  name,
109
121
  desc,
@@ -171,7 +183,13 @@ export class KnowledgeModels extends Base {
171
183
  * const result = await knowledgeModels.postLimits({ accountId: 'acc-id', limits: { metric: '', number: 0 } });
172
184
  * ```
173
185
  */
174
- public async postLimits({ accountId, limits }: { accountId: string; limits: { metric: string; number: number; }; }): Promise<void> {
186
+ public async postLimits({
187
+ accountId,
188
+ limits,
189
+ }: {
190
+ accountId: string;
191
+ limits: { metric: string; number: number; };
192
+ }): Promise<void> {
175
193
  const data = {
176
194
  accountId,
177
195
  limits,
@@ -207,10 +225,25 @@ export class KnowledgeModels extends Base {
207
225
  /**
208
226
  * List entities
209
227
  * ```typescript
210
- * const result = await knowledgeModels.listEntities({ type: 'type', kbId: 'kb-id', versionId: 'version-id', limit: 30 });
228
+ * const result = await knowledgeModels.listEntities({
229
+ * type: 'type',
230
+ * kbId: 'kb-id',
231
+ * versionId: 'version-id',
232
+ * limit: 30
233
+ * });
211
234
  * ```
212
235
  */
213
- public async listEntities({ type, kbId, versionId, limit }: { type: string; kbId?: string; versionId?: string; limit?: number; }): Promise<List<Entity>> {
236
+ public async listEntities({
237
+ type,
238
+ kbId,
239
+ versionId,
240
+ limit,
241
+ }: {
242
+ type: string;
243
+ kbId?: string;
244
+ versionId?: string;
245
+ limit?: number;
246
+ }): Promise<List<Entity>> {
214
247
  const params = {
215
248
  kbId,
216
249
  versionId,
@@ -223,10 +256,22 @@ export class KnowledgeModels extends Base {
223
256
  /**
224
257
  * List features
225
258
  * ```typescript
226
- * const result = await knowledgeModels.listFeatures({ type: 'type', kbId: 'kb-id', versionId: 'version-id', limit: 30 });
259
+ * const result = await knowledgeModels.listFeatures({
260
+ * type: 'type',
261
+ * kbId: 'kb-id',
262
+ * versionId: 'version-id',
263
+ * limit: 30
264
+ * });
227
265
  * ```
228
266
  */
229
- public async listFeatures({ kbId, versionId, limit }: { kbId: string; versionId?: string; limit?: number; }): Promise<List<Feature>> {
267
+ public async listFeatures({
268
+ kbId,
269
+ versionId,
270
+ limit,
271
+ }: { kbId: string;
272
+ versionId?: string;
273
+ limit?: number;
274
+ }): Promise<List<Feature>> {
230
275
  const params = {
231
276
  kbId,
232
277
  versionId,
@@ -239,10 +284,31 @@ export class KnowledgeModels extends Base {
239
284
  /**
240
285
  * List applications
241
286
  * ```typescript
242
- * const result = await knowledgeModels.listApplications({ kbId: 'kb-id', text: 'text', pattern: 'pattern', versionId: 'version-id', limit: 30, projection: ['fieldName'] });
287
+ * const result = await knowledgeModels.listApplications({
288
+ * kbId: 'kb-id',
289
+ * text: 'text',
290
+ * pattern: 'pattern',
291
+ * versionId: 'version-id',
292
+ * limit: 30,
293
+ * projection: ['fieldName']
294
+ * });
243
295
  * ```
244
296
  */
245
- public async listApplications({ kbId, text, pattern, versionId, limit, projection }: { kbId: string; text?: string; pattern?: string; versionId?: string; limit?: number; projection?: string[]; }): Promise<List<Application>> {
297
+ public async listApplications({
298
+ kbId,
299
+ text,
300
+ pattern,
301
+ versionId,
302
+ limit,
303
+ projection,
304
+ }: {
305
+ kbId: string;
306
+ text?: string;
307
+ pattern?: string;
308
+ versionId?: string;
309
+ limit?: number;
310
+ projection?: string[];
311
+ }): Promise<List<Application>> {
246
312
  const params = {
247
313
  kbId,
248
314
  limit,
@@ -280,7 +346,15 @@ export class KnowledgeModels extends Base {
280
346
  * const result = await knowledgeModels.listUtterances({ kbId: 'kb-id', limit: 30 });
281
347
  * ```
282
348
  */
283
- public async listUtterances({ kbId, limit, ...query }: { kbId: string; limit?: number; query?: { [key: string]: unknown; }; }): Promise<List<Utterance>> {
349
+ public async listUtterances({
350
+ kbId,
351
+ limit,
352
+ ...query
353
+ }: {
354
+ kbId: string;
355
+ limit?: number;
356
+ query?: { [key: string]: unknown; };
357
+ }): Promise<List<Utterance>> {
284
358
  const params = {
285
359
  kbId,
286
360
  limit,
@@ -296,7 +370,15 @@ export class KnowledgeModels extends Base {
296
370
  * const result = await knowledgeModels.listPatterns({ kbId: 'kb-id', limit: 30 });
297
371
  * ```
298
372
  */
299
- public async listPatterns({ kbId, limit, ...query }: { kbId: string; limit?: number; query?: { [key: string]: unknown; }; }): Promise<List<Pattern>> {
373
+ public async listPatterns({
374
+ kbId,
375
+ limit,
376
+ ...query
377
+ }: {
378
+ kbId: string;
379
+ limit?: number;
380
+ query?: { [key: string]: unknown; };
381
+ }): Promise<List<Pattern>> {
300
382
  const params = {
301
383
  kbId,
302
384
  limit,
@@ -312,7 +394,13 @@ export class KnowledgeModels extends Base {
312
394
  * const result = await knowledgeModels.listPrebuiltModels({ limit: 30 });
313
395
  * ```
314
396
  */
315
- public async listPrebuiltModels({ limit, ...query }: { limit?: number; query?: { [key: string]: unknown; }; } = {}): Promise<List<PrebuiltModel>> {
397
+ public async listPrebuiltModels({
398
+ limit,
399
+ ...query
400
+ }: {
401
+ limit?: number;
402
+ query?: { [key: string]: unknown; };
403
+ } = {}): Promise<List<PrebuiltModel>> {
316
404
  const params = {
317
405
  limit,
318
406
  ...query,
@@ -327,7 +415,13 @@ export class KnowledgeModels extends Base {
327
415
  * await knowledgeModels.listPrebuiltModels({ prebuiltModelId: 'prebuilt-model-id', kbId: 'kb-id' });
328
416
  * ```
329
417
  */
330
- public async removePrebuiltModelFromKM({ prebuiltModelId, kbId }: { prebuiltModelId: string; kbId: string; }): Promise<void> {
418
+ public async removePrebuiltModelFromKM({
419
+ prebuiltModelId,
420
+ kbId,
421
+ }: {
422
+ prebuiltModelId: string;
423
+ kbId: string;
424
+ }): Promise<void> {
331
425
  const params = {
332
426
  prebuiltModelId,
333
427
  kbId,
@@ -391,10 +485,19 @@ export class KnowledgeModels extends Base {
391
485
  /**
392
486
  * Get prebuilt models details
393
487
  * ```typescript
394
- * const result = await knowledgeModels.getPrebuiltModelDetails({ kbId: 'kb-id', prebuiltModelId: 'prebuilt-model-id' });
488
+ * const result = await knowledgeModels.getPrebuiltModelDetails({
489
+ * kbId: 'kb-id',
490
+ * prebuiltModelId: 'prebuilt-model-id'
491
+ * });
395
492
  * ```
396
493
  */
397
- public async getPrebuiltModelDetails({ kbId, prebuiltModelId }: { kbId: string; prebuiltModelId: string; }): Promise<PrebuiltModelDetails> {
494
+ public async getPrebuiltModelDetails({
495
+ kbId,
496
+ prebuiltModelId,
497
+ }: {
498
+ kbId: string;
499
+ prebuiltModelId: string;
500
+ }): Promise<PrebuiltModelDetails> {
398
501
  const params = {
399
502
  kbId,
400
503
  prebuiltModelId,
@@ -410,10 +513,28 @@ export class KnowledgeModels extends Base {
410
513
  /**
411
514
  * Create application
412
515
  * ```typescript
413
- * const result = await knowledgeModels.createApplication({ kbId: 'kb-id', name: 'Name', desc: 'Description', culture: 'en-us', model_features: ['feat-id'] });
516
+ * const result = await knowledgeModels.createApplication({
517
+ * kbId: 'kb-id',
518
+ * name: 'Name',
519
+ * desc: 'Description',
520
+ * culture: 'en-us',
521
+ * model_features: ['feat-id']
522
+ * });
414
523
  * ```
415
524
  */
416
- public async createApplication({ kbId, name, desc, culture, model_features }: { kbId: string; name: string; desc: string; culture: string; model_features: string[]; }): Promise<Application> {
525
+ public async createApplication({
526
+ kbId,
527
+ name,
528
+ desc,
529
+ culture,
530
+ model_features,
531
+ }: {
532
+ kbId: string;
533
+ name: string;
534
+ desc: string;
535
+ culture: string;
536
+ model_features: string[];
537
+ }): Promise<Application> {
417
538
  const data = {
418
539
  kbId,
419
540
  name,
@@ -432,10 +553,34 @@ export class KnowledgeModels extends Base {
432
553
  /**
433
554
  * Create intent
434
555
  * ```typescript
435
- * const result = await knowledgeModels.createIntent({ name: 'Name', type: 'type', kbId: 'kb-id', appId: 'app-id', postprocessFlows: ['flows-id'], customData: {}, features: ['feat-id']});
556
+ * const result = await knowledgeModels.createIntent({
557
+ * name: 'Name',
558
+ * type: 'type',
559
+ * kbId: 'kb-id',
560
+ * appId: 'app-id',
561
+ * postprocessFlows: ['flows-id'],
562
+ * customData: {},
563
+ * features: ['feat-id']
564
+ * });
436
565
  * ```
437
566
  */
438
- public async createIntent({ name, type, kbId, appId, postprocessFlows, customData, features }: { name: string; type: string; kbId: string; appId: string; postprocessFlows: string[]; customData?: { [key: string]: unknown; }; features: string[]; }): Promise<Intent> {
567
+ public async createIntent({
568
+ name,
569
+ type,
570
+ kbId,
571
+ appId,
572
+ postprocessFlows,
573
+ customData,
574
+ features,
575
+ }: {
576
+ name: string;
577
+ type: string;
578
+ kbId: string;
579
+ appId: string;
580
+ postprocessFlows: string[];
581
+ customData?: { [key: string]: unknown; };
582
+ features: string[];
583
+ }): Promise<Intent> {
439
584
  const data = {
440
585
  name,
441
586
  type,
@@ -460,10 +605,31 @@ export class KnowledgeModels extends Base {
460
605
  /**
461
606
  * Create utterance
462
607
  * ```typescript
463
- * const result = await knowledgeModels.createUtterance({ appId: 'app-id', kbId: 'kb-id', autoGenerated: false, text: 'text', intent: 'intent-id', entities: [] });
608
+ * const result = await knowledgeModels.createUtterance({
609
+ * appId: 'app-id',
610
+ * kbId: 'kb-id',
611
+ * autoGenerated: false,
612
+ * text: 'text',
613
+ * intent: 'intent-id',
614
+ * entities: []
615
+ * });
464
616
  * ```
465
617
  */
466
- public async createUtterance({ appId, kbId, autoGenerated, text, intent, entities }: { appId: string; kbId: string; autoGenerated?: boolean; text: string; intent: string; entities: UtteranceEntity[]; }): Promise<Utterance> {
618
+ public async createUtterance({
619
+ appId,
620
+ kbId,
621
+ autoGenerated,
622
+ text,
623
+ intent,
624
+ entities,
625
+ }: {
626
+ appId: string;
627
+ kbId: string;
628
+ autoGenerated?: boolean;
629
+ text: string;
630
+ intent: string;
631
+ entities: UtteranceEntity[];
632
+ }): Promise<Utterance> {
467
633
  const data = {
468
634
  autoGenerated,
469
635
  text,
@@ -487,10 +653,28 @@ export class KnowledgeModels extends Base {
487
653
  /**
488
654
  * Create pattern
489
655
  * ```typescript
490
- * const result = await knowledgeModels.createPattern({ appId: 'app-id', kbId: 'kb-id', pattern: 'pattern', intent: 'intent-id', entities: [] });
656
+ * const result = await knowledgeModels.createPattern({
657
+ * appId: 'app-id',
658
+ * kbId: 'kb-id',
659
+ * pattern: 'pattern',
660
+ * intent: 'intent-id',
661
+ * entities: []
662
+ * });
491
663
  * ```
492
664
  */
493
- public async createPattern({ appId, kbId, pattern, intent, entities }: { appId: string; kbId: string; pattern: string; intent: string; entities: PatternEntity[]; }): Promise<Pattern> {
665
+ public async createPattern({
666
+ appId,
667
+ kbId,
668
+ pattern,
669
+ intent,
670
+ entities,
671
+ }: {
672
+ appId: string;
673
+ kbId: string;
674
+ pattern: string;
675
+ intent: string;
676
+ entities: PatternEntity[];
677
+ }): Promise<Pattern> {
494
678
  const data = {
495
679
  pattern,
496
680
  intent,
@@ -513,10 +697,28 @@ export class KnowledgeModels extends Base {
513
697
  /**
514
698
  * Create pair
515
699
  * ```typescript
516
- * const result = await knowledgeModels.createPair({ kbId: 'kb-id', applicationName: 'App name', intentName: 'Intent name', intentType: 'type', utteranceText: 'text' });
700
+ * const result = await knowledgeModels.createPair({
701
+ * kbId: 'kb-id',
702
+ * applicationName: 'App name',
703
+ * intentName: 'Intent name',
704
+ * intentType: 'type',
705
+ * utteranceText: 'text'
706
+ * });
517
707
  * ```
518
708
  */
519
- public async createPair({ kbId, applicationName, intentName, intentType, utteranceText }: { kbId: string; applicationName: string; intentName: string; intentType: string; utteranceText: string; }): Promise<Pair> {
709
+ public async createPair({
710
+ kbId,
711
+ applicationName,
712
+ intentName,
713
+ intentType,
714
+ utteranceText,
715
+ }: {
716
+ kbId: string;
717
+ applicationName: string;
718
+ intentName: string;
719
+ intentType: string;
720
+ utteranceText: string;
721
+ }): Promise<Pair> {
520
722
  const data = {
521
723
  kbId,
522
724
  applicationName,
@@ -538,7 +740,18 @@ export class KnowledgeModels extends Base {
538
740
  * const result = await knowledgeModels.batchCreatePairs({ kbId: 'kb-id', utterances: [] });
539
741
  * ```
540
742
  */
541
- public async batchCreatePairs({ kbId, utterances }: { kbId: string; utterances: { text: string; intent: string; intentType: string; application: string; }[]; }): Promise<CreatePairsResponse> {
743
+ public async batchCreatePairs({
744
+ kbId,
745
+ utterances,
746
+ }: {
747
+ kbId: string;
748
+ utterances: {
749
+ text: string;
750
+ intent: string;
751
+ intentType: string;
752
+ application: string;
753
+ }[];
754
+ }): Promise<CreatePairsResponse> {
542
755
  const data = {
543
756
  kbId,
544
757
  utterances,
@@ -557,7 +770,13 @@ export class KnowledgeModels extends Base {
557
770
  * const result = await knowledgeModels.batchCreatePairsFile({ kbId: 'kb-id', fileUrl: 'http://file.url' });
558
771
  * ```
559
772
  */
560
- public async batchCreatePairsFile({ kbId, fileUrl }: { kbId: string; fileUrl: string; }): Promise<CreatePairsResponse> {
773
+ public async batchCreatePairsFile({
774
+ kbId,
775
+ fileUrl,
776
+ }: {
777
+ kbId: string;
778
+ fileUrl: string;
779
+ }): Promise<CreatePairsResponse> {
561
780
  const data = {
562
781
  kbId,
563
782
  fileUrl,
@@ -573,10 +792,31 @@ export class KnowledgeModels extends Base {
573
792
  /**
574
793
  * Create pattern pair
575
794
  * ```typescript
576
- * const result = await knowledgeModels.createPatternPair({ kbId: 'kb-id', applicationName: 'App name', intentName: 'Intent name', intentType: 'type', patternText: 'text', patternEntities: [] });
795
+ * const result = await knowledgeModels.createPatternPair({
796
+ * kbId: 'kb-id',
797
+ * applicationName: 'App name',
798
+ * intentName: 'Intent name',
799
+ * intentType: 'type',
800
+ * patternText: 'text',
801
+ * patternEntities: []
802
+ * });
577
803
  * ```
578
804
  */
579
- public async createPatternPair({ kbId, applicationName, intentName, intentType, patternText, patternEntities }: { kbId: string; applicationName: string; intentName: string; intentType: string; patternText: string; patternEntities: PatternEntity[]; }): Promise<Pair> {
805
+ public async createPatternPair({
806
+ kbId,
807
+ applicationName,
808
+ intentName,
809
+ intentType,
810
+ patternText,
811
+ patternEntities,
812
+ }: {
813
+ kbId: string;
814
+ applicationName: string;
815
+ intentName: string;
816
+ intentType: string;
817
+ patternText: string;
818
+ patternEntities: PatternEntity[];
819
+ }): Promise<Pair> {
580
820
  const data = {
581
821
  kbId,
582
822
  applicationName,
@@ -596,10 +836,25 @@ export class KnowledgeModels extends Base {
596
836
  /**
597
837
  * Create pairs from csv
598
838
  * ```typescript
599
- * const result = await knowledgeModels.createPairsCsv({ kbId: 'kb-id', fileUrl: 'http://file.url', applicationName: 'App name', delimiter: 'delimiter' });
839
+ * const result = await knowledgeModels.createPairsCsv({
840
+ * kbId: 'kb-id',
841
+ * fileUrl: 'http://file.url',
842
+ * applicationName: 'App name',
843
+ * delimiter: 'delimiter'
844
+ * });
600
845
  * ```
601
846
  */
602
- public async createPairsCsv({ kbId, fileUrl, applicationName, delimiter }: { kbId: string; fileUrl: string; applicationName: string; delimiter: string; }): Promise<CreatePairsResponse> {
847
+ public async createPairsCsv({
848
+ kbId,
849
+ fileUrl,
850
+ applicationName,
851
+ delimiter,
852
+ }: {
853
+ kbId: string;
854
+ fileUrl: string;
855
+ applicationName: string;
856
+ delimiter: string;
857
+ }): Promise<CreatePairsResponse> {
603
858
  const data = {
604
859
  kbId,
605
860
  applicationName,
@@ -620,7 +875,19 @@ export class KnowledgeModels extends Base {
620
875
  * const result = await knowledgeModels.createEntity({ type: 'type', kbId: 'kb-id', name: 'Name', roles: ['role'] });
621
876
  * ```
622
877
  */
623
- public async createEntity({ type, kbId, name, roles, ...rest }: { type: string; kbId: string; name: string; roles: unknown[]; rest?: { [key: string]: unknown; }; }): Promise<Entity> {
878
+ public async createEntity({
879
+ type,
880
+ kbId,
881
+ name,
882
+ roles,
883
+ ...rest
884
+ }: {
885
+ type: string;
886
+ kbId: string;
887
+ name: string;
888
+ roles: unknown[];
889
+ rest?: { [key: string]: unknown; };
890
+ }): Promise<Entity> {
624
891
  const data = getEntityBody(type, {
625
892
  name,
626
893
  roles,
@@ -642,10 +909,28 @@ export class KnowledgeModels extends Base {
642
909
  /**
643
910
  * Create feature
644
911
  * ```typescript
645
- * const result = await knowledgeModels.createFeature({ kbId: 'kb-id', name: 'Name', mode: false, words: ['word'], enabledForAllModels: true });
912
+ * const result = await knowledgeModels.createFeature({
913
+ * kbId: 'kb-id',
914
+ * name: 'Name',
915
+ * mode: false,
916
+ * words: ['word'],
917
+ * enabledForAllModels: true
918
+ * });
646
919
  * ```
647
920
  */
648
- public async createFeature({ kbId, name, mode, words, enabledForAllModels }: { kbId: string; name: string; mode: boolean; words: string[]; enabledForAllModels: boolean; }): Promise<Feature> {
921
+ public async createFeature({
922
+ kbId,
923
+ name,
924
+ mode,
925
+ words,
926
+ enabledForAllModels,
927
+ }: {
928
+ kbId: string;
929
+ name: string;
930
+ mode: boolean;
931
+ words: string[];
932
+ enabledForAllModels: boolean;
933
+ }): Promise<Feature> {
649
934
  const data = {
650
935
  name,
651
936
  mode,
@@ -668,10 +953,28 @@ export class KnowledgeModels extends Base {
668
953
  /**
669
954
  * Update application
670
955
  * ```typescript
671
- * const result = await knowledgeModels.updateApplication({ kbId: 'kb-id', id: 'app-id', name: 'New name', desc: 'New desc', model_features: [] });
956
+ * const result = await knowledgeModels.updateApplication({
957
+ * kbId: 'kb-id',
958
+ * id: 'app-id',
959
+ * name: 'New name',
960
+ * desc: 'New desc',
961
+ * model_features: []
962
+ * });
672
963
  * ```
673
964
  */
674
- public async updateApplication({ kbId, id, name, desc, model_features }: { kbId: string; id: string; name?: string; desc?: string; model_features?: string[]; }): Promise<Application> {
965
+ public async updateApplication({
966
+ kbId,
967
+ id,
968
+ name,
969
+ desc,
970
+ model_features,
971
+ }: {
972
+ kbId: string;
973
+ id: string;
974
+ name?: string;
975
+ desc?: string;
976
+ model_features?: string[];
977
+ }): Promise<Application> {
675
978
  const data = {
676
979
  kbId,
677
980
  id,
@@ -690,10 +993,37 @@ export class KnowledgeModels extends Base {
690
993
  /**
691
994
  * Update intent
692
995
  * ```typescript
693
- * const result = await knowledgeModels.updateIntent({ name: 'name', type: 'type', id: 'intent-id', appId: 'app-id', kbId: 'kb-id', postprocessFlows: [], customData: {}, features: [] });
996
+ * const result = await knowledgeModels.updateIntent({
997
+ * name: 'name',
998
+ * type: 'type',
999
+ * id: 'intent-id',
1000
+ * appId: 'app-id',
1001
+ * kbId: 'kb-id',
1002
+ * postprocessFlows: [],
1003
+ * customData: {},
1004
+ * features: []
1005
+ * });
694
1006
  * ```
695
1007
  */
696
- public async updateIntent({ name, type, id, appId, kbId, postprocessFlows, customData, features }: { name?: string; type?: string; id: string; appId: string; kbId: string; postprocessFlows?: string[]; customData?: { [key: string]: unknown; }; features?: string[]; }): Promise<Intent> {
1008
+ public async updateIntent({
1009
+ name,
1010
+ type,
1011
+ id,
1012
+ appId,
1013
+ kbId,
1014
+ postprocessFlows,
1015
+ customData,
1016
+ features,
1017
+ }: {
1018
+ name?: string;
1019
+ type?: string;
1020
+ id: string;
1021
+ appId: string;
1022
+ kbId: string;
1023
+ postprocessFlows?: string[];
1024
+ customData?: { [key: string]: unknown; };
1025
+ features?: string[];
1026
+ }): Promise<Intent> {
697
1027
  const data = {
698
1028
  name,
699
1029
  type,
@@ -722,7 +1052,15 @@ export class KnowledgeModels extends Base {
722
1052
  * const result = await knowledgeModels.updateUtterance({ appId: 'app-id', kbId: 'kb-id', utterance });
723
1053
  * ```
724
1054
  */
725
- public async updateUtterance({ appId, kbId, utterance }: { appId: string; kbId: string; utterance: Utterance; }): Promise<Utterance> {
1055
+ public async updateUtterance({
1056
+ appId,
1057
+ kbId,
1058
+ utterance,
1059
+ }: {
1060
+ appId: string;
1061
+ kbId: string;
1062
+ utterance: Utterance;
1063
+ }): Promise<Utterance> {
726
1064
  const params = {
727
1065
  kbId,
728
1066
  appId,
@@ -742,7 +1080,15 @@ export class KnowledgeModels extends Base {
742
1080
  * const result = await knowledgeModels.updatePattern({ appId: 'app-id', kbId: 'kb-id', pattern });
743
1081
  * ```
744
1082
  */
745
- public async updatePattern({ appId, kbId, pattern }: { appId: string; kbId: string; pattern: Pattern; }): Promise<Pattern> {
1083
+ public async updatePattern({
1084
+ appId,
1085
+ kbId,
1086
+ pattern,
1087
+ }: {
1088
+ appId: string;
1089
+ kbId: string;
1090
+ pattern: Pattern;
1091
+ }): Promise<Pattern> {
746
1092
  const params = {
747
1093
  kbId,
748
1094
  appId,
@@ -759,10 +1105,28 @@ export class KnowledgeModels extends Base {
759
1105
  /**
760
1106
  * Update pair
761
1107
  * ```typescript
762
- * const result = await knowledgeModels.updatePair({ kbId: 'kb-id', applicationName: 'appName', intentName: 'intName', intentType: 'type', utterance });
1108
+ * const result = await knowledgeModels.updatePair({
1109
+ * kbId: 'kb-id',
1110
+ * applicationName: 'appName',
1111
+ * intentName: 'intName',
1112
+ * intentType: 'type',
1113
+ * utterance
1114
+ * });
763
1115
  * ```
764
1116
  */
765
- public async updatePair({ kbId, applicationName, intentName, intentType, utterance }: { kbId: string; applicationName: string; intentName: string; intentType: string; utterance: Utterance; }): Promise<void> {
1117
+ public async updatePair({
1118
+ kbId,
1119
+ applicationName,
1120
+ intentName,
1121
+ intentType,
1122
+ utterance,
1123
+ }: {
1124
+ kbId: string;
1125
+ applicationName: string;
1126
+ intentName: string;
1127
+ intentType: string;
1128
+ utterance: Utterance;
1129
+ }): Promise<void> {
766
1130
  const data = {
767
1131
  kbId,
768
1132
  applicationName,
@@ -784,7 +1148,13 @@ export class KnowledgeModels extends Base {
784
1148
  * const result = await knowledgeModels.batchUpdatePairs({ kbId: 'kb-id', utterances: [utterance] });
785
1149
  * ```
786
1150
  */
787
- public async batchUpdatePairs({ kbId, utterances }: { kbId: string; utterances: Utterance[]; }): Promise<UpdatedPairsResponse> {
1151
+ public async batchUpdatePairs({
1152
+ kbId,
1153
+ utterances,
1154
+ }: {
1155
+ kbId: string;
1156
+ utterances: Utterance[];
1157
+ }): Promise<UpdatedPairsResponse> {
788
1158
  const params = {
789
1159
  kbId,
790
1160
  };
@@ -800,10 +1170,30 @@ export class KnowledgeModels extends Base {
800
1170
  /**
801
1171
  * Update entity
802
1172
  * ```typescript
803
- * const result = await knowledgeModels.updateEntity({ type: 'type', id: 'id', kbId: 'kb-id', name: 'Name', roles: [] });
1173
+ * const result = await knowledgeModels.updateEntity({
1174
+ * type: 'type',
1175
+ * id: 'id',
1176
+ * kbId: 'kb-id',
1177
+ * name: 'Name',
1178
+ * roles: []
1179
+ * });
804
1180
  * ```
805
1181
  */
806
- public async updateEntity({ type, id, kbId, name, roles, ...rest }: { type: string; id: string; kbId: string; name?: string; roles?: string[]; rest?: { [key: string]: unknown; }; }): Promise<Entity> {
1182
+ public async updateEntity({
1183
+ type,
1184
+ id,
1185
+ kbId,
1186
+ name,
1187
+ roles,
1188
+ ...rest
1189
+ }: {
1190
+ type: string;
1191
+ id: string;
1192
+ kbId: string;
1193
+ name?: string;
1194
+ roles?: string[];
1195
+ rest?: { [key: string]: unknown; };
1196
+ }): Promise<Entity> {
807
1197
  const data = getEntityBody(type, {
808
1198
  name,
809
1199
  roles,
@@ -826,10 +1216,34 @@ export class KnowledgeModels extends Base {
826
1216
  /**
827
1217
  * Update feature
828
1218
  * ```typescript
829
- * const result = await knowledgeModels.updateFeature({ kbId: 'kb-id', id: 'id', name: 'Name', mode: false, words: [], enabledForAllModels: true, activated: true });
1219
+ * const result = await knowledgeModels.updateFeature({
1220
+ * kbId: 'kb-id',
1221
+ * id: 'id',
1222
+ * name: 'Name',
1223
+ * mode: false,
1224
+ * words: [],
1225
+ * enabledForAllModels: true,
1226
+ * activated: true
1227
+ * });
830
1228
  * ```
831
1229
  */
832
- public async updateFeature({ kbId, id, name, mode, words, enabledForAllModels, activated = true }: { kbId: string; id: string; name: string; mode: boolean; words: string[]; enabledForAllModels: boolean; activated: boolean; }): Promise<Feature> {
1230
+ public async updateFeature({
1231
+ kbId,
1232
+ id,
1233
+ name,
1234
+ mode,
1235
+ words,
1236
+ enabledForAllModels,
1237
+ activated = true,
1238
+ }: {
1239
+ kbId: string;
1240
+ id: string;
1241
+ name: string;
1242
+ mode: boolean;
1243
+ words: string[];
1244
+ enabledForAllModels: boolean;
1245
+ activated: boolean;
1246
+ }): Promise<Feature> {
833
1247
  const data = {
834
1248
  name,
835
1249
  mode,
@@ -857,7 +1271,18 @@ export class KnowledgeModels extends Base {
857
1271
  * const result = await knowledgeModels.updatePrebuiltEntities({ kbId: 'kb-id', entity: { name: '', roles: [] } });
858
1272
  * ```
859
1273
  */
860
- public async updatePrebuiltEntities({ kbId, id, entity }: { kbId: string; id: string; entity: { name: string; roles: string[]; }; }): Promise<Entity> {
1274
+ public async updatePrebuiltEntities({
1275
+ kbId,
1276
+ id,
1277
+ entity,
1278
+ }: {
1279
+ kbId: string;
1280
+ id: string;
1281
+ entity: {
1282
+ name: string;
1283
+ roles: string[];
1284
+ };
1285
+ }): Promise<Entity> {
861
1286
  const params = {
862
1287
  kbId,
863
1288
  id,
@@ -1030,7 +1455,13 @@ export class KnowledgeModels extends Base {
1030
1455
  * const result = await knowledgeModels.getTrainStatus({ kbId: 'kb-id' });
1031
1456
  * ```
1032
1457
  */
1033
- public async getTrainStatus({ kbId, versionId = null }: { kbId: string; versionId: string | null; }): Promise<TrainStatusResponse> {
1458
+ public async getTrainStatus({
1459
+ kbId,
1460
+ versionId = null,
1461
+ }: {
1462
+ kbId: string;
1463
+ versionId: string | null;
1464
+ }): Promise<TrainStatusResponse> {
1034
1465
  const params = {
1035
1466
  kbId,
1036
1467
  versionId,
@@ -1046,10 +1477,28 @@ export class KnowledgeModels extends Base {
1046
1477
  /**
1047
1478
  * Start training
1048
1479
  * ```typescript
1049
- * const result = await knowledgeModels.train({ kbId: 'kb-id', flowId: 'flow-id', phraseId: 'phrase-id', sessionId: 'session-id', autoPublish: true });
1480
+ * const result = await knowledgeModels.train({
1481
+ * kbId: 'kb-id',
1482
+ * flowId: 'flow-id',
1483
+ * phraseId: 'phrase-id',
1484
+ * sessionId: 'session-id',
1485
+ * autoPublish: true
1486
+ * });
1050
1487
  * ```
1051
1488
  */
1052
- public async train({ kbId, flowId, phraseId, sessionId, autoPublish }: { kbId: string; flowId?: string; phraseId?: string; sessionId?: string; autoPublish: boolean; }): Promise<TrainResponse> {
1489
+ public async train({
1490
+ kbId,
1491
+ flowId,
1492
+ phraseId,
1493
+ sessionId,
1494
+ autoPublish,
1495
+ }: {
1496
+ kbId: string;
1497
+ flowId?: string;
1498
+ phraseId?: string;
1499
+ sessionId?: string;
1500
+ autoPublish: boolean;
1501
+ }): Promise<TrainResponse> {
1053
1502
  const params = {
1054
1503
  kbId,
1055
1504
  flowId,
@@ -1069,10 +1518,25 @@ export class KnowledgeModels extends Base {
1069
1518
  /**
1070
1519
  * Start training for test
1071
1520
  * ```typescript
1072
- * const result = await knowledgeModels.trainForTest({ kbId: 'kb-id', flowId: 'flow-id', phraseId: 'phrase-id', sessionId: 'session-id' });
1521
+ * const result = await knowledgeModels.trainForTest({
1522
+ * kbId: 'kb-id',
1523
+ * flowId: 'flow-id',
1524
+ * phraseId: 'phrase-id',
1525
+ * sessionId: 'session-id'
1526
+ * });
1073
1527
  * ```
1074
1528
  */
1075
- public async trainForTest({ kbId, flowId, phraseId, sessionId }: { kbId: string; flowId?: string; phraseId?: string; sessionId?: string; }): Promise<TrainResponse> {
1529
+ public async trainForTest({
1530
+ kbId,
1531
+ flowId,
1532
+ phraseId,
1533
+ sessionId,
1534
+ }: {
1535
+ kbId: string;
1536
+ flowId?: string;
1537
+ phraseId?: string;
1538
+ sessionId?: string;
1539
+ }): Promise<TrainResponse> {
1076
1540
  const params = {
1077
1541
  kbId,
1078
1542
  flowId,
@@ -1094,7 +1558,13 @@ export class KnowledgeModels extends Base {
1094
1558
  * const result = await knowledgeModels.publish({ kbId: 'kb-id' });
1095
1559
  * ```
1096
1560
  */
1097
- public async publish({ kbId, versionId = null }: { kbId: string; versionId?: string | null; }): Promise<PublishResponse> {
1561
+ public async publish({
1562
+ kbId,
1563
+ versionId = null,
1564
+ }: {
1565
+ kbId: string;
1566
+ versionId?: string | null;
1567
+ }): Promise<PublishResponse> {
1098
1568
  const params = {
1099
1569
  kbId,
1100
1570
  versionId,
@@ -1195,7 +1665,13 @@ export class KnowledgeModels extends Base {
1195
1665
  * const result = await knowledgeModels.import({ fileUrl: 'http://file.url', knowledgeBase: {} });
1196
1666
  * ```
1197
1667
  */
1198
- public async import({ fileUrl, knowledgeBase }: { fileUrl: string; knowledgeBase: KnowledgeModelCreateParams; }): Promise<ImportResponse> {
1668
+ public async import({
1669
+ fileUrl,
1670
+ knowledgeBase,
1671
+ }: {
1672
+ fileUrl: string;
1673
+ knowledgeBase: KnowledgeModelCreateParams;
1674
+ }): Promise<ImportResponse> {
1199
1675
  const data = {
1200
1676
  fileUrl,
1201
1677
  knowledgeBase,
@@ -1224,11 +1700,29 @@ export class KnowledgeModels extends Base {
1224
1700
 
1225
1701
  /**
1226
1702
  * Import knowledge model from csv
1703
+ *
1704
+ * @example
1227
1705
  * ```typescript
1228
- * const result = await knowledgeModels.importCsv({ fileUrl: 'http://file.url', knowledgeBase: {}, applicationName: 'appName', delimiter: 'delimiter' });
1706
+ * const result = await knowledgeModels.importCsv({
1707
+ * fileUrl: 'http://file.url',
1708
+ * knowledgeBase: {},
1709
+ * applicationName: 'appName',
1710
+ * delimiter: 'delimiter'
1711
+ * });
1229
1712
  * ```
1230
1713
  */
1231
- public async importCsv({ fileUrl, knowledgeBase, applicationName, delimiter }: { fileUrl: string; knowledgeBase: KnowledgeModelCreateParams; applicationName?: string; delimiter?: string; }): Promise<ImportResponse> {
1714
+ public async importCsv({
1715
+ fileUrl,
1716
+ knowledgeBase,
1717
+ applicationName,
1718
+ delimiter,
1719
+ }: {
1720
+ fileUrl: string;
1721
+ knowledgeBase:
1722
+ KnowledgeModelCreateParams;
1723
+ applicationName?: string;
1724
+ delimiter?: string;
1725
+ }): Promise<ImportResponse> {
1232
1726
  const data = {
1233
1727
  fileUrl,
1234
1728
  knowledgeBase,