@memori.ai/memori-api-client 0.10.3 → 1.0.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;
@@ -450,10 +459,18 @@ export declare type Memory = {
450
459
  contextVarsToMatch?: {
451
460
  [variable: string]: string;
452
461
  };
462
+ /**
463
+ * Used for Unanswered Questions
464
+ */
465
+ contextVars?: {
466
+ [variable: string]: string;
467
+ };
453
468
  creationTimestamp?: string;
454
469
  creationName?: string;
470
+ creationSessionID?: string;
455
471
  lastChangeTimestamp?: string;
456
472
  lastChangeName?: string;
473
+ lastChangeSessionID?: string;
457
474
  };
458
475
  export declare type UnansweredQuestion = {
459
476
  unansweredQuestionID?: string;
@@ -464,15 +481,19 @@ export declare type UnansweredQuestion = {
464
481
  receiverName?: string;
465
482
  creationTimestamp?: string;
466
483
  creationName?: string;
484
+ creationSessionID?: string;
467
485
  lastChangeTimestamp?: string;
468
486
  lastChangeName?: string;
487
+ lastChangeSessionID?: string;
469
488
  suggestions?: SearchMatches[];
470
489
  };
471
490
  export declare type Message = {
491
+ memoryID?: string;
472
492
  text: string;
473
493
  translatedText?: string;
474
- fromUser?: boolean;
494
+ acceptsFeedback?: boolean;
475
495
  generatedByAI?: boolean;
496
+ fromUser?: boolean;
476
497
  media?: Medium[];
477
498
  initial?: boolean;
478
499
  timestamp?: string;
@@ -489,6 +510,7 @@ export declare type ConsumptionLog = {
489
510
  memoriID?: string;
490
511
  totalSessions: number;
491
512
  validSessions: number;
513
+ completions: number;
492
514
  };
493
515
  export declare type Notification = {
494
516
  notificationID: string;
@@ -554,6 +576,17 @@ export declare type ChatLogLine = {
554
576
  contextVars?: {
555
577
  [key: string]: string;
556
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;
557
590
  };
558
591
  export declare type ChatLog = {
559
592
  /**
@@ -587,6 +620,13 @@ export declare type ChatLog = {
587
620
  */
588
621
  lines: ChatLogLine[];
589
622
  };
623
+ export declare type CorrelationPair = {
624
+ pairID?: string;
625
+ text1: string;
626
+ text2: string;
627
+ correlated: boolean;
628
+ occurrencies?: number;
629
+ };
590
630
  export declare type Utterance = {
591
631
  /**
592
632
  * Utterance object ID.
@@ -761,3 +801,40 @@ export declare type CustomWord = {
761
801
  lastChangeTimestamp: string;
762
802
  lastChangeSessionID: string;
763
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.3",
2
+ "version": "1.0.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",
@@ -126,7 +126,6 @@
126
126
  "typescript": "4.7.4"
127
127
  },
128
128
  "dependencies": {
129
- "cross-fetch": "^3.1.5",
130
- "microsoft-cognitiveservices-speech-sdk": "1.20.0"
129
+ "cross-fetch": "^3.1.5"
131
130
  }
132
131
  }
@@ -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/index.ts CHANGED
@@ -2,7 +2,6 @@ import { getApiUrl } from './helpers/getApiUrl';
2
2
  import backend from './backend';
3
3
  import engine from './engine';
4
4
  import * as constants from './constants';
5
- import speech from './speech';
6
5
  import asset from './helpers/asset';
7
6
 
8
7
  const api = (hostname?: string) => {
@@ -11,7 +10,6 @@ const api = (hostname?: string) => {
11
10
  return {
12
11
  backend: backend(`${apiUrl}/api/v2`),
13
12
  ...engine(`${apiUrl}/memori/v2`),
14
- speech,
15
13
  constants,
16
14
  asset: asset(`${apiUrl}/api/v2`),
17
15
  };
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 = {
@@ -481,10 +490,16 @@ export declare type Memory = {
481
490
  maxTimeout?: number;
482
491
  contextVarsToSet?: { [variable: string]: string };
483
492
  contextVarsToMatch?: { [variable: string]: string };
493
+ /**
494
+ * Used for Unanswered Questions
495
+ */
496
+ contextVars?: { [variable: string]: string };
484
497
  creationTimestamp?: string;
485
498
  creationName?: string;
499
+ creationSessionID?: string;
486
500
  lastChangeTimestamp?: string;
487
501
  lastChangeName?: string;
502
+ lastChangeSessionID?: string;
488
503
  };
489
504
 
490
505
  export declare type UnansweredQuestion = {
@@ -496,16 +511,20 @@ export declare type UnansweredQuestion = {
496
511
  receiverName?: string;
497
512
  creationTimestamp?: string;
498
513
  creationName?: string;
514
+ creationSessionID?: string;
499
515
  lastChangeTimestamp?: string;
500
516
  lastChangeName?: string;
517
+ lastChangeSessionID?: string;
501
518
  suggestions?: SearchMatches[];
502
519
  };
503
520
 
504
521
  export declare type Message = {
522
+ memoryID?: string;
505
523
  text: string;
506
524
  translatedText?: string;
507
- fromUser?: boolean;
525
+ acceptsFeedback?: boolean;
508
526
  generatedByAI?: boolean;
527
+ fromUser?: boolean;
509
528
  media?: Medium[];
510
529
  initial?: boolean;
511
530
  timestamp?: string;
@@ -521,6 +540,7 @@ export type ConsumptionLog = {
521
540
  memoriID?: string;
522
541
  totalSessions: number;
523
542
  validSessions: number;
543
+ completions: number;
524
544
  };
525
545
 
526
546
  export type Notification = {
@@ -585,6 +605,17 @@ export type ChatLogLine = {
585
605
  * Dialog State Machine context variables after the emission, if present. Empty if the line is inbound.
586
606
  */
587
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;
588
619
  };
589
620
 
590
621
  export type ChatLog = {
@@ -621,6 +652,14 @@ export type ChatLog = {
621
652
  lines: ChatLogLine[];
622
653
  };
623
654
 
655
+ export type CorrelationPair = {
656
+ pairID?: string;
657
+ text1: string;
658
+ text2: string;
659
+ correlated: boolean;
660
+ occurrencies?: number;
661
+ };
662
+
624
663
  export type Utterance = {
625
664
  /**
626
665
  * Utterance object ID.
@@ -800,3 +839,44 @@ export type CustomWord = {
800
839
  lastChangeTimestamp: string;
801
840
  lastChangeSessionID: string;
802
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
+ };
package/dist/speech.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import * as speechSdk from 'microsoft-cognitiveservices-speech-sdk';
2
- /**
3
- * EXPERIMENTAL
4
- */
5
- declare const speech: (AZURE_COGNITIVE_SERVICES_TTS_KEY: string, DEBUG?: boolean) => (lang: string, voiceType: 'FEMALE' | 'MALE') => {
6
- speak: (text: string, onAudioEnd?: ((sender: speechSdk.IPlayer) => void) | undefined) => void;
7
- isSpeaking: () => boolean;
8
- stopSpeaking: () => void;
9
- recognize: (onRecognized: (transcript: string) => void) => void;
10
- isRecognizing: () => boolean;
11
- stopRecognizing: (onStop?: (() => void) | undefined) => void;
12
- };
13
- export default speech;