@memori.ai/memori-api-client 0.10.2 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.d.ts CHANGED
@@ -65,6 +65,7 @@ export declare type Memori = {
65
65
  disableR4Loop?: boolean;
66
66
  disableR5Loop?: boolean;
67
67
  enableCompletions?: boolean;
68
+ completionDescription?: string;
68
69
  chainingMemoriID?: string;
69
70
  chainingBaseURL?: string;
70
71
  chainingPassword?: string;
@@ -125,6 +126,7 @@ export declare type User = {
125
126
  flowID?: string;
126
127
  newsletterSubscribed?: boolean;
127
128
  maxMemori?: number;
129
+ maxCompletions?: number;
128
130
  canCreateMemori?: boolean;
129
131
  canAccessAPI?: boolean;
130
132
  canRunSnippets?: boolean;
@@ -139,6 +141,7 @@ export declare type User = {
139
141
  couponCode?: string;
140
142
  paying?: boolean;
141
143
  notificationPrefs?: NotificationPrefs[];
144
+ dontSendInvitationEmail?: boolean;
142
145
  };
143
146
  export declare type IntegrationResource = {
144
147
  name: string;
@@ -206,8 +209,11 @@ export declare type Tenant = {
206
209
  maxMemoriPerAdmin?: number;
207
210
  maxMemoriPerUser?: number;
208
211
  maxTotalMemori?: number;
212
+ memoriCount?: number;
209
213
  maxAdmins?: number;
214
+ adminCount?: number;
210
215
  maxUsers?: number;
216
+ userCount?: number;
211
217
  usersCanCreateMemori?: boolean;
212
218
  usersCanAccessAPI?: boolean;
213
219
  usersCanEditIntegrations?: boolean;
@@ -216,6 +222,9 @@ export declare type Tenant = {
216
222
  maxFreeSessions?: number;
217
223
  maxFreeSessionsPerUser?: number;
218
224
  nonFreeSessionCost?: number;
225
+ maxCompletions?: number;
226
+ maxCompletionsPerUser?: number;
227
+ paying?: boolean;
219
228
  };
220
229
  export declare type OpenSession = {
221
230
  memoriID: string;
@@ -306,6 +315,7 @@ export declare type DialogState = {
306
315
  confidence?: number;
307
316
  confidenceLevel?: 'NONE' | 'LOW' | 'MEDIUM' | 'HIGH';
308
317
  emission?: string;
318
+ completion?: boolean;
309
319
  continuationEmitted?: boolean;
310
320
  lastMatchedMemoryID?: string;
311
321
  acceptsTimeout?: boolean;
@@ -449,10 +459,18 @@ export declare type Memory = {
449
459
  contextVarsToMatch?: {
450
460
  [variable: string]: string;
451
461
  };
462
+ /**
463
+ * Used for Unanswered Questions
464
+ */
465
+ contextVars?: {
466
+ [variable: string]: string;
467
+ };
452
468
  creationTimestamp?: string;
453
469
  creationName?: string;
470
+ creationSessionID?: string;
454
471
  lastChangeTimestamp?: string;
455
472
  lastChangeName?: string;
473
+ lastChangeSessionID?: string;
456
474
  };
457
475
  export declare type UnansweredQuestion = {
458
476
  unansweredQuestionID?: string;
@@ -463,15 +481,19 @@ export declare type UnansweredQuestion = {
463
481
  receiverName?: string;
464
482
  creationTimestamp?: string;
465
483
  creationName?: string;
484
+ creationSessionID?: string;
466
485
  lastChangeTimestamp?: string;
467
486
  lastChangeName?: string;
487
+ lastChangeSessionID?: string;
468
488
  suggestions?: SearchMatches[];
469
489
  };
470
490
  export declare type Message = {
491
+ memoryID?: string;
471
492
  text: string;
472
493
  translatedText?: string;
473
- fromUser?: boolean;
494
+ acceptsFeedback?: boolean;
474
495
  generatedByAI?: boolean;
496
+ fromUser?: boolean;
475
497
  media?: Medium[];
476
498
  initial?: boolean;
477
499
  timestamp?: string;
@@ -488,6 +510,7 @@ export declare type ConsumptionLog = {
488
510
  memoriID?: string;
489
511
  totalSessions: number;
490
512
  validSessions: number;
513
+ completions: number;
491
514
  };
492
515
  export declare type Notification = {
493
516
  notificationID: string;
@@ -553,6 +576,17 @@ export declare type ChatLogLine = {
553
576
  contextVars?: {
554
577
  [key: string]: string;
555
578
  };
579
+ /**
580
+ * @type {boolean}
581
+ * If True the text is a complation obtained via a generative AI. Can only be True for outbound lines.
582
+ */
583
+ completion?: boolean;
584
+ /**
585
+ * @type {boolean}
586
+ * If True the line is the result of a high confidence Memory object match, and as such can be subject to feedback.
587
+ * Can only be True for outbound lines.
588
+ */
589
+ acceptsFeedback?: boolean;
556
590
  };
557
591
  export declare type ChatLog = {
558
592
  /**
@@ -586,6 +620,13 @@ export declare type ChatLog = {
586
620
  */
587
621
  lines: ChatLogLine[];
588
622
  };
623
+ export declare type CorrelationPair = {
624
+ pairID?: string;
625
+ text1: string;
626
+ text2: string;
627
+ correlated: boolean;
628
+ occurrencies?: number;
629
+ };
589
630
  export declare type Utterance = {
590
631
  /**
591
632
  * Utterance object ID.
@@ -760,3 +801,40 @@ export declare type CustomWord = {
760
801
  lastChangeTimestamp: string;
761
802
  lastChangeSessionID: string;
762
803
  };
804
+ export declare type ImportWarning = {
805
+ warningType: 'Existing Similar Memory' | 'Internal Error';
806
+ rowNumber?: number;
807
+ csvRow: string;
808
+ text?: string;
809
+ similarTexts?: {
810
+ text: string;
811
+ similarityLevel: 'HIGH' | 'MEDIUM' | 'LOW';
812
+ }[];
813
+ };
814
+ export declare type ImportReponse = {
815
+ importID: string;
816
+ importedMemories?: number;
817
+ importWarnings?: ImportWarning[];
818
+ };
819
+ export declare type ImportCSVParams = {
820
+ includedRows?: number[];
821
+ hasHeaders?: boolean;
822
+ headerNames?: string[];
823
+ forceImport?: boolean;
824
+ questionColumnName: string;
825
+ answerColumnName: string;
826
+ contextVarsToMatchColumnName?: string;
827
+ contextVarsToSetColumnName?: string;
828
+ csvSeparator?: string;
829
+ questionTitleVariantsSeparator?: string;
830
+ };
831
+ export declare type ExportCSVParams = {
832
+ newLine: '\n' | '\r\n';
833
+ hasHeaders?: boolean;
834
+ questionColumnName: string;
835
+ answerColumnName: string;
836
+ contextVarsToMatchColumnName?: string;
837
+ contextVarsToSetColumnName?: string;
838
+ csvSeparator?: string;
839
+ questionTitleVariantsSeparator?: string;
840
+ };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.10.2",
2
+ "version": "0.11.0",
3
3
  "name": "@memori.ai/memori-api-client",
4
4
  "description": "React library to integrate a Memori in your app or website",
5
5
  "license": "Apache-2.0",
@@ -29,6 +29,21 @@ export default (apiUrl: string) => ({
29
29
  }
30
30
  >,
31
31
 
32
+ /**
33
+ * Gets the Chat Log objects for the Memori of the current session recorded during a specific other session.
34
+ * @param {string} sessionId The session ID
35
+ * @param {string} chatLogSessionID The session ID for which Chat Log objects are being searched
36
+ */
37
+ getSessionChatLogs: async (sessionId: string, chatLogSessionID: string) =>
38
+ apiFetcher(`/SessionChatLogs/${sessionId}/${chatLogSessionID}`, {
39
+ method: 'GET',
40
+ apiUrl,
41
+ }) as Promise<
42
+ ResponseSpec & {
43
+ chatLogs: ChatLog[];
44
+ }
45
+ >,
46
+
32
47
  /**
33
48
  * Removes all Chat Log objects in a specific date internval.
34
49
  * @param {string} sessionId The session ID
@@ -1,4 +1,4 @@
1
- import { ResponseSpec } from '../types';
1
+ import { ResponseSpec, CorrelationPair } from '../types';
2
2
  import { apiFetcher } from '../apiFetcher';
3
3
 
4
4
  /****************************
@@ -11,12 +11,46 @@ export default (apiUrl: string) => ({
11
11
  /**
12
12
  * Lists all Correlation Pair objects.
13
13
  * @param {string} sessionId The session ID
14
+ * @param {number=} from The starting index
15
+ * @param {number=} howMany The number of items to return
14
16
  */
15
- getCorrelationPairs: async (sessionId: string) =>
16
- apiFetcher(`/CorrelationPairs/${sessionId}`, {
17
- method: 'GET',
17
+ getCorrelationPairs: async (
18
+ sessionId: string,
19
+ from?: number,
20
+ howMany?: number
21
+ ) =>
22
+ apiFetcher(
23
+ `/CorrelationPairs/${sessionId}${
24
+ from ? `/${from}${howMany ? `/${howMany}` : ''}` : ''
25
+ }`,
26
+ {
27
+ method: 'GET',
28
+ apiUrl,
29
+ }
30
+ ) as Promise<
31
+ ResponseSpec & {
32
+ correlationPairs: CorrelationPair[];
33
+ }
34
+ >,
35
+
36
+ /**
37
+ * Adds a new Correlation Pair object.
38
+ * @param {string} sessionId The session ID
39
+ * @param {CorrelationPair} correlationPair The Correlation Pair object
40
+ */
41
+ postCorrelationPair: async (
42
+ sessionId: string,
43
+ correlationPair: CorrelationPair
44
+ ) =>
45
+ apiFetcher(`/CorrelationPair/${sessionId}`, {
46
+ method: 'POST',
18
47
  apiUrl,
19
- }) as Promise<ResponseSpec>,
48
+ body: correlationPair,
49
+ }) as Promise<
50
+ ResponseSpec & {
51
+ correlationPair: CorrelationPair;
52
+ }
53
+ >,
20
54
 
21
55
  /**
22
56
  * Removes an existing Correlation Pair object.
@@ -25,7 +59,7 @@ export default (apiUrl: string) => ({
25
59
  */
26
60
  deleteCorrelationPair: async (sessionId: string, pairId: string) =>
27
61
  apiFetcher(`/CorrelationPair/${sessionId}/${pairId}`, {
28
- method: 'GET',
62
+ method: 'DELETE',
29
63
  apiUrl,
30
64
  }) as Promise<ResponseSpec>,
31
65
  });
@@ -1,45 +1,11 @@
1
- import { ResponseSpec } from '../types';
1
+ import {
2
+ ResponseSpec,
3
+ ImportReponse,
4
+ ImportCSVParams,
5
+ ExportCSVParams,
6
+ } from '../types';
2
7
  import { apiFetcher } from '../apiFetcher';
3
8
 
4
- export interface ImportCSVParams {
5
- includedRows?: number[];
6
- hasHeaders?: boolean;
7
- headerNames?: string[];
8
- forceImport?: boolean;
9
- questionColumnName: string;
10
- answerColumnName: string;
11
- contextVarsToMatchColumnName?: string;
12
- contextVarsToSetColumnName?: string;
13
- csvSeparator?: string;
14
- questionTitleVariantsSeparator?: string;
15
- }
16
-
17
- export interface ExportCSVParams {
18
- newLine: '\n' | '\r\n';
19
- hasHeaders?: boolean;
20
- questionColumnName: string;
21
- answerColumnName: string;
22
- contextVarsToMatchColumnName?: string;
23
- contextVarsToSetColumnName?: string;
24
- csvSeparator?: string;
25
- questionTitleVariantsSeparator?: string;
26
- }
27
-
28
- export interface ImportReponse {
29
- importID: string;
30
- importedMemories?: number;
31
- importWarnings?: {
32
- warningType: 'Existing Similar Memory' | 'Internal Error';
33
- rowNumber?: number;
34
- csvRow: string;
35
- text?: string;
36
- similarTexts?: {
37
- text: string;
38
- similarityLevel: 'HIGH' | 'MEDIUM' | 'LOW';
39
- }[];
40
- }[];
41
- }
42
-
43
9
  /************************
44
10
  * *
45
11
  * ImportExport *
@@ -11,9 +11,13 @@ export default (apiUrl: string) => ({
11
11
  /**
12
12
  * Lists all Memory objects.
13
13
  * @param {string} sessionId The session ID
14
+ * @param {string=} type Optional type of the Memory objects to list: ALL, CONTENTS, DEFAULTS, DRAFTS
14
15
  */
15
- getMemories: async (sessionId: string) =>
16
- apiFetcher(`/Memories/${sessionId}`, {
16
+ getMemories: async (
17
+ sessionId: string,
18
+ type?: 'ALL' | 'CONTENTS' | 'DEFAULTS' | 'DRAFTS'
19
+ ) =>
20
+ apiFetcher(`/Memories/${sessionId}${type ? `/${type}` : ''}`, {
17
21
  method: 'GET',
18
22
  apiUrl,
19
23
  }) as Promise<
@@ -27,7 +31,7 @@ export default (apiUrl: string) => ({
27
31
  * @param {string} sessionId The session ID
28
32
  * @param {number} from The starting index
29
33
  * @param {number} howMany The number of items to return
30
- * @param {string=} type Optional type of the Memory objects to list: ALL, CONTENTS, DEFAULTS
34
+ * @param {string=} type Optional type of the Memory objects to list: ALL, CONTENTS, DEFAULTS, DRAFTS
31
35
  */
32
36
  getMemoriesPaginated: async (
33
37
  sessionId: string,
@@ -91,7 +95,7 @@ export default (apiUrl: string) => ({
91
95
  * @param {string} sessionId The session ID
92
96
  * @param {Memory} memory The Memory object
93
97
  */
94
- postMemory: async (sessionId: string, memory: Memory) =>
98
+ postMemory: async (sessionId: string, memory: Omit<Memory, 'memoryID'>) =>
95
99
  apiFetcher(`/Memory/${sessionId}`, {
96
100
  method: 'POST',
97
101
  apiUrl,
@@ -41,6 +41,25 @@ export default (apiUrl: string) => ({
41
41
  }
42
42
  >,
43
43
 
44
+ /**
45
+ * Adds a new Unanswered Question object.
46
+ * @param {string} sessionId The session ID
47
+ * @param {UnansweredQuestion} unansweredQuestion The Unanswered Question object
48
+ */
49
+ postUnansweredQuestion: async (
50
+ sessionId: string,
51
+ unansweredQuestion: UnansweredQuestion
52
+ ) =>
53
+ apiFetcher(`/UnansweredQuestion/${sessionId}`, {
54
+ method: 'POST',
55
+ apiUrl,
56
+ body: unansweredQuestion,
57
+ }) as Promise<
58
+ ResponseSpec & {
59
+ unansweredQuestion: UnansweredQuestion;
60
+ }
61
+ >,
62
+
44
63
  /**
45
64
  * Removes an existing Unanswered Question object.
46
65
  * @param {string} sessionId The session ID
package/src/types.ts CHANGED
@@ -64,6 +64,7 @@ export declare type Memori = {
64
64
  disableR4Loop?: boolean;
65
65
  disableR5Loop?: boolean;
66
66
  enableCompletions?: boolean;
67
+ completionDescription?: string;
67
68
  chainingMemoriID?: string;
68
69
  chainingBaseURL?: string;
69
70
  chainingPassword?: string;
@@ -127,6 +128,7 @@ export declare type User = {
127
128
  flowID?: string;
128
129
  newsletterSubscribed?: boolean;
129
130
  maxMemori?: number;
131
+ maxCompletions?: number;
130
132
  canCreateMemori?: boolean;
131
133
  canAccessAPI?: boolean;
132
134
  canRunSnippets?: boolean;
@@ -141,6 +143,7 @@ export declare type User = {
141
143
  couponCode?: string;
142
144
  paying?: boolean;
143
145
  notificationPrefs?: NotificationPrefs[];
146
+ dontSendInvitationEmail?: boolean;
144
147
  };
145
148
 
146
149
  export declare type IntegrationResource = {
@@ -229,8 +232,11 @@ export declare type Tenant = {
229
232
  maxMemoriPerAdmin?: number;
230
233
  maxMemoriPerUser?: number;
231
234
  maxTotalMemori?: number;
235
+ memoriCount?: number;
232
236
  maxAdmins?: number;
237
+ adminCount?: number;
233
238
  maxUsers?: number;
239
+ userCount?: number;
234
240
  usersCanCreateMemori?: boolean;
235
241
  usersCanAccessAPI?: boolean;
236
242
  usersCanEditIntegrations?: boolean;
@@ -239,6 +245,9 @@ export declare type Tenant = {
239
245
  maxFreeSessions?: number;
240
246
  maxFreeSessionsPerUser?: number;
241
247
  nonFreeSessionCost?: number;
248
+ maxCompletions?: number;
249
+ maxCompletionsPerUser?: number;
250
+ paying?: boolean;
242
251
  };
243
252
 
244
253
  export declare type OpenSession = {
@@ -335,6 +344,7 @@ export declare type DialogState = {
335
344
  confidence?: number;
336
345
  confidenceLevel?: 'NONE' | 'LOW' | 'MEDIUM' | 'HIGH';
337
346
  emission?: string;
347
+ completion?: boolean;
338
348
  continuationEmitted?: boolean;
339
349
  lastMatchedMemoryID?: string;
340
350
  acceptsTimeout?: boolean;
@@ -480,10 +490,16 @@ export declare type Memory = {
480
490
  maxTimeout?: number;
481
491
  contextVarsToSet?: { [variable: string]: string };
482
492
  contextVarsToMatch?: { [variable: string]: string };
493
+ /**
494
+ * Used for Unanswered Questions
495
+ */
496
+ contextVars?: { [variable: string]: string };
483
497
  creationTimestamp?: string;
484
498
  creationName?: string;
499
+ creationSessionID?: string;
485
500
  lastChangeTimestamp?: string;
486
501
  lastChangeName?: string;
502
+ lastChangeSessionID?: string;
487
503
  };
488
504
 
489
505
  export declare type UnansweredQuestion = {
@@ -495,16 +511,20 @@ export declare type UnansweredQuestion = {
495
511
  receiverName?: string;
496
512
  creationTimestamp?: string;
497
513
  creationName?: string;
514
+ creationSessionID?: string;
498
515
  lastChangeTimestamp?: string;
499
516
  lastChangeName?: string;
517
+ lastChangeSessionID?: string;
500
518
  suggestions?: SearchMatches[];
501
519
  };
502
520
 
503
521
  export declare type Message = {
522
+ memoryID?: string;
504
523
  text: string;
505
524
  translatedText?: string;
506
- fromUser?: boolean;
525
+ acceptsFeedback?: boolean;
507
526
  generatedByAI?: boolean;
527
+ fromUser?: boolean;
508
528
  media?: Medium[];
509
529
  initial?: boolean;
510
530
  timestamp?: string;
@@ -520,6 +540,7 @@ export type ConsumptionLog = {
520
540
  memoriID?: string;
521
541
  totalSessions: number;
522
542
  validSessions: number;
543
+ completions: number;
523
544
  };
524
545
 
525
546
  export type Notification = {
@@ -584,6 +605,17 @@ export type ChatLogLine = {
584
605
  * Dialog State Machine context variables after the emission, if present. Empty if the line is inbound.
585
606
  */
586
607
  contextVars?: { [key: string]: string };
608
+ /**
609
+ * @type {boolean}
610
+ * If True the text is a complation obtained via a generative AI. Can only be True for outbound lines.
611
+ */
612
+ completion?: boolean;
613
+ /**
614
+ * @type {boolean}
615
+ * If True the line is the result of a high confidence Memory object match, and as such can be subject to feedback.
616
+ * Can only be True for outbound lines.
617
+ */
618
+ acceptsFeedback?: boolean;
587
619
  };
588
620
 
589
621
  export type ChatLog = {
@@ -620,6 +652,14 @@ export type ChatLog = {
620
652
  lines: ChatLogLine[];
621
653
  };
622
654
 
655
+ export type CorrelationPair = {
656
+ pairID?: string;
657
+ text1: string;
658
+ text2: string;
659
+ correlated: boolean;
660
+ occurrencies?: number;
661
+ };
662
+
623
663
  export type Utterance = {
624
664
  /**
625
665
  * Utterance object ID.
@@ -799,3 +839,44 @@ export type CustomWord = {
799
839
  lastChangeTimestamp: string;
800
840
  lastChangeSessionID: string;
801
841
  };
842
+
843
+ export type ImportWarning = {
844
+ warningType: 'Existing Similar Memory' | 'Internal Error';
845
+ rowNumber?: number;
846
+ csvRow: string;
847
+ text?: string;
848
+ similarTexts?: {
849
+ text: string;
850
+ similarityLevel: 'HIGH' | 'MEDIUM' | 'LOW';
851
+ }[];
852
+ };
853
+
854
+ export type ImportReponse = {
855
+ importID: string;
856
+ importedMemories?: number;
857
+ importWarnings?: ImportWarning[];
858
+ };
859
+
860
+ export type ImportCSVParams = {
861
+ includedRows?: number[];
862
+ hasHeaders?: boolean;
863
+ headerNames?: string[];
864
+ forceImport?: boolean;
865
+ questionColumnName: string;
866
+ answerColumnName: string;
867
+ contextVarsToMatchColumnName?: string;
868
+ contextVarsToSetColumnName?: string;
869
+ csvSeparator?: string;
870
+ questionTitleVariantsSeparator?: string;
871
+ };
872
+
873
+ export type ExportCSVParams = {
874
+ newLine: '\n' | '\r\n';
875
+ hasHeaders?: boolean;
876
+ questionColumnName: string;
877
+ answerColumnName: string;
878
+ contextVarsToMatchColumnName?: string;
879
+ contextVarsToSetColumnName?: string;
880
+ csvSeparator?: string;
881
+ questionTitleVariantsSeparator?: string;
882
+ };