@memori.ai/memori-api-client 0.2.1 → 0.3.1

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.
Files changed (37) hide show
  1. package/README.md +1 -1
  2. package/dist/apiFetcher.d.ts +1 -0
  3. package/dist/backend/consumptionLogs.d.ts +40 -0
  4. package/dist/backend/memori.d.ts +11 -0
  5. package/dist/backend/notifications.d.ts +20 -0
  6. package/dist/backend.d.ts +42 -0
  7. package/dist/engine/chatLogs.d.ts +31 -0
  8. package/dist/engine/customDictionary.d.ts +47 -0
  9. package/dist/engine/dialog.d.ts +3 -9
  10. package/dist/engine/importExport.d.ts +39 -14
  11. package/dist/engine/intents.d.ts +36 -11
  12. package/dist/engine/nlp.d.ts +42 -1
  13. package/dist/engine/stats.d.ts +68 -1
  14. package/dist/engine.d.ts +174 -38
  15. package/dist/index.d.ts +216 -38
  16. package/dist/memori-api-client.cjs.development.js +702 -67
  17. package/dist/memori-api-client.cjs.development.js.map +1 -1
  18. package/dist/memori-api-client.cjs.production.min.js +1 -1
  19. package/dist/memori-api-client.cjs.production.min.js.map +1 -1
  20. package/dist/memori-api-client.esm.js +702 -67
  21. package/dist/memori-api-client.esm.js.map +1 -1
  22. package/dist/types.d.ts +318 -1
  23. package/package.json +1 -1
  24. package/src/apiFetcher.ts +2 -1
  25. package/src/backend/consumptionLogs.ts +79 -0
  26. package/src/backend/memori.ts +20 -0
  27. package/src/backend/notifications.ts +24 -0
  28. package/src/backend.ts +6 -0
  29. package/src/engine/chatLogs.ts +63 -0
  30. package/src/engine/customDictionary.ts +85 -0
  31. package/src/engine/dialog.ts +3 -3
  32. package/src/engine/importExport.ts +56 -16
  33. package/src/engine/intents.ts +58 -21
  34. package/src/engine/nlp.ts +78 -1
  35. package/src/engine/stats.ts +117 -1
  36. package/src/engine.ts +6 -0
  37. package/src/types.ts +327 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # memori-api-client
2
2
 
3
- [![npm version](https://img.shields.io/github/package-json/v/memori-ai/memori-api-client)](https://www.npmjs.com/package/@memoriai/memori-api-client)
3
+ [![npm version](https://img.shields.io/github/package-json/v/memori-ai/memori-api-client)](https://www.npmjs.com/package/@memori.ai/memori-api-client)
4
4
  ![Tests](https://github.com/memori-ai/memori-api-client/workflows/CI/badge.svg?branch=main)
5
5
  ![TypeScript Support](https://img.shields.io/badge/TypeScript-Support-blue)
6
6
 
@@ -3,4 +3,5 @@ export declare const apiFetcher: (path: string, opts: {
3
3
  method?: string;
4
4
  body?: object;
5
5
  headers?: object;
6
+ text?: boolean;
6
7
  }) => Promise<any>;
@@ -0,0 +1,40 @@
1
+ import { ResponseSpec, ConsumptionLog } from '../types';
2
+ declare const _default: (apiUrl: string) => {
3
+ /**
4
+ * Gets the Consumption Log objects for a specific Tenant in a specific date interval.
5
+ * @param {string} authToken - The login token
6
+ * @param {string} tenantID - The name of the tenant
7
+ * @param {string} type - Type of consumption (i.e. granularity), it may either be Daily or Monthly
8
+ * @param {string=} dateFrom - The optional begin of the date interval, in UTC time, in the format yyyyMMdd
9
+ * @param {string=} dateTo - The optional end of the date interval, in UTC time, in the format yyyyMMdd
10
+ * @returns The list of Consumption Logs objects.
11
+ */
12
+ getTenantConsumptionLogs: (authToken: string, tenantID: string, type: 'Daily' | 'Monthly', dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<ResponseSpec & {
13
+ consumptionLogs: ConsumptionLog[];
14
+ }>;
15
+ /**
16
+ * Gets the Consumption Log objects for a specific User in a specific date interval.
17
+ * @param {string} authToken - The login token
18
+ * @param {string} userID - The ID of the User object
19
+ * @param {string} type - Type of consumption (i.e. granularity), it may either be Daily or Monthly
20
+ * @param {string=} dateFrom - The optional begin of the date interval, in UTC time, in the format yyyyMMdd
21
+ * @param {string=} dateTo - The optional end of the date interval, in UTC time, in the format yyyyMMdd
22
+ * @returns The list of Consumption Logs objects.
23
+ */
24
+ getUserConsumptionLogs: (authToken: string, userID: string, type: 'Daily' | 'Monthly', dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<ResponseSpec & {
25
+ consumptionLogs: ConsumptionLog[];
26
+ }>;
27
+ /**
28
+ * Gets the Consumption Log objects for a specific Memori in a specific date interval.
29
+ * @param {string} authToken - The login token
30
+ * @param {string} memoriID - The ID of the Memori object
31
+ * @param {string} type - Type of consumption (i.e. granularity), it may either be Daily or Monthly
32
+ * @param {string=} dateFrom - The optional begin of the date interval, in UTC time, in the format yyyyMMdd
33
+ * @param {string=} dateTo - The optional end of the date interval, in UTC time, in the format yyyyMMdd
34
+ * @returns The list of Consumption Logs objects.
35
+ */
36
+ getMemoriConsumptionLogs: (authToken: string, memoriID: string, type: 'Daily' | 'Monthly', dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<ResponseSpec & {
37
+ consumptionLogs: ConsumptionLog[];
38
+ }>;
39
+ };
40
+ export default _default;
@@ -123,5 +123,16 @@ declare const _default: (apiUrl: string) => {
123
123
  totalSessions: number;
124
124
  validSessions: number;
125
125
  }>;
126
+ /**
127
+ * Transfers an existing Memori object to another User.
128
+ * The new owner must be specified by either a OwnerUserID or a OwnerUserName-OwnerTenantName pair.
129
+ * The OwnerUserName may also specify a user e-mail.
130
+ * @param {string} authToken - The login token
131
+ * @param {Memori} memori - The Memori object
132
+ */
133
+ transferMemori: (authToken: string, memori: Memori & {
134
+ ownerTenantName: string;
135
+ ownerUserName: string;
136
+ }) => Promise<ResponseSpec>;
126
137
  };
127
138
  export default _default;
@@ -0,0 +1,20 @@
1
+ import { ResponseSpec, Notification } from '../types';
2
+ declare const _default: (apiUrl: string) => {
3
+ /**
4
+ * Gets the Notification objects available for a specific Tenant.
5
+ * @param {string} tenantID - The name of the tenant
6
+ * @returns The list of Notification objects.
7
+ */
8
+ getTenantNotifications: (tenantID: string) => Promise<ResponseSpec & {
9
+ notifications: Notification[];
10
+ }>;
11
+ /**
12
+ * Gets the Notification objects available for a specific User.
13
+ * @param {string} authToken - The login token
14
+ * @returns The list of Notification objects.
15
+ */
16
+ getUserNotifications: (authToken: string) => Promise<ResponseSpec & {
17
+ notifications: Notification[];
18
+ }>;
19
+ };
20
+ export default _default;
package/dist/backend.d.ts CHANGED
@@ -1,4 +1,19 @@
1
1
  declare const backendAPI: (apiUrl: string) => {
2
+ getTenantNotifications: (tenantID: string) => Promise<import("./types").ResponseSpec & {
3
+ notifications: import("./types").Notification[];
4
+ }>;
5
+ getUserNotifications: (authToken: string) => Promise<import("./types").ResponseSpec & {
6
+ notifications: import("./types").Notification[];
7
+ }>;
8
+ getTenantConsumptionLogs: (authToken: string, tenantID: string, type: "Daily" | "Monthly", dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<import("./types").ResponseSpec & {
9
+ consumptionLogs: import("./types").ConsumptionLog[];
10
+ }>;
11
+ getUserConsumptionLogs: (authToken: string, userID: string, type: "Daily" | "Monthly", dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<import("./types").ResponseSpec & {
12
+ consumptionLogs: import("./types").ConsumptionLog[];
13
+ }>;
14
+ getMemoriConsumptionLogs: (authToken: string, memoriID: string, type: "Daily" | "Monthly", dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<import("./types").ResponseSpec & {
15
+ consumptionLogs: import("./types").ConsumptionLog[];
16
+ }>;
2
17
  getSentInvitations: (authToken: string) => Promise<import("./types").ResponseSpec & {
3
18
  invitations: import("./types").Invitation[];
4
19
  }>;
@@ -122,6 +137,10 @@ declare const backendAPI: (apiUrl: string) => {
122
137
  totalSessions: number;
123
138
  validSessions: number;
124
139
  }>;
140
+ transferMemori: (authToken: string, memori: import("./types").Memori & {
141
+ ownerTenantName: string;
142
+ ownerUserName: string;
143
+ }) => Promise<import("./types").ResponseSpec>;
125
144
  getUploadAssetURL: (authToken: string, memoriID: string, memoryID?: string | undefined) => string;
126
145
  uploadAsset: (fileName: string, fileUrl: string, authToken: string, memoriID: string, memoryID?: string | undefined) => Promise<import("./types").ResponseSpec & {
127
146
  asset: import("./types").Asset;
@@ -186,6 +205,10 @@ declare const backendAPI: (apiUrl: string) => {
186
205
  totalSessions: number;
187
206
  validSessions: number;
188
207
  }>;
208
+ transferMemori: (authToken: string, memori: import("./types").Memori & {
209
+ ownerTenantName: string;
210
+ ownerUserName: string;
211
+ }) => Promise<import("./types").ResponseSpec>;
189
212
  };
190
213
  user: {
191
214
  userSignIn: (user: import("./types").User) => Promise<import("./types").ResponseSpec & {
@@ -273,5 +296,24 @@ declare const backendAPI: (apiUrl: string) => {
273
296
  invitation: import("./types").Invitation;
274
297
  }>;
275
298
  };
299
+ consumptionLogs: {
300
+ getTenantConsumptionLogs: (authToken: string, tenantID: string, type: "Daily" | "Monthly", dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<import("./types").ResponseSpec & {
301
+ consumptionLogs: import("./types").ConsumptionLog[];
302
+ }>;
303
+ getUserConsumptionLogs: (authToken: string, userID: string, type: "Daily" | "Monthly", dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<import("./types").ResponseSpec & {
304
+ consumptionLogs: import("./types").ConsumptionLog[];
305
+ }>;
306
+ getMemoriConsumptionLogs: (authToken: string, memoriID: string, type: "Daily" | "Monthly", dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<import("./types").ResponseSpec & {
307
+ consumptionLogs: import("./types").ConsumptionLog[];
308
+ }>;
309
+ };
310
+ notifications: {
311
+ getTenantNotifications: (tenantID: string) => Promise<import("./types").ResponseSpec & {
312
+ notifications: import("./types").Notification[];
313
+ }>;
314
+ getUserNotifications: (authToken: string) => Promise<import("./types").ResponseSpec & {
315
+ notifications: import("./types").Notification[];
316
+ }>;
317
+ };
276
318
  };
277
319
  export default backendAPI;
@@ -0,0 +1,31 @@
1
+ import { ChatLog, ResponseSpec } from '../types';
2
+ declare const _default: (apiUrl: string) => {
3
+ /**
4
+ * Gets the Chat Log objects for the Memori of the current session in a specific date interval.
5
+ * @param {string} sessionId The session ID
6
+ * @param {?string} dateFrom The optional begin of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
7
+ * @param {?string} dateTo The optional end of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
8
+ */
9
+ getChatLogs: (sessionId: string, dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<ResponseSpec & {
10
+ chatLogs: ChatLog[];
11
+ }>;
12
+ /**
13
+ * Removes all Chat Log objects in a specific date internval.
14
+ * @param {string} sessionId The session ID
15
+ * @param {?string} dateFrom The optional begin of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
16
+ * @param {?string} dateTo The optional end of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
17
+ */
18
+ deleteChatLogs: (sessionId: string, dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<ResponseSpec>;
19
+ /**
20
+ * Removes an existing Chat Log object.
21
+ * @param {string} sessionId The session ID
22
+ * @param {string} chatLogId The Chat Log object ID
23
+ */
24
+ deleteChatLog: (sessionId: string, chatLogId: string) => Promise<ResponseSpec>;
25
+ };
26
+ /*************************
27
+ * *
28
+ * ChatLogs *
29
+ * *
30
+ *************************/
31
+ export default _default;
@@ -0,0 +1,47 @@
1
+ import { ResponseSpec, CustomWord } from '../types';
2
+ declare const _default: (apiUrl: string) => {
3
+ /**
4
+ * Lists all Custom Words.
5
+ * @param {string} sessionId The session ID
6
+ */
7
+ getCustomWords: (sessionId: string) => Promise<ResponseSpec & {
8
+ customWords: CustomWord[];
9
+ }>;
10
+ /**
11
+ * Gets the details of a Custom Word object.
12
+ * @param {string} sessionId The session ID
13
+ * @param {string} customWordID The Custom Word object ID
14
+ */
15
+ getCustomWord: (sessionId: string, customWordID: string) => Promise<ResponseSpec & {
16
+ customWord: CustomWord;
17
+ }>;
18
+ /**
19
+ * Removes an existing Custom Word object.
20
+ * @param {string} sessionId The session ID
21
+ * @param {string} key The key of the Custom Word
22
+ */
23
+ deleteCustomWord: (sessionId: string, key: string) => Promise<ResponseSpec>;
24
+ /**
25
+ * Adds a new Custom Word object.
26
+ * @param {string} sessionId The session ID
27
+ * @param {CustomWord} customWord Custom Word
28
+ */
29
+ postCustomWord: (sessionId: string, customWord: Pick<CustomWord, 'word'> & Pick<CustomWord, 'definition'>) => Promise<ResponseSpec & {
30
+ customWord: CustomWord;
31
+ }>;
32
+ /**
33
+ * Updates an existing Custom Word object.
34
+ * Only the Definition field is considered for update. To change the Word field a new Custom Word must be added and the existing must be removed.
35
+ * @param {string} sessionId The session ID
36
+ * @param {CustomWord} customWord Custom Word
37
+ */
38
+ patchCustomWord: (sessionId: string, customWord: Partial<CustomWord> & {
39
+ customWordID: string;
40
+ }) => Promise<ResponseSpec>;
41
+ };
42
+ /****************************
43
+ * *
44
+ * CustomDictionary *
45
+ * *
46
+ ****************************/
47
+ export default _default;
@@ -62,23 +62,17 @@ declare const _default: (apiUrl: string) => {
62
62
  * Submits a Date Selected event to the session's Dialog State Machine.
63
63
  * @param {string} sessionId The session ID
64
64
  */
65
- postDateSelectedEvent: ({ sessionId }: {
66
- sessionId: string;
67
- }) => Promise<ResponseSpec>;
65
+ postDateSelectedEvent: (sessionId: string) => Promise<ResponseSpec>;
68
66
  /**
69
67
  * Submits a Place Selected event to the session's Dialog State Machine.
70
68
  * @param {string} sessionId The session ID
71
69
  */
72
- postPlaceSelectedEvent: ({ sessionId }: {
73
- sessionId: string;
74
- }) => Promise<ResponseSpec>;
70
+ postPlaceSelectedEvent: (sessionId: string) => Promise<ResponseSpec>;
75
71
  /**
76
72
  * Submits a Tag Selected event to the session's Dialog State Machine.
77
73
  * @param {string} sessionId The session ID
78
74
  */
79
- postTagSelectedEvent: ({ sessionId }: {
80
- sessionId: string;
81
- }) => Promise<ResponseSpec>;
75
+ postTagSelectedEvent: (sessionId: string) => Promise<ResponseSpec>;
82
76
  };
83
77
  /******************
84
78
  * *
@@ -1,30 +1,55 @@
1
1
  import { ResponseSpec } from '../types';
2
- export interface ImportExportBody {
3
- csvRows: string[];
2
+ export interface ImportCSVParams {
3
+ includedRows?: number[];
4
+ hasHeaders?: boolean;
5
+ headerNames?: string[];
6
+ forceImport?: boolean;
4
7
  questionColumnName: string;
5
8
  answerColumnName: string;
6
- propertyColumnNames: string[];
7
- includedRows: number[];
8
- csvSeparator: string;
9
- questionTitleVariantsSeparator: string;
10
- hasHeaders: boolean;
11
- forceImport: boolean;
12
- headerNames: string[];
9
+ contextVarsToMatchColumnName?: string;
10
+ contextVarsToSetColumnName?: string;
11
+ csvSeparator?: string;
12
+ questionTitleVariantsSeparator?: string;
13
13
  }
14
- export interface ImportExportReponse {
14
+ export interface ExportCSVParams {
15
+ newLine: '\n' | '\r\n';
16
+ hasHeaders?: boolean;
17
+ questionColumnName: string;
18
+ answerColumnName: string;
19
+ contextVarsToMatchColumnName?: string;
20
+ contextVarsToSetColumnName?: string;
21
+ csvSeparator?: string;
22
+ questionTitleVariantsSeparator?: string;
23
+ }
24
+ export interface ImportReponse {
15
25
  importID: string;
16
- importedMemories: number;
26
+ importedMemories?: number;
17
27
  importWarnings?: {
18
- warningType: string;
28
+ warningType: 'Existing Similar Memory' | 'Internal Error';
29
+ rowNumber?: number;
30
+ csvRow: string;
31
+ text?: string;
32
+ similarTexts?: {
33
+ text: string;
34
+ similarityLevel: 'HIGH' | 'MEDIUM' | 'LOW';
35
+ }[];
19
36
  }[];
20
37
  }
21
38
  declare const _default: (apiUrl: string) => {
22
39
  /**
23
40
  * Imports memories from a CSV file.
24
41
  * @param {string} sessionId The session ID
25
- * @param {ImportExportBody} csvData The CSV content info to import
42
+ * @param {string[]} csvRows Rows of the CSV file.
43
+ * @param {ImportCSVParams} params The specifications and content of the CSV file
44
+ */
45
+ importCSV: (sessionId: string, csvRows: string[], params: ImportCSVParams) => Promise<ResponseSpec & ImportReponse>;
46
+ /**
47
+ * Exports memories to a CSV file.
48
+ * @param {string} sessionID The session ID
49
+ * @param {ExportCSVParams} params - The specifications of the CSV file
50
+ * @returns The CSV file content
26
51
  */
27
- postImportExport: (sessionId: string, csvData: ImportExportBody) => Promise<ResponseSpec & ImportExportReponse>;
52
+ exportCSV: (sessionID: string, params: ExportCSVParams) => Promise<string>;
28
53
  };
29
54
  /************************
30
55
  * *
@@ -1,22 +1,32 @@
1
- import { ResponseSpec } from '../types';
1
+ import { ResponseSpec, Intent, IntentSlot } from '../types';
2
2
  declare const _default: (apiUrl: string) => {
3
3
  /**
4
4
  * Lists all Intent objects.
5
5
  * @param {string} sessionId The session ID
6
6
  */
7
- getIntents: (sessionId: string) => Promise<ResponseSpec>;
7
+ getIntents: (sessionId: string) => Promise<ResponseSpec & {
8
+ intents: (Intent & {
9
+ intentID: string;
10
+ })[];
11
+ }>;
8
12
  /**
9
13
  * Gets the details of an Intent object.
10
14
  * @param {string} sessionId The session ID
11
15
  * @param {string} intentId The Intent object ID
12
16
  */
13
- getIntent: (sessionId: string, intentId: string) => Promise<ResponseSpec>;
17
+ getIntent: (sessionId: string, intentId: string) => Promise<ResponseSpec & {
18
+ intent: Intent & {
19
+ intentID: string;
20
+ };
21
+ }>;
14
22
  /**
15
23
  * Updates an existing Intent object.
16
24
  * @param {string} sessionId The session ID
17
- * @param {string} intentId The Intent object ID
25
+ * @param {Intent} intent The Intent object
18
26
  */
19
- patchIntent: (sessionId: string, intentId: string) => Promise<ResponseSpec>;
27
+ patchIntent: (sessionId: string, intent: Partial<Intent> & {
28
+ intentID: string;
29
+ }) => Promise<ResponseSpec>;
20
30
  /**
21
31
  * Removes an existing Intent object.
22
32
  * @param {string} sessionId The session ID
@@ -26,25 +36,38 @@ declare const _default: (apiUrl: string) => {
26
36
  /**
27
37
  * Adds a new Intent object.
28
38
  * @param {string} sessionId The session ID
39
+ * @param {Intent} intent The Intent object
29
40
  */
30
- postIntent: (sessionId: string) => Promise<ResponseSpec>;
41
+ createIntent: (sessionId: string, intent: Intent) => Promise<ResponseSpec & {
42
+ intentID: string;
43
+ }>;
31
44
  /**
32
45
  * Lists all Intent Slot objects.
33
46
  * @param {string} sessionId The session ID
34
47
  */
35
- getIntentSlots: (sessionId: string) => Promise<ResponseSpec>;
48
+ getIntentSlots: (sessionId: string) => Promise<ResponseSpec & {
49
+ intentSlots: (IntentSlot & {
50
+ intentSlotID: string;
51
+ })[];
52
+ }>;
36
53
  /**
37
54
  * Gets the details of an Intent Slot object.
38
55
  * @param {string} sessionId The session ID
39
56
  * @param {string} slotId The Intent Slot object ID
40
57
  */
41
- getIntentSlot: (sessionId: string, slotId: string) => Promise<ResponseSpec>;
58
+ getIntentSlot: (sessionId: string, slotId: string) => Promise<ResponseSpec & {
59
+ intentSlot: IntentSlot & {
60
+ intentSlotID: string;
61
+ };
62
+ }>;
42
63
  /**
43
64
  * Updates an existing Intent Slot object.
44
65
  * @param {string} sessionId The session ID
45
- * @param {string} slotId The Intent Slot object ID
66
+ * @param {IntentSlot} intentSlot The Intent Slot object
46
67
  */
47
- patchIntentSlot: (sessionId: string, slotId: string) => Promise<ResponseSpec>;
68
+ patchIntentSlot: (sessionId: string, intentSlot: Partial<IntentSlot> & {
69
+ intentSlotID: string;
70
+ }) => Promise<ResponseSpec>;
48
71
  /**
49
72
  * Removes an existing Intent Slot object.
50
73
  * @param {string} sessionId The session ID
@@ -55,7 +78,9 @@ declare const _default: (apiUrl: string) => {
55
78
  * Adds a new Intent Slot object.
56
79
  * @param {string} sessionId The session ID
57
80
  */
58
- postIntentSlot: (sessionId: string) => Promise<ResponseSpec>;
81
+ createIntentSlot: (sessionId: string, intentSlot: IntentSlot) => Promise<ResponseSpec & {
82
+ intentSlotID: string;
83
+ }>;
59
84
  };
60
85
  /*******************
61
86
  * *
@@ -5,7 +5,17 @@ declare const _default: (apiUrl: string) => {
5
5
  * @param {string} sessionId The session ID
6
6
  * @param {string} word Word to be looked up
7
7
  */
8
- getWordVector: (sessionId: string, word: string) => Promise<ResponseSpec>;
8
+ getWordVector: (sessionId: string, word: string) => Promise<ResponseSpec & {
9
+ vector: number[];
10
+ }>;
11
+ /**
12
+ * Searches for the 10 words most semantically similar words to the specified word.
13
+ * @param {string} sessionId The session ID
14
+ * @param {string} word Word to be looked up
15
+ */
16
+ getSimilarWords: (sessionId: string, word: string) => Promise<ResponseSpec & {
17
+ similarWords: string[];
18
+ }>;
9
19
  /**
10
20
  * Tries to guess the language of a sentence by analyzing key word occurrences.
11
21
  * @param {string} sessionId The session ID
@@ -16,6 +26,37 @@ declare const _default: (apiUrl: string) => {
16
26
  [lang: string]: number;
17
27
  };
18
28
  }>;
29
+ /**
30
+ * Computes the similarity between a reference and a comparison sentences.
31
+ * @param {string} sessionId The session ID
32
+ * @param {string} referenceText Text of the reference sentence.
33
+ * @param {'QUESTION' | 'ANSWER'} referenceTextType Type of reference text, i.e. question or answer. Only types supported are: 'QUESTION' and 'ANSWER'.
34
+ * @param {string} comparisonText Text of the comparison sentence.
35
+ * @param {'QUESTION' | 'ANSWER'} comparisonTextType Type of comparison text, i.e. question or answer. Only types supported are: 'QUESTION' and 'ANSWER'.
36
+ */
37
+ computeSimilarity: (sessionId: string, referenceText: string, referenceTextType: 'QUESTION' | 'ANSWER', comparisonText: string, comparisonTextType: 'QUESTION' | 'ANSWER') => Promise<ResponseSpec & {
38
+ /**
39
+ * Similarity index, between 0.0 (totally different) and 1.0 (identical).
40
+ */
41
+ similarity: number;
42
+ /**
43
+ * Similarity level, i.e. none, low, medium or high.
44
+ * Currently supported similarity levels are:
45
+ * NONE, LOW, MEDIUM, HIGH
46
+ */
47
+ similarityLevel: 'NONE' | 'LOW' | 'MEDIUM' | 'HIGH';
48
+ }>;
49
+ /**
50
+ * Checks the words of a sentence for their definition in the word vector dictionary.
51
+ * @param {string} sessionId The session ID
52
+ * @param {string} text Text of the sentence.
53
+ */
54
+ checkWords: (sessionId: string, text: string) => Promise<ResponseSpec & {
55
+ /**
56
+ * List of words missing from the word vector dictionary.
57
+ */
58
+ undefinedWords: string[];
59
+ }>;
19
60
  };
20
61
  /***************
21
62
  * *
@@ -1,4 +1,4 @@
1
- import { ResponseSpec, Stats, EventLog } from '../types';
1
+ import { ResponseSpec, Stats, Memory, EventLog } from '../types';
2
2
  declare const _default: (apiUrl: string) => {
3
3
  /**
4
4
  * Computes usage statistics for the Memori of the current session.
@@ -7,6 +7,53 @@ declare const _default: (apiUrl: string) => {
7
7
  getStatistics: (sessionId: string) => Promise<ResponseSpec & {
8
8
  statistics: Stats;
9
9
  }>;
10
+ /**
11
+ * Computes content quality indexes for a Memori.
12
+ * @param {string} memoriID - The Memori object ID
13
+ */
14
+ getContentQualityIndexes: (memoriID: string) => Promise<ResponseSpec & {
15
+ /**
16
+ * @type {number}
17
+ * An index of content quality of this Memori. The more content is added (and especially content with media, or stories with dates and places) the more the index grows.
18
+ */
19
+ contentQualityIndex: number;
20
+ /**
21
+ * @type {number}
22
+ * An index of answer quality of this Memori. It is the ratio of the number of successful answer vs. the total of answers (successful, wrongful or missing).
23
+ */
24
+ answerQualityIndex: number;
25
+ /**
26
+ * @type {number}
27
+ * The current number of unanswered questions.
28
+ */
29
+ unansweredQuestions: number;
30
+ }>;
31
+ /**
32
+ * Computes text quality indexes for a Memori.
33
+ * @param {string} sessionId - The session ID
34
+ */
35
+ getTextQualityIndexes: (sessionId: string) => Promise<ResponseSpec & {
36
+ /**
37
+ * @type {number}
38
+ * An index of text quality of this Memori. It is the ratio of the defined words vs. the total of unique words used in question texts and story titles. A value of 1.0 means that no words are undefined, a value of 0.0 means that all words are undefined. Undefined words in a question text or story title have a profound negative impact on the ability to match them with user input.
39
+ */
40
+ textQualityIndex: number;
41
+ /**
42
+ * @type {string[]}
43
+ * List of undefined words found in question texts and story titles.
44
+ */
45
+ undefinedWords: string[];
46
+ /**
47
+ * @type {number}
48
+ * An index of text quality of the content of this Memori. It is the ratio of correct question texts and stories titles vs. the total number of question texts and story titles. A value of 1.0 means that all question texts and story titles are correct, a value of 0.0 means that no question text or story title is correct. A question text or story title is defined incorrect (or "faulty") if it contains 25% or more of undefined words. Undefined words in a question text or story title have a profound negative impact on the ability to match them with user input.
49
+ */
50
+ contentTextQualityIndex: number;
51
+ /**
52
+ * @type {Memory[]}
53
+ * List of faulty Memory objects (questions and stories). A question or story is defined as "faulty" if it contains at least one undefined word.
54
+ */
55
+ faultyMemories?: Memory[] | undefined;
56
+ }>;
10
57
  /**
11
58
  * Get the Event Log objects for the Memori of the current session in a specific date interval
12
59
  * @param {string} sessionId The session ID
@@ -16,6 +63,26 @@ declare const _default: (apiUrl: string) => {
16
63
  getEventLogs: (sessionId: string, strDateFrom: string, strDateTo: string) => Promise<ResponseSpec & {
17
64
  eventLogs: EventLog[];
18
65
  }>;
66
+ /**
67
+ * Gets the Event Log objects for a specific Memory object in a specific date interval.
68
+ * @param {string} sessionId - The session ID
69
+ * @param {string} memoryId - The Memory object ID
70
+ * @param {string} strDateFrom - The optional begin of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
71
+ * @param {string} strDateTo - The optional end of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
72
+ */
73
+ getMemoryEventLogs: (sessionId: string, memoryId: string, strDateFrom: string, strDateTo: string) => Promise<ResponseSpec & {
74
+ eventLogs: EventLog[];
75
+ }>;
76
+ /**
77
+ * Gets the Event Log objects for a specific Intent object in a specific date interval.
78
+ * @param {string} sessionId - The session ID
79
+ * @param {string} intentId - The Intent object ID
80
+ * @param {string} strDateFrom - The optional begin of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
81
+ * @param {string} strDateTo - The optional end of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
82
+ */
83
+ getIntentEventLogs: (sessionId: string, intentId: string, strDateFrom: string, strDateTo: string) => Promise<ResponseSpec & {
84
+ eventLogs: EventLog[];
85
+ }>;
19
86
  };
20
87
  /*****************
21
88
  * *