@memori.ai/memori-api-client 0.2.0 → 0.3.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/README.md +1 -1
- package/dist/apiFetcher.d.ts +1 -0
- package/dist/backend/consumptionLogs.d.ts +40 -0
- package/dist/backend/memori.d.ts +11 -0
- package/dist/backend/notifications.d.ts +20 -0
- package/dist/backend.d.ts +42 -0
- package/dist/engine/chatLogs.d.ts +31 -0
- package/dist/engine/customDictionary.d.ts +47 -0
- package/dist/engine/dialog.d.ts +3 -9
- package/dist/engine/importExport.d.ts +39 -14
- package/dist/engine/intents.d.ts +36 -11
- package/dist/engine/nlp.d.ts +42 -1
- package/dist/engine/stats.d.ts +68 -1
- package/dist/engine.d.ts +174 -38
- package/dist/index.d.ts +216 -38
- package/dist/memori-api-client.cjs.development.js +702 -67
- package/dist/memori-api-client.cjs.development.js.map +1 -1
- package/dist/memori-api-client.cjs.production.min.js +1 -1
- package/dist/memori-api-client.cjs.production.min.js.map +1 -1
- package/dist/memori-api-client.esm.js +702 -67
- package/dist/memori-api-client.esm.js.map +1 -1
- package/dist/types.d.ts +318 -1
- package/package.json +2 -2
- package/src/apiFetcher.ts +2 -1
- package/src/backend/consumptionLogs.ts +79 -0
- package/src/backend/memori.ts +20 -0
- package/src/backend/notifications.ts +24 -0
- package/src/backend.ts +6 -0
- package/src/engine/chatLogs.ts +63 -0
- package/src/engine/customDictionary.ts +85 -0
- package/src/engine/dialog.ts +3 -3
- package/src/engine/importExport.ts +56 -16
- package/src/engine/intents.ts +58 -21
- package/src/engine/nlp.ts +78 -1
- package/src/engine/stats.ts +117 -1
- package/src/engine.ts +6 -0
- package/src/types.ts +327 -1
package/src/types.ts
CHANGED
|
@@ -45,14 +45,19 @@ export declare type Memori = {
|
|
|
45
45
|
culture?: string;
|
|
46
46
|
publishedInTheMetaverse?: boolean;
|
|
47
47
|
metaverseEnvironment?: string;
|
|
48
|
+
exposed?: boolean;
|
|
48
49
|
properties?: { [key: string]: string };
|
|
49
50
|
creationTimestamp?: string;
|
|
50
51
|
lastChangeTimestamp?: string;
|
|
52
|
+
blockedUntil?: string;
|
|
51
53
|
integrations?: Integration[];
|
|
52
54
|
sentInvitations?: Invitation[];
|
|
53
55
|
receivedInvitations?: Invitation[];
|
|
54
56
|
categories?: string[];
|
|
55
57
|
ownerUserName?: string;
|
|
58
|
+
gamificationLevel?: GamificationLevel;
|
|
59
|
+
contentQualityIndex?: number;
|
|
60
|
+
contentQualityIndexTimestamp?: string;
|
|
56
61
|
};
|
|
57
62
|
|
|
58
63
|
export declare type Venue = {
|
|
@@ -62,6 +67,32 @@ export declare type Venue = {
|
|
|
62
67
|
uncertainty?: number;
|
|
63
68
|
};
|
|
64
69
|
|
|
70
|
+
export declare type NotificationPrefs = {
|
|
71
|
+
/**
|
|
72
|
+
* @type {string='None'}
|
|
73
|
+
* minLength: 1
|
|
74
|
+
* Periodicity of chat log extraction (hourly, daily, weekly or none).
|
|
75
|
+
* When chat log extraction is enabled (i.e. not None) chats performed on Memori owned or managed by the User
|
|
76
|
+
* will be periodically collected and sent via e-mail.
|
|
77
|
+
*/
|
|
78
|
+
chatLogExtractionPeriod?: 'None' | 'Hourly' | 'Daily' | 'Weekly';
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @type {number=5}
|
|
82
|
+
* Minimum lines for an extracted chat to be sent via e-mail to the User.
|
|
83
|
+
* If 0 no filter is applied.
|
|
84
|
+
* Default is 5.
|
|
85
|
+
*/
|
|
86
|
+
chatLogExtractionMinLines?: number;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @type {string=}
|
|
90
|
+
* Memori ID to which these preferences apply to.
|
|
91
|
+
* If Null these preferences have default value and apply to all Memori objects not specified with other preferences.
|
|
92
|
+
*/
|
|
93
|
+
memoriID?: string;
|
|
94
|
+
};
|
|
95
|
+
|
|
65
96
|
export declare type User = {
|
|
66
97
|
tenant?: string;
|
|
67
98
|
userID?: string;
|
|
@@ -77,12 +108,18 @@ export declare type User = {
|
|
|
77
108
|
maxMemori?: number;
|
|
78
109
|
canCreateMemori?: boolean;
|
|
79
110
|
canAccessAPI?: boolean;
|
|
111
|
+
canRunSnippets?: boolean;
|
|
80
112
|
canEditIntegrations?: boolean;
|
|
81
113
|
canEditDynamicIntents?: boolean;
|
|
82
114
|
canEditMemoriChaining?: boolean;
|
|
83
115
|
maxFreeSessions?: number;
|
|
116
|
+
nonFreeSessionCost?: number;
|
|
84
117
|
creationTimestamp?: string;
|
|
85
118
|
lastChangeTimestamp?: string;
|
|
119
|
+
referral?: string;
|
|
120
|
+
couponCode?: string;
|
|
121
|
+
paying?: boolean;
|
|
122
|
+
notificationPrefs?: NotificationPrefs[];
|
|
86
123
|
};
|
|
87
124
|
|
|
88
125
|
export declare type IntegrationResource = {
|
|
@@ -180,6 +217,7 @@ export declare type Tenant = {
|
|
|
180
217
|
usersCanEditMemoriChaining?: boolean;
|
|
181
218
|
maxFreeSessions?: number;
|
|
182
219
|
maxFreeSessionsPerUser?: number;
|
|
220
|
+
nonFreeSessionCost?: number;
|
|
183
221
|
};
|
|
184
222
|
|
|
185
223
|
export declare type OpenSession = {
|
|
@@ -233,7 +271,7 @@ export declare type GamificationLevel = {
|
|
|
233
271
|
points: number;
|
|
234
272
|
badge: string;
|
|
235
273
|
pointsForCurrentBadge: number;
|
|
236
|
-
nextBadge
|
|
274
|
+
nextBadge?: {
|
|
237
275
|
points: number;
|
|
238
276
|
badge: string;
|
|
239
277
|
};
|
|
@@ -434,7 +472,295 @@ export declare type UnansweredQuestion = {
|
|
|
434
472
|
|
|
435
473
|
export declare type Message = {
|
|
436
474
|
text: string;
|
|
475
|
+
translatedText?: string;
|
|
437
476
|
fromUser?: boolean;
|
|
438
477
|
media?: Medium[];
|
|
439
478
|
initial?: boolean;
|
|
479
|
+
timestamp?: string;
|
|
480
|
+
contextVars?: { [key: string]: string };
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
export type ConsumptionLog = {
|
|
484
|
+
consumptionLogID: string;
|
|
485
|
+
from: string;
|
|
486
|
+
to: string;
|
|
487
|
+
type: 'Daily' | 'Monthly';
|
|
488
|
+
userID?: string;
|
|
489
|
+
memoriID?: string;
|
|
490
|
+
totalSessions: number;
|
|
491
|
+
validSessions: number;
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
export type Notification = {
|
|
495
|
+
notificationID: string;
|
|
496
|
+
timestamp: string;
|
|
497
|
+
severity: 'INFO' | 'WARN' | 'ALERT';
|
|
498
|
+
texts: {
|
|
499
|
+
'it-IT': string;
|
|
500
|
+
'en-US': string;
|
|
501
|
+
[lang: string]: string;
|
|
502
|
+
};
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
export type ChatMedium = {
|
|
506
|
+
/**
|
|
507
|
+
* URL of the Medium. If specified, the Content property is Null.
|
|
508
|
+
*/
|
|
509
|
+
url?: string;
|
|
510
|
+
/**
|
|
511
|
+
* Content of the Medium. If specified, the URL property is Null.
|
|
512
|
+
*/
|
|
513
|
+
content?: string;
|
|
514
|
+
/**
|
|
515
|
+
* MIME type of the Medium.
|
|
516
|
+
*/
|
|
517
|
+
mimeType: string;
|
|
518
|
+
/**
|
|
519
|
+
* Title of the Medium.
|
|
520
|
+
*/
|
|
521
|
+
title?: string;
|
|
522
|
+
/**
|
|
523
|
+
* Key-value pairs for additional structured content storage.
|
|
524
|
+
*/
|
|
525
|
+
properties?: { [key: string]: string };
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
export type ChatLogLine = {
|
|
529
|
+
/**
|
|
530
|
+
* @type {string}
|
|
531
|
+
* Timestamp UTC of the line.
|
|
532
|
+
*/
|
|
533
|
+
timestamp: string;
|
|
534
|
+
/**
|
|
535
|
+
* @type {boolean}
|
|
536
|
+
* If True the line is the text from a Text Entered Event. If False the line is Dialog State Machine emission.
|
|
537
|
+
*/
|
|
538
|
+
inbound: boolean;
|
|
539
|
+
/**
|
|
540
|
+
* @type {string}
|
|
541
|
+
* Text of the line.
|
|
542
|
+
*/
|
|
543
|
+
text: string;
|
|
544
|
+
/**
|
|
545
|
+
* Media attached with the Dialog State Machine emission, if present. Empty if the line is inbound.
|
|
546
|
+
*/
|
|
547
|
+
media?: ChatMedium[];
|
|
548
|
+
/**
|
|
549
|
+
* Dialog State Machine context variables after the emission, if present. Empty if the line is inbound.
|
|
550
|
+
*/
|
|
551
|
+
contextVars?: { [key: string]: string };
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
export type ChatLog = {
|
|
555
|
+
/**
|
|
556
|
+
* @param {string}
|
|
557
|
+
* Chat Log object ID.
|
|
558
|
+
*/
|
|
559
|
+
chatLogID: string;
|
|
560
|
+
/**
|
|
561
|
+
* @type {string}
|
|
562
|
+
* Timestamp UTC of the chat log creation.
|
|
563
|
+
*/
|
|
564
|
+
timestamp: string;
|
|
565
|
+
/**
|
|
566
|
+
* @type {string}
|
|
567
|
+
* ID of the related Memori object in the Engine.
|
|
568
|
+
* Relates to Memori.engineMemoriID
|
|
569
|
+
*/
|
|
570
|
+
memoriID: string;
|
|
571
|
+
/**
|
|
572
|
+
* @type {string}
|
|
573
|
+
* ID of the related session.
|
|
574
|
+
*/
|
|
575
|
+
sessionID: string;
|
|
576
|
+
/**
|
|
577
|
+
* @type {?string}
|
|
578
|
+
* Tag of the Person object authenticated in the session. Null if the chat was performed by anonymous.
|
|
579
|
+
*/
|
|
580
|
+
receiverTag?: string;
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* List of Chat Line objects of this chat.
|
|
584
|
+
*/
|
|
585
|
+
lines: ChatLogLine[];
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
export type Utterance = {
|
|
589
|
+
/**
|
|
590
|
+
* Utterance object ID.
|
|
591
|
+
*/
|
|
592
|
+
utteranceID?: string;
|
|
593
|
+
/**
|
|
594
|
+
* Accepted Utterance object for its corresponding intent,
|
|
595
|
+
* i.e. the text sentece that can be used to express the intent.
|
|
596
|
+
* An Utterance may include variable parts in the sentence by the use of one or more slots.
|
|
597
|
+
* Slots are specified using the syntax {slot}, where "slot" is the slot name.
|
|
598
|
+
* If present, their value is part of the IntentWebHookRequest passed to the web hook.
|
|
599
|
+
* Each slot can be present only once in the sentence, and must have been previously defined with a Intent Slot object.
|
|
600
|
+
* A special slot is the {date} slot, which represents a period of time such as "today", "yesterday", "last week", "next month" etc.
|
|
601
|
+
* Its values is passed in the IntentWebHookRequest as the BeginUTC and EndUTC properties.
|
|
602
|
+
*/
|
|
603
|
+
text: string;
|
|
604
|
+
/**
|
|
605
|
+
* Timestamp of creation.
|
|
606
|
+
* Always present when reading/receiving an object,
|
|
607
|
+
* ignored when writing/sending an object.
|
|
608
|
+
*/
|
|
609
|
+
creationTimestamp?: string;
|
|
610
|
+
/**
|
|
611
|
+
* ID of the session that created this object.
|
|
612
|
+
*/
|
|
613
|
+
creationSessionID?: string;
|
|
614
|
+
/**
|
|
615
|
+
* Timestamp of latest change.
|
|
616
|
+
* Always present when reading/receiving an object,
|
|
617
|
+
* ignored when writing/sending an object.
|
|
618
|
+
*/
|
|
619
|
+
lastChangeTimestamp?: string;
|
|
620
|
+
/**
|
|
621
|
+
* ID of the latest session that changed this object.
|
|
622
|
+
*/
|
|
623
|
+
lastChangeSessionID?: string;
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
export type Intent = {
|
|
627
|
+
/**
|
|
628
|
+
* Intent object ID.
|
|
629
|
+
*/
|
|
630
|
+
intentID?: string;
|
|
631
|
+
/**
|
|
632
|
+
* Memory type, e.g. Internal or WebHook.
|
|
633
|
+
* Internal intents are a limited subset implemented internally,
|
|
634
|
+
* while WebHook intents perform an external HTTP POST call to the specified web hook,
|
|
635
|
+
* passing an IntentWebHookRequest and expecting an IntentWebHookRespose in response.
|
|
636
|
+
* When updating an existing intent, this property is ignored.
|
|
637
|
+
*/
|
|
638
|
+
intentType?: 'Internal' | 'WebHook';
|
|
639
|
+
/**
|
|
640
|
+
* Name of the Intent object.
|
|
641
|
+
* It is part of the IntentWebHookRequest request passed to the web hook.
|
|
642
|
+
*/
|
|
643
|
+
name: string;
|
|
644
|
+
/**
|
|
645
|
+
* List of accepted Utterance objects for this Intent,
|
|
646
|
+
* i.e. the list of text senteces that can be used to express the intent.
|
|
647
|
+
* Utterances may include variable parts in the sentence by the use of one or more slots.
|
|
648
|
+
* Slots are specified using the syntax {slot}, where "slot" is the slot name.
|
|
649
|
+
* If present, their value is part of the IntentWebHookRequest passed to the web hook.
|
|
650
|
+
* Each slot can be present only once in the sentence, and must have been previously defined with a Intent Slot object.
|
|
651
|
+
* A special slot is the {date} slot, which represents a period of time such as "today", "yesterday", "last week", "next month" etc.
|
|
652
|
+
* Its values is passed in the IntentWebHookRequest as the BeginUTC and EndUTC properties.
|
|
653
|
+
*/
|
|
654
|
+
utterances: Utterance[];
|
|
655
|
+
/**
|
|
656
|
+
* If True this Intent may be executed to serve a Timeout event in R1 state.
|
|
657
|
+
* In this case the utterance is null.
|
|
658
|
+
* In case more than one Intent have this flag set, a random one is picked.
|
|
659
|
+
*/
|
|
660
|
+
timeoutIntent?: boolean;
|
|
661
|
+
/**
|
|
662
|
+
* HTTP URL of the web hook to be called when the intent is recognized.
|
|
663
|
+
* If the intent is of Internal type, it is ignored.
|
|
664
|
+
*/
|
|
665
|
+
webHook?: string;
|
|
666
|
+
/**
|
|
667
|
+
* Time to cache the intent response, expressed in minutes.
|
|
668
|
+
* May be fractional. A minimum of 0.1 minutes (i.e. 6 seconds) is always applied.
|
|
669
|
+
* A cached intent response is used only when the a subsequent intent request matches exactly the original request.
|
|
670
|
+
* See also RequestValidityMinutes in WebHookRequest.
|
|
671
|
+
*/
|
|
672
|
+
validityMinutes?: number;
|
|
673
|
+
/**
|
|
674
|
+
* Timestamp of creation.
|
|
675
|
+
* Always present when reading/receiving an object,
|
|
676
|
+
* ignored when writing/sending an object.
|
|
677
|
+
*/
|
|
678
|
+
creationTimestamp?: string;
|
|
679
|
+
/**
|
|
680
|
+
* ID of the session that created this object.
|
|
681
|
+
*/
|
|
682
|
+
creationSessionID?: string;
|
|
683
|
+
/**
|
|
684
|
+
* Timestamp of latest change.
|
|
685
|
+
* Always present when reading/receiving an object,
|
|
686
|
+
* ignored when writing/sending an object.
|
|
687
|
+
*/
|
|
688
|
+
lastChangeTimestamp?: string;
|
|
689
|
+
/**
|
|
690
|
+
* ID of the latest session that changed this object.
|
|
691
|
+
*/
|
|
692
|
+
lastChangeSessionID?: string;
|
|
693
|
+
};
|
|
694
|
+
|
|
695
|
+
export type IntentSlot = {
|
|
696
|
+
/**
|
|
697
|
+
* Intent Slot object ID.
|
|
698
|
+
*/
|
|
699
|
+
intentSlotID?: string;
|
|
700
|
+
/**
|
|
701
|
+
* Name of the Intent Slot object.
|
|
702
|
+
* It is part of the SlotWebHookRequest request passed to the web hook.
|
|
703
|
+
*/
|
|
704
|
+
name: string;
|
|
705
|
+
/**
|
|
706
|
+
* List of possible values of the slot.
|
|
707
|
+
* A slot may be composed of fixed values in this property,
|
|
708
|
+
* dynamic values fetched from the web hook, or a combination of both.
|
|
709
|
+
* Each value is considered only onces (duplicate values are ignored).
|
|
710
|
+
*/
|
|
711
|
+
values?: string[];
|
|
712
|
+
/**
|
|
713
|
+
* HTTP URL of the web hook to be called when the slot values must be fetched.
|
|
714
|
+
* May be null if the slot is composed only of fixed values in the Values property.
|
|
715
|
+
* If specified, the web hook is called periodically with an HTTP POST call,
|
|
716
|
+
* passing a SlotWebHookRequest and expecting a SlotWebHookRespose in response.
|
|
717
|
+
* Periodicity is determined by the ValidityMinutes property.
|
|
718
|
+
*/
|
|
719
|
+
webHook?: string;
|
|
720
|
+
/**
|
|
721
|
+
* Time to cache the slot values, expressed in minutes.
|
|
722
|
+
* May be fractional. A minimum of 0.5 minutes (i.e. 30 seconds) is always applied.
|
|
723
|
+
* See also RequestValidityMinutes in WebHookRequest.
|
|
724
|
+
*/
|
|
725
|
+
validityMinutes?: number;
|
|
726
|
+
/**
|
|
727
|
+
* Timestamp of creation.
|
|
728
|
+
* Always present when reading/receiving an object,
|
|
729
|
+
* ignored when writing/sending an object.
|
|
730
|
+
*/
|
|
731
|
+
creationTimestamp?: string;
|
|
732
|
+
/**
|
|
733
|
+
* ID of the session that created this object.
|
|
734
|
+
*/
|
|
735
|
+
creationSessionID?: string;
|
|
736
|
+
/**
|
|
737
|
+
* Timestamp of latest change.
|
|
738
|
+
* Always present when reading/receiving an object,
|
|
739
|
+
* ignored when writing/sending an object.
|
|
740
|
+
*/
|
|
741
|
+
lastChangeTimestamp?: string;
|
|
742
|
+
/**
|
|
743
|
+
* ID of the latest session that changed this object.
|
|
744
|
+
*/
|
|
745
|
+
lastChangeSessionID?: string;
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
export type CustomWord = {
|
|
749
|
+
customWordID: string;
|
|
750
|
+
word: string;
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* Definition of the Custom Word, in terms of sums and subtractions of existing words or custom words.
|
|
754
|
+
* The syntax for a Custom Word definition is as follows: word1 [+-] word2 [+-] word3...
|
|
755
|
+
* If the operator is omitted it is assumed to be the last specified from the left, and if no operator has been specified it is assumed to be the sum.
|
|
756
|
+
* E.g.:
|
|
757
|
+
* - alpha beta gamma is equivalent to alpha + beta + gamma
|
|
758
|
+
* - alpha beta - gamma deta is equivalent to alpha + beta - gamma - delta
|
|
759
|
+
*/
|
|
760
|
+
definition: string;
|
|
761
|
+
|
|
762
|
+
creationTimestamp: string;
|
|
763
|
+
creationSessionID: string;
|
|
764
|
+
lastChangeTimestamp: string;
|
|
765
|
+
lastChangeSessionID: string;
|
|
440
766
|
};
|