@memori.ai/memori-api-client 2.3.0 → 2.5.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/CHANGELOG.md +14 -0
- package/dist/backend/asset.d.ts +2 -2
- package/dist/backend/asset.js +2 -2
- package/dist/backend/asset.js.map +1 -1
- package/dist/backend/importExport.d.ts +2 -1
- package/dist/backend/importExport.js +9 -0
- package/dist/backend/importExport.js.map +1 -1
- package/dist/backend/memori.js +4 -4
- package/dist/backend/memori.js.map +1 -1
- package/dist/backend.d.ts +6 -4
- package/dist/engine/expertReferences.d.ts +22 -0
- package/dist/engine/expertReferences.js +32 -0
- package/dist/engine/expertReferences.js.map +1 -0
- package/dist/engine/expertReferences.test.d.ts +1 -0
- package/dist/engine/expertReferences.test.js +14 -0
- package/dist/engine/expertReferences.test.js.map +1 -0
- package/dist/engine/memories.d.ts +2 -2
- package/dist/engine/memories.js.map +1 -1
- package/dist/engine.d.ts +42 -4
- package/dist/engine.js +3 -0
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +48 -8
- package/dist/types.d.ts +44 -6
- package/esm/backend/asset.d.ts +2 -2
- package/esm/backend/asset.js +2 -2
- package/esm/backend/asset.js.map +1 -1
- package/esm/backend/importExport.d.ts +2 -1
- package/esm/backend/importExport.js +9 -0
- package/esm/backend/importExport.js.map +1 -1
- package/esm/backend/memori.js +4 -4
- package/esm/backend/memori.js.map +1 -1
- package/esm/backend.d.ts +6 -4
- package/esm/engine/expertReferences.d.ts +22 -0
- package/esm/engine/expertReferences.js +30 -0
- package/esm/engine/expertReferences.js.map +1 -0
- package/esm/engine/expertReferences.test.d.ts +1 -0
- package/esm/engine/expertReferences.test.js +11 -0
- package/esm/engine/expertReferences.test.js.map +1 -0
- package/esm/engine/memories.d.ts +2 -2
- package/esm/engine/memories.js.map +1 -1
- package/esm/engine.d.ts +42 -4
- package/esm/engine.js +3 -0
- package/esm/engine.js.map +1 -1
- package/esm/index.d.ts +48 -8
- package/esm/types.d.ts +44 -6
- package/package.json +1 -1
- package/src/backend/asset.ts +12 -6
- package/src/backend/importExport.ts +25 -0
- package/src/backend/memori.ts +6 -6
- package/src/engine/expertReferences.test.ts +19 -0
- package/src/engine/expertReferences.ts +120 -0
- package/src/engine/memories.ts +4 -4
- package/src/engine.ts +3 -0
- package/src/types.ts +105 -4
package/esm/types.d.ts
CHANGED
|
@@ -49,19 +49,23 @@ export declare type Memori = {
|
|
|
49
49
|
publishedInTheMetaverse?: boolean;
|
|
50
50
|
metaverseEnvironment?: string;
|
|
51
51
|
exposed?: boolean;
|
|
52
|
-
ageRestriction?: number;
|
|
53
|
-
nsfw?: boolean;
|
|
54
52
|
disableR2R3Loop?: boolean;
|
|
55
53
|
disableR4Loop?: boolean;
|
|
56
54
|
disableR5Loop?: boolean;
|
|
55
|
+
ageRestriction?: number;
|
|
56
|
+
nsfw?: boolean;
|
|
57
57
|
enableCompletions?: boolean;
|
|
58
58
|
completionDescription?: string;
|
|
59
|
+
completionProvider?: '-' | 'OpenAI';
|
|
60
|
+
completionProviderConfig?: string;
|
|
61
|
+
enableDeepThought?: boolean;
|
|
62
|
+
disableCompletionMediaExtraction?: boolean;
|
|
59
63
|
chainingMemoriID?: string;
|
|
60
64
|
chainingBaseURL?: string;
|
|
61
65
|
chainingPassword?: string;
|
|
62
|
-
properties?: {
|
|
63
|
-
[key: string]:
|
|
64
|
-
};
|
|
66
|
+
properties?: [{
|
|
67
|
+
[key: string]: string;
|
|
68
|
+
}];
|
|
65
69
|
creationTimestamp?: string;
|
|
66
70
|
lastChangeTimestamp?: string;
|
|
67
71
|
blockedUntil?: string;
|
|
@@ -106,22 +110,30 @@ export declare type User = {
|
|
|
106
110
|
canEditIntegrations?: boolean;
|
|
107
111
|
canEditDynamicIntents?: boolean;
|
|
108
112
|
canEditMemoriChaining?: boolean;
|
|
113
|
+
enableBadges?: boolean;
|
|
109
114
|
monthSessions?: number;
|
|
110
115
|
monthValidSessions?: number;
|
|
111
116
|
maxFreeSessions?: number;
|
|
112
117
|
nonFreeSessionCost?: number;
|
|
113
118
|
monthCompletions?: number;
|
|
114
119
|
maxCompletions?: number;
|
|
120
|
+
monthImportedSize?: number;
|
|
121
|
+
maxImportSize?: number;
|
|
115
122
|
creationTimestamp?: string;
|
|
116
123
|
lastChangeTimestamp?: string;
|
|
117
124
|
referral?: string;
|
|
118
125
|
couponCode?: string;
|
|
126
|
+
defaultCompletionProvider?: '-' | 'OpenAI';
|
|
127
|
+
defaultCompletionProviderConfig?: string;
|
|
119
128
|
paying?: boolean;
|
|
120
129
|
notificationPrefs?: NotificationPrefs[];
|
|
121
130
|
birthDate?: string;
|
|
122
131
|
age?: number;
|
|
123
132
|
tnCAndPPAccepted?: boolean;
|
|
124
133
|
tnCAndPPAcceptanceDate?: string;
|
|
134
|
+
avatarURL?: string;
|
|
135
|
+
avatar3DURL?: string;
|
|
136
|
+
avatar3DURLType?: string;
|
|
125
137
|
};
|
|
126
138
|
export declare type IntegrationResource = {
|
|
127
139
|
name: string;
|
|
@@ -311,6 +323,7 @@ export declare type DialogState = {
|
|
|
311
323
|
confidence?: number;
|
|
312
324
|
confidenceLevel?: 'NONE' | 'LOW' | 'MEDIUM' | 'HIGH';
|
|
313
325
|
emission?: string;
|
|
326
|
+
emitter?: string;
|
|
314
327
|
completion?: boolean;
|
|
315
328
|
continuationEmitted?: boolean;
|
|
316
329
|
lastMatchedMemoryID?: string;
|
|
@@ -424,7 +437,7 @@ export declare type Answer = {
|
|
|
424
437
|
};
|
|
425
438
|
export declare type Memory = {
|
|
426
439
|
memoryID: string;
|
|
427
|
-
memoryType:
|
|
440
|
+
memoryType: 'Question' | 'Story' | 'Default' | 'CompletionDraft' | 'ExpertReference';
|
|
428
441
|
lastRead?: string;
|
|
429
442
|
readOccurrences?: number;
|
|
430
443
|
receiverID?: string;
|
|
@@ -489,6 +502,7 @@ export declare type Message = {
|
|
|
489
502
|
fromUser?: boolean;
|
|
490
503
|
media?: Medium[];
|
|
491
504
|
initial?: boolean;
|
|
505
|
+
emitter?: string;
|
|
492
506
|
timestamp?: string;
|
|
493
507
|
contextVars?: {
|
|
494
508
|
[key: string]: string;
|
|
@@ -504,6 +518,12 @@ export type ConsumptionLog = {
|
|
|
504
518
|
totalSessions: number;
|
|
505
519
|
validSessions: number;
|
|
506
520
|
completions: number;
|
|
521
|
+
promptTokens: {
|
|
522
|
+
[key: string]: number;
|
|
523
|
+
};
|
|
524
|
+
completionTokens: {
|
|
525
|
+
[key: string]: number;
|
|
526
|
+
};
|
|
507
527
|
};
|
|
508
528
|
export type Notification = {
|
|
509
529
|
notificationID: string;
|
|
@@ -609,6 +629,10 @@ export interface TxtSpecs {
|
|
|
609
629
|
sourceAttachmentTitle?: string;
|
|
610
630
|
questionsGenerationInstructions?: string;
|
|
611
631
|
}
|
|
632
|
+
export interface JSONLSpecs {
|
|
633
|
+
platform?: string;
|
|
634
|
+
includeInstructions?: boolean;
|
|
635
|
+
}
|
|
612
636
|
export interface ImportParams {
|
|
613
637
|
forceImport?: boolean;
|
|
614
638
|
csvSpecs?: CsvSpecs;
|
|
@@ -642,6 +666,7 @@ export interface ImportResponse {
|
|
|
642
666
|
end?: string;
|
|
643
667
|
eta?: number;
|
|
644
668
|
importedMemories?: number;
|
|
669
|
+
importWarningsCount?: number;
|
|
645
670
|
importWarnings?: ImportWarning[];
|
|
646
671
|
}
|
|
647
672
|
export interface Badge {
|
|
@@ -656,3 +681,16 @@ export interface Badge {
|
|
|
656
681
|
issuerEmail?: string;
|
|
657
682
|
issuerURL?: string;
|
|
658
683
|
}
|
|
684
|
+
export interface ExpertReference {
|
|
685
|
+
expertID: string;
|
|
686
|
+
name: string;
|
|
687
|
+
description: string;
|
|
688
|
+
default?: boolean;
|
|
689
|
+
expertMemoriID: string;
|
|
690
|
+
expertPassword?: string;
|
|
691
|
+
expertBaseURL: string;
|
|
692
|
+
creationTimestamp?: string;
|
|
693
|
+
creationSessionID?: string;
|
|
694
|
+
lastChangeTimestamp?: string;
|
|
695
|
+
lastChangeSessionID?: string;
|
|
696
|
+
}
|
package/package.json
CHANGED
package/src/backend/asset.ts
CHANGED
|
@@ -5,17 +5,23 @@ export default (apiUrl: string) => ({
|
|
|
5
5
|
/**
|
|
6
6
|
* URL to upload a file creating a new Asset object to access it.
|
|
7
7
|
* @param {string} authToken - The login token
|
|
8
|
-
* @param {string} memoriID - The memori ID
|
|
8
|
+
* @param {string=} memoriID - The memori ID
|
|
9
9
|
* @param {string=} memoryID - The memory ID
|
|
10
10
|
* @returns The URL to upload a file
|
|
11
11
|
*/
|
|
12
|
-
getUploadAssetURL: (
|
|
13
|
-
|
|
12
|
+
getUploadAssetURL: (
|
|
13
|
+
authToken: string,
|
|
14
|
+
memoriID?: string,
|
|
15
|
+
memoryID?: string
|
|
16
|
+
) =>
|
|
17
|
+
`${apiUrl}/Asset/${authToken}${memoriID ? `/${memoriID}` : ''}${
|
|
18
|
+
memoryID ? `/${memoryID}` : ''
|
|
19
|
+
}`,
|
|
14
20
|
|
|
15
21
|
/**
|
|
16
22
|
* Uploads a file and creates a new Asset object to access it.
|
|
17
23
|
* @param {string} authToken - The login token
|
|
18
|
-
* @param {string} memoriID - The memori ID
|
|
24
|
+
* @param {string=} memoriID - The memori ID
|
|
19
25
|
* @param {string=} memoryID - The memory ID
|
|
20
26
|
* @returns Response of an Upload Asset request.
|
|
21
27
|
*/
|
|
@@ -23,7 +29,7 @@ export default (apiUrl: string) => ({
|
|
|
23
29
|
fileName: string,
|
|
24
30
|
fileUrl: string,
|
|
25
31
|
authToken: string,
|
|
26
|
-
memoriID
|
|
32
|
+
memoriID?: string,
|
|
27
33
|
memoryID?: string
|
|
28
34
|
) => {
|
|
29
35
|
const data = new FormData();
|
|
@@ -33,7 +39,7 @@ export default (apiUrl: string) => ({
|
|
|
33
39
|
data.append(fileName, fileBlob, fileName);
|
|
34
40
|
|
|
35
41
|
const upload = await fetch(
|
|
36
|
-
`${apiUrl}/Asset/${authToken}
|
|
42
|
+
`${apiUrl}/Asset/${authToken}${memoriID ? `/${memoriID}` : ''}${
|
|
37
43
|
memoryID ? `/${memoryID}` : ''
|
|
38
44
|
}`,
|
|
39
45
|
{
|
|
@@ -3,6 +3,7 @@ import type {
|
|
|
3
3
|
ImportParams,
|
|
4
4
|
ImportResponse,
|
|
5
5
|
CsvSpecs,
|
|
6
|
+
JSONLSpecs,
|
|
6
7
|
} from '../types';
|
|
7
8
|
import { apiFetcher } from '../apiFetcher';
|
|
8
9
|
|
|
@@ -132,4 +133,28 @@ export default (apiUrl: string) => ({
|
|
|
132
133
|
},
|
|
133
134
|
text: true,
|
|
134
135
|
}) as Promise<string>,
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Exports contents of a Memori object to a JSONL file, suitable for fine-tuning with generative AI platforms.
|
|
139
|
+
* @param {string} authToken - The login token.
|
|
140
|
+
* @param {string} memoriID - The ID of the Memori object.
|
|
141
|
+
* @param {JSONLSpecs} jsonlSpecs - Specifications for requests involving import/export of JSONL contents.
|
|
142
|
+
* @param {string=} password - Memori password, if its privacy model is set to Secret.
|
|
143
|
+
* @returns The JSONL file content
|
|
144
|
+
*/
|
|
145
|
+
exportJSONL: async (
|
|
146
|
+
authToken: string,
|
|
147
|
+
memoriID: string,
|
|
148
|
+
jsonlSpecs: JSONLSpecs,
|
|
149
|
+
password?: string
|
|
150
|
+
) =>
|
|
151
|
+
apiFetcher(`/ImportExport/ExportJSONL/${authToken}/${memoriID}`, {
|
|
152
|
+
apiUrl,
|
|
153
|
+
method: 'POST',
|
|
154
|
+
body: {
|
|
155
|
+
jsonlSpecs,
|
|
156
|
+
password,
|
|
157
|
+
},
|
|
158
|
+
text: true,
|
|
159
|
+
}) as Promise<string>,
|
|
135
160
|
});
|
package/src/backend/memori.ts
CHANGED
|
@@ -8,7 +8,7 @@ export default (apiUrl: string) => ({
|
|
|
8
8
|
* @returns A list of Memori objects
|
|
9
9
|
*/
|
|
10
10
|
getTenantPublicMemoriList: (tenant: string) =>
|
|
11
|
-
apiFetcher(`/TenantPublicMemori/${
|
|
11
|
+
apiFetcher(`/TenantPublicMemori/${encodeURIComponent(tenant)}`, {
|
|
12
12
|
apiUrl,
|
|
13
13
|
}) as Promise<
|
|
14
14
|
ResponseSpec & {
|
|
@@ -22,7 +22,7 @@ export default (apiUrl: string) => ({
|
|
|
22
22
|
* @returns A list of Memori objects
|
|
23
23
|
*/
|
|
24
24
|
getTenantMetaverseMemoriList: (tenant: string) =>
|
|
25
|
-
apiFetcher(`/TenantMetaverseMemori/${
|
|
25
|
+
apiFetcher(`/TenantMetaverseMemori/${encodeURIComponent(tenant)}`, {
|
|
26
26
|
apiUrl,
|
|
27
27
|
}) as Promise<
|
|
28
28
|
ResponseSpec & {
|
|
@@ -142,7 +142,7 @@ export default (apiUrl: string) => ({
|
|
|
142
142
|
* @returns A list of Memori categories
|
|
143
143
|
*/
|
|
144
144
|
getTenantCategories: (tenant: string) =>
|
|
145
|
-
apiFetcher(`/TenantMemoriCategories/${
|
|
145
|
+
apiFetcher(`/TenantMemoriCategories/${encodeURIComponent(tenant)}`, {
|
|
146
146
|
apiUrl,
|
|
147
147
|
}) as Promise<
|
|
148
148
|
ResponseSpec & {
|
|
@@ -253,9 +253,9 @@ export default (apiUrl: string) => ({
|
|
|
253
253
|
authToken?: string
|
|
254
254
|
) =>
|
|
255
255
|
apiFetcher(
|
|
256
|
-
`/Memori/${
|
|
257
|
-
|
|
258
|
-
)}/${authToken ?? ''}`,
|
|
256
|
+
`/Memori/${encodeURIComponent(tenant)}/${encodeURIComponent(
|
|
257
|
+
userName
|
|
258
|
+
)}/${encodeURIComponent(memoriName)}/${authToken ?? ''}`,
|
|
259
259
|
{
|
|
260
260
|
apiUrl,
|
|
261
261
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import memori from '../index';
|
|
2
|
+
|
|
3
|
+
const client = memori('https://backend.memori.ai');
|
|
4
|
+
|
|
5
|
+
describe('engine/expertReferences api', () => {
|
|
6
|
+
it('works on expertReferences apis', async () => {
|
|
7
|
+
expect(
|
|
8
|
+
await client.expertReferences.getExpertReferences(
|
|
9
|
+
'768b9654-e781-4c3c-81fa-ae1529d1bfbe'
|
|
10
|
+
)
|
|
11
|
+
).not.toBeNull();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('works on chatLogs apis with shorthand version', async () => {
|
|
15
|
+
expect(
|
|
16
|
+
await client.getExpertReferences('768b9654-e781-4c3c-81fa-ae1529d1bfbe')
|
|
17
|
+
).not.toBeNull();
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { ResponseSpec, ExpertReference } from '../types';
|
|
2
|
+
import { apiFetcher } from '../apiFetcher';
|
|
3
|
+
|
|
4
|
+
/************************
|
|
5
|
+
* *
|
|
6
|
+
* Expert References *
|
|
7
|
+
* *
|
|
8
|
+
************************/
|
|
9
|
+
|
|
10
|
+
export default (apiUrl: string) => ({
|
|
11
|
+
/**
|
|
12
|
+
* Lists all Expert Reference objects.
|
|
13
|
+
* @param {string} sessionId The session ID
|
|
14
|
+
*/
|
|
15
|
+
getExpertReferences: async (sessionId: string) =>
|
|
16
|
+
apiFetcher(`/ExpertReferences/${sessionId}`, {
|
|
17
|
+
method: 'GET',
|
|
18
|
+
apiUrl,
|
|
19
|
+
}) as Promise<
|
|
20
|
+
ResponseSpec & {
|
|
21
|
+
/**
|
|
22
|
+
* Total number of Expert Reference objects.
|
|
23
|
+
*/
|
|
24
|
+
count: number;
|
|
25
|
+
/**
|
|
26
|
+
* List of Expert Reference objects. May be empty.
|
|
27
|
+
*/
|
|
28
|
+
experts: ExpertReference[];
|
|
29
|
+
}
|
|
30
|
+
>,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Lists Expert Reference objects with pagination.
|
|
34
|
+
* @param {string} sessionId The session ID
|
|
35
|
+
* @param {number} from The 0-based index of the first Expert Reference object to list
|
|
36
|
+
* @param {number} howMany The number of the Expert Reference objects to list
|
|
37
|
+
*/
|
|
38
|
+
getExpertReferencesPaginated: async (
|
|
39
|
+
sessionId: string,
|
|
40
|
+
from: number,
|
|
41
|
+
howMany: number
|
|
42
|
+
) =>
|
|
43
|
+
apiFetcher(`/ExpertReferences/${sessionId}/${from}/${howMany}`, {
|
|
44
|
+
method: 'GET',
|
|
45
|
+
apiUrl,
|
|
46
|
+
}) as Promise<
|
|
47
|
+
ResponseSpec & {
|
|
48
|
+
/**
|
|
49
|
+
* Total number of Expert Reference objects.
|
|
50
|
+
*/
|
|
51
|
+
count: number;
|
|
52
|
+
/**
|
|
53
|
+
* List of Expert Reference objects. May be empty.
|
|
54
|
+
*/
|
|
55
|
+
experts: ExpertReference[];
|
|
56
|
+
}
|
|
57
|
+
>,
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Gets the details of an Expert Reference object.
|
|
61
|
+
* @param {string} sessionId The session ID
|
|
62
|
+
* @param {string} expertID The Expert Reference object ID
|
|
63
|
+
*/
|
|
64
|
+
getExpertReference: async (sessionId: string, expertID: string) =>
|
|
65
|
+
apiFetcher(`/ExpertReference/${sessionId}/${expertID}`, {
|
|
66
|
+
method: 'GET',
|
|
67
|
+
apiUrl,
|
|
68
|
+
}) as Promise<
|
|
69
|
+
ResponseSpec & {
|
|
70
|
+
expert: ExpertReference;
|
|
71
|
+
}
|
|
72
|
+
>,
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Updates an existing Expert Reference object.
|
|
76
|
+
* @param {string} sessionId The session ID
|
|
77
|
+
* @param {ExpertReference} expertReference The Expert Reference object
|
|
78
|
+
*/
|
|
79
|
+
updateExpertReference: async (
|
|
80
|
+
sessionId: string,
|
|
81
|
+
expertReference: Partial<ExpertReference> & {
|
|
82
|
+
expertID: ExpertReference['expertID'];
|
|
83
|
+
}
|
|
84
|
+
) =>
|
|
85
|
+
apiFetcher(`/ExpertReference/${sessionId}/${expertReference.expertID}`, {
|
|
86
|
+
method: 'PATCH',
|
|
87
|
+
apiUrl,
|
|
88
|
+
body: expertReference,
|
|
89
|
+
}) as Promise<ResponseSpec>,
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Adds a new Expert Reference object.
|
|
93
|
+
* @param {string} sessionId The session ID
|
|
94
|
+
* @param {ExpertReference} expertReference The Expert Reference object
|
|
95
|
+
*/
|
|
96
|
+
createExpertReference: async (
|
|
97
|
+
sessionId: string,
|
|
98
|
+
expertReference: Omit<Partial<ExpertReference>, 'expertID'>
|
|
99
|
+
) =>
|
|
100
|
+
apiFetcher(`/ExpertReference/${sessionId}`, {
|
|
101
|
+
method: 'POST',
|
|
102
|
+
apiUrl,
|
|
103
|
+
body: expertReference,
|
|
104
|
+
}) as Promise<
|
|
105
|
+
ResponseSpec & {
|
|
106
|
+
expertID: ExpertReference['expertID'];
|
|
107
|
+
}
|
|
108
|
+
>,
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Removes an existing Expert Reference object.
|
|
112
|
+
* @param {string} sessionId The session ID
|
|
113
|
+
* @param {string} expertID The Expert Reference object ID
|
|
114
|
+
*/
|
|
115
|
+
deleteExpertReference: async (sessionId: string, expertID: string) =>
|
|
116
|
+
apiFetcher(`/ExpertReference/${sessionId}/${expertID}`, {
|
|
117
|
+
method: 'DELETE',
|
|
118
|
+
apiUrl,
|
|
119
|
+
}) as Promise<ResponseSpec>,
|
|
120
|
+
});
|
package/src/engine/memories.ts
CHANGED
|
@@ -11,11 +11,11 @@ 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
|
+
* @param {string=} type Optional type of the Memory objects to list: ALL, CONTENTS, DEFAULTS, DRAFTS, EXPERT_REFERENCES
|
|
15
15
|
*/
|
|
16
16
|
getMemories: async (
|
|
17
17
|
sessionId: string,
|
|
18
|
-
type?: 'ALL' | 'CONTENTS' | 'DEFAULTS' | 'DRAFTS'
|
|
18
|
+
type?: 'ALL' | 'CONTENTS' | 'DEFAULTS' | 'DRAFTS' | 'EXPERT_REFERENCES'
|
|
19
19
|
) =>
|
|
20
20
|
apiFetcher(`/Memories/${sessionId}${type ? `/${type}` : ''}`, {
|
|
21
21
|
method: 'GET',
|
|
@@ -31,13 +31,13 @@ export default (apiUrl: string) => ({
|
|
|
31
31
|
* @param {string} sessionId The session ID
|
|
32
32
|
* @param {number} from The starting index
|
|
33
33
|
* @param {number} howMany The number of items to return
|
|
34
|
-
* @param {string=} type Optional type of the Memory objects to list: ALL, CONTENTS, DEFAULTS, DRAFTS
|
|
34
|
+
* @param {string=} type Optional type of the Memory objects to list: ALL, CONTENTS, DEFAULTS, DRAFTS, EXPERT_REFERENCES
|
|
35
35
|
*/
|
|
36
36
|
getMemoriesPaginated: async (
|
|
37
37
|
sessionId: string,
|
|
38
38
|
from: number,
|
|
39
39
|
howMany: number,
|
|
40
|
-
type?: 'ALL' | 'CONTENTS' | 'DEFAULTS' | 'DRAFTS'
|
|
40
|
+
type?: 'ALL' | 'CONTENTS' | 'DEFAULTS' | 'DRAFTS' | 'EXPERT_REFERENCES'
|
|
41
41
|
) =>
|
|
42
42
|
apiFetcher(
|
|
43
43
|
`/Memories/${sessionId}/${from}/${howMany}${type ? `/${type}` : ''}`,
|
package/src/engine.ts
CHANGED
|
@@ -14,6 +14,7 @@ import unansweredQuestions from './engine/unansweredQuestions';
|
|
|
14
14
|
import contextVars from './engine/contextVars';
|
|
15
15
|
import customDictionary from './engine/customDictionary';
|
|
16
16
|
import chatLogs from './engine/chatLogs';
|
|
17
|
+
import expertReferences from './engine/expertReferences';
|
|
17
18
|
|
|
18
19
|
export default (apiUrl: string) => ({
|
|
19
20
|
correlationPairs: correlationPairs(apiUrl),
|
|
@@ -48,4 +49,6 @@ export default (apiUrl: string) => ({
|
|
|
48
49
|
...customDictionary(apiUrl),
|
|
49
50
|
chatLogs: chatLogs(apiUrl),
|
|
50
51
|
...chatLogs(apiUrl),
|
|
52
|
+
expertReferences: expertReferences(apiUrl),
|
|
53
|
+
...expertReferences(apiUrl),
|
|
51
54
|
});
|
package/src/types.ts
CHANGED
|
@@ -60,17 +60,30 @@ export declare type Memori = {
|
|
|
60
60
|
publishedInTheMetaverse?: boolean;
|
|
61
61
|
metaverseEnvironment?: string;
|
|
62
62
|
exposed?: boolean;
|
|
63
|
-
ageRestriction?: number;
|
|
64
|
-
nsfw?: boolean;
|
|
65
63
|
disableR2R3Loop?: boolean;
|
|
66
64
|
disableR4Loop?: boolean;
|
|
67
65
|
disableR5Loop?: boolean;
|
|
66
|
+
ageRestriction?: number;
|
|
67
|
+
nsfw?: boolean;
|
|
68
68
|
enableCompletions?: boolean;
|
|
69
69
|
completionDescription?: string;
|
|
70
|
+
completionProvider?: '-' | 'OpenAI';
|
|
71
|
+
/**
|
|
72
|
+
* Format: chiave1:valore1|chiave2:valore2|...|chiaveN:valoreN
|
|
73
|
+
*
|
|
74
|
+
* OpenAI accetta i seguenti:
|
|
75
|
+
* - APIKey è l'API key
|
|
76
|
+
* - Model è il nome del modello: gpt-3.5-turbo, gpt-4 ecc.
|
|
77
|
+
* - MaxTokens è il numero massimo di token in output
|
|
78
|
+
* - Temperature è la temperature
|
|
79
|
+
*/
|
|
80
|
+
completionProviderConfig?: string;
|
|
81
|
+
enableDeepThought?: boolean;
|
|
82
|
+
disableCompletionMediaExtraction?: boolean;
|
|
70
83
|
chainingMemoriID?: string;
|
|
71
84
|
chainingBaseURL?: string;
|
|
72
85
|
chainingPassword?: string;
|
|
73
|
-
properties?: { [key: string]:
|
|
86
|
+
properties?: [{ [key: string]: string }];
|
|
74
87
|
creationTimestamp?: string;
|
|
75
88
|
lastChangeTimestamp?: string;
|
|
76
89
|
blockedUntil?: string;
|
|
@@ -138,22 +151,39 @@ export declare type User = {
|
|
|
138
151
|
canEditIntegrations?: boolean;
|
|
139
152
|
canEditDynamicIntents?: boolean;
|
|
140
153
|
canEditMemoriChaining?: boolean;
|
|
154
|
+
enableBadges?: boolean;
|
|
141
155
|
monthSessions?: number;
|
|
142
156
|
monthValidSessions?: number;
|
|
143
157
|
maxFreeSessions?: number;
|
|
144
158
|
nonFreeSessionCost?: number;
|
|
145
159
|
monthCompletions?: number;
|
|
146
160
|
maxCompletions?: number;
|
|
161
|
+
monthImportedSize?: number;
|
|
162
|
+
maxImportSize?: number;
|
|
147
163
|
creationTimestamp?: string;
|
|
148
164
|
lastChangeTimestamp?: string;
|
|
149
165
|
referral?: string;
|
|
150
166
|
couponCode?: string;
|
|
167
|
+
defaultCompletionProvider?: '-' | 'OpenAI';
|
|
168
|
+
/**
|
|
169
|
+
* Format: chiave1:valore1|chiave2:valore2|...|chiaveN:valoreN
|
|
170
|
+
*
|
|
171
|
+
* OpenAI accetta i seguenti:
|
|
172
|
+
* - APIKey è l'API key
|
|
173
|
+
* - Model è il nome del modello: gpt-3.5-turbo, gpt-4 ecc.
|
|
174
|
+
* - MaxTokens è il numero massimo di token in output
|
|
175
|
+
* - Temperature è la temperature
|
|
176
|
+
*/
|
|
177
|
+
defaultCompletionProviderConfig?: string;
|
|
151
178
|
paying?: boolean;
|
|
152
179
|
notificationPrefs?: NotificationPrefs[];
|
|
153
180
|
birthDate?: string;
|
|
154
181
|
age?: number;
|
|
155
182
|
tnCAndPPAccepted?: boolean;
|
|
156
183
|
tnCAndPPAcceptanceDate?: string;
|
|
184
|
+
avatarURL?: string;
|
|
185
|
+
avatar3DURL?: string;
|
|
186
|
+
avatar3DURLType?: string;
|
|
157
187
|
};
|
|
158
188
|
|
|
159
189
|
export declare type IntegrationResource = {
|
|
@@ -371,6 +401,7 @@ export declare type DialogState = {
|
|
|
371
401
|
confidence?: number;
|
|
372
402
|
confidenceLevel?: 'NONE' | 'LOW' | 'MEDIUM' | 'HIGH';
|
|
373
403
|
emission?: string;
|
|
404
|
+
emitter?: string;
|
|
374
405
|
completion?: boolean;
|
|
375
406
|
continuationEmitted?: boolean;
|
|
376
407
|
lastMatchedMemoryID?: string;
|
|
@@ -490,7 +521,12 @@ export declare type Answer = {
|
|
|
490
521
|
|
|
491
522
|
export declare type Memory = {
|
|
492
523
|
memoryID: string;
|
|
493
|
-
memoryType:
|
|
524
|
+
memoryType:
|
|
525
|
+
| 'Question'
|
|
526
|
+
| 'Story'
|
|
527
|
+
| 'Default'
|
|
528
|
+
| 'CompletionDraft'
|
|
529
|
+
| 'ExpertReference';
|
|
494
530
|
lastRead?: string;
|
|
495
531
|
readOccurrences?: number;
|
|
496
532
|
receiverID?: string;
|
|
@@ -554,6 +590,7 @@ export declare type Message = {
|
|
|
554
590
|
fromUser?: boolean;
|
|
555
591
|
media?: Medium[];
|
|
556
592
|
initial?: boolean;
|
|
593
|
+
emitter?: string;
|
|
557
594
|
timestamp?: string;
|
|
558
595
|
contextVars?: { [key: string]: string };
|
|
559
596
|
};
|
|
@@ -568,6 +605,8 @@ export type ConsumptionLog = {
|
|
|
568
605
|
totalSessions: number;
|
|
569
606
|
validSessions: number;
|
|
570
607
|
completions: number;
|
|
608
|
+
promptTokens: { [key: string]: number };
|
|
609
|
+
completionTokens: { [key: string]: number };
|
|
571
610
|
};
|
|
572
611
|
|
|
573
612
|
export type Notification = {
|
|
@@ -907,6 +946,21 @@ export interface TxtSpecs {
|
|
|
907
946
|
questionsGenerationInstructions?: string;
|
|
908
947
|
}
|
|
909
948
|
|
|
949
|
+
export interface JSONLSpecs {
|
|
950
|
+
/**
|
|
951
|
+
* @type {string=}
|
|
952
|
+
* Name of the platform for which the JSONL is intended.
|
|
953
|
+
* Currently supported values are:
|
|
954
|
+
* - OpenAI: the OpenAI platform
|
|
955
|
+
*/
|
|
956
|
+
platform?: string;
|
|
957
|
+
/**
|
|
958
|
+
* @type {boolean=}
|
|
959
|
+
* If True the JSONL includes the instructions for the generative AI, i.e. the "System" role of each message. Used only in Export operations.
|
|
960
|
+
*/
|
|
961
|
+
includeInstructions?: boolean;
|
|
962
|
+
}
|
|
963
|
+
|
|
910
964
|
export interface ImportParams {
|
|
911
965
|
forceImport?: boolean;
|
|
912
966
|
csvSpecs?: CsvSpecs;
|
|
@@ -1006,6 +1060,10 @@ export interface ImportResponse {
|
|
|
1006
1060
|
* Number of Imported Memory objects so far.
|
|
1007
1061
|
*/
|
|
1008
1062
|
importedMemories?: number;
|
|
1063
|
+
/**
|
|
1064
|
+
* Number of Import Warning objects
|
|
1065
|
+
*/
|
|
1066
|
+
importWarningsCount?: number;
|
|
1009
1067
|
/**
|
|
1010
1068
|
* List of Import Warning objects. May be empty.
|
|
1011
1069
|
*/
|
|
@@ -1024,3 +1082,46 @@ export interface Badge {
|
|
|
1024
1082
|
issuerEmail?: string;
|
|
1025
1083
|
issuerURL?: string;
|
|
1026
1084
|
}
|
|
1085
|
+
|
|
1086
|
+
export interface ExpertReference {
|
|
1087
|
+
/**
|
|
1088
|
+
* @type {string}
|
|
1089
|
+
* Expert Reference object ID. Returned during Get operations. Ignored in other cases.
|
|
1090
|
+
*/
|
|
1091
|
+
expertID: string;
|
|
1092
|
+
/**
|
|
1093
|
+
* @type {string}
|
|
1094
|
+
* Name of the expert. Returned during Get operations. Required during Add operations. Optional during Update operations.
|
|
1095
|
+
*/
|
|
1096
|
+
name: string;
|
|
1097
|
+
/**
|
|
1098
|
+
* @type {string}
|
|
1099
|
+
* Description of the expert, i.e. a list of the expert's skills and knowledge. Returned during Get operations. Required during Add operations. Optional during Update operations.
|
|
1100
|
+
*/
|
|
1101
|
+
description: string;
|
|
1102
|
+
/**
|
|
1103
|
+
* @type {boolean}
|
|
1104
|
+
* If True, this expert is used when no other expert is competent for the current question. Returned during Get operations. Optional during Add operations. Optional during Update operations.
|
|
1105
|
+
*/
|
|
1106
|
+
default?: boolean;
|
|
1107
|
+
/**
|
|
1108
|
+
* @type {string}
|
|
1109
|
+
* ID of the expert Memori. Returned during Get operations. Required during Add operations. Optional during Update operations.
|
|
1110
|
+
* NOTE: engine memroi ID
|
|
1111
|
+
*/
|
|
1112
|
+
expertMemoriID: string;
|
|
1113
|
+
/**
|
|
1114
|
+
* @type {string=}
|
|
1115
|
+
* Password of the expert Memori. Required if the chained Memori is private or secret. Optional during Add operations and Update operations. Ignore in other cases.
|
|
1116
|
+
*/
|
|
1117
|
+
expertPassword?: string;
|
|
1118
|
+
/**
|
|
1119
|
+
* @type {string}
|
|
1120
|
+
* Base URL of a chained Memori, typically https://engine.memori.ai/. Returned during Get operations. Required during Add operations. Optional during Update operations.
|
|
1121
|
+
*/
|
|
1122
|
+
expertBaseURL: string;
|
|
1123
|
+
creationTimestamp?: string;
|
|
1124
|
+
creationSessionID?: string;
|
|
1125
|
+
lastChangeTimestamp?: string;
|
|
1126
|
+
lastChangeSessionID?: string;
|
|
1127
|
+
}
|