@memori.ai/memori-api-client 0.9.0 → 0.10.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 +13 -0
- package/dist/engine/memories.d.ts +1 -1
- package/dist/engine/nlp.d.ts +23 -0
- package/dist/memori-api-client.cjs.development.js +69 -0
- 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 +69 -0
- package/dist/memori-api-client.esm.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
- package/src/engine/memories.ts +1 -1
- package/src/engine/nlp.ts +39 -0
- package/src/types.ts +4 -0
package/dist/types.d.ts
CHANGED
|
@@ -542,6 +542,10 @@ export declare type ChatLogLine = {
|
|
|
542
542
|
* Media attached with the Dialog State Machine emission, if present. Empty if the line is inbound.
|
|
543
543
|
*/
|
|
544
544
|
media?: ChatMedium[];
|
|
545
|
+
/**
|
|
546
|
+
* ID of the Memory object referenced in this line.
|
|
547
|
+
*/
|
|
548
|
+
memoryID?: string;
|
|
545
549
|
/**
|
|
546
550
|
* Dialog State Machine context variables after the emission, if present. Empty if the line is inbound.
|
|
547
551
|
*/
|
package/package.json
CHANGED
package/src/engine/memories.ts
CHANGED
|
@@ -33,7 +33,7 @@ export default (apiUrl: string) => ({
|
|
|
33
33
|
sessionId: string,
|
|
34
34
|
from: number,
|
|
35
35
|
howMany: number,
|
|
36
|
-
type?: 'ALL' | 'CONTENTS' | 'DEFAULTS'
|
|
36
|
+
type?: 'ALL' | 'CONTENTS' | 'DEFAULTS' | 'DRAFTS'
|
|
37
37
|
) =>
|
|
38
38
|
apiFetcher(
|
|
39
39
|
`/Memories/${sessionId}/${from}/${howMany}${type ? `/${type}` : ''}`,
|
package/src/engine/nlp.ts
CHANGED
|
@@ -113,4 +113,43 @@ export default (apiUrl: string) => ({
|
|
|
113
113
|
undefinedWords: string[];
|
|
114
114
|
}
|
|
115
115
|
>,
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Tries to suggest the answer for a question, using as much content as possible from the session's associated Memori object.
|
|
119
|
+
* @param {string} sessionId The session ID
|
|
120
|
+
* @param {string} text Text of the sentence.
|
|
121
|
+
*/
|
|
122
|
+
suggestAnswer: async (sessionId: string, text: string) =>
|
|
123
|
+
apiFetcher(`/SuggestAnswer/${sessionId}`, {
|
|
124
|
+
method: 'POST',
|
|
125
|
+
apiUrl,
|
|
126
|
+
body: { text },
|
|
127
|
+
}) as Promise<
|
|
128
|
+
ResponseSpec & {
|
|
129
|
+
/**
|
|
130
|
+
* Suggested answer. May be null if no answer could be suggested.
|
|
131
|
+
*/
|
|
132
|
+
answer: string;
|
|
133
|
+
}
|
|
134
|
+
>,
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Tries to suggest questions for an answer.
|
|
138
|
+
* Differently from ```SuggestAnswer```, no content from the session's associated Memori object is used.
|
|
139
|
+
* @param {string} sessionId The session ID
|
|
140
|
+
* @param {string} text Text of the sentence.
|
|
141
|
+
*/
|
|
142
|
+
suggestQuestions: async (sessionId: string, text: string) =>
|
|
143
|
+
apiFetcher(`/SuggestQuestions/${sessionId}`, {
|
|
144
|
+
method: 'POST',
|
|
145
|
+
apiUrl,
|
|
146
|
+
body: { text },
|
|
147
|
+
}) as Promise<
|
|
148
|
+
ResponseSpec & {
|
|
149
|
+
/**
|
|
150
|
+
* Suggested questions. May be null or empty if no questions could be suggested.
|
|
151
|
+
*/
|
|
152
|
+
questions: string[];
|
|
153
|
+
}
|
|
154
|
+
>,
|
|
116
155
|
});
|
package/src/types.ts
CHANGED
|
@@ -575,6 +575,10 @@ export type ChatLogLine = {
|
|
|
575
575
|
* Media attached with the Dialog State Machine emission, if present. Empty if the line is inbound.
|
|
576
576
|
*/
|
|
577
577
|
media?: ChatMedium[];
|
|
578
|
+
/**
|
|
579
|
+
* ID of the Memory object referenced in this line.
|
|
580
|
+
*/
|
|
581
|
+
memoryID?: string;
|
|
578
582
|
/**
|
|
579
583
|
* Dialog State Machine context variables after the emission, if present. Empty if the line is inbound.
|
|
580
584
|
*/
|