mem0ai 2.2.2 → 2.2.4
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/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -7
- package/dist/index.mjs.map +1 -1
- package/dist/oss/index.js +10 -3
- package/dist/oss/index.js.map +1 -1
- package/dist/oss/index.mjs +10 -3
- package/dist/oss/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/oss/index.mjs
CHANGED
|
@@ -112,9 +112,10 @@ var OllamaEmbedder = class {
|
|
|
112
112
|
} catch (err) {
|
|
113
113
|
logger.error(`Error ensuring model exists: ${err}`);
|
|
114
114
|
}
|
|
115
|
+
const prompt = typeof text === "string" ? text : JSON.stringify(text);
|
|
115
116
|
const response = await this.ollama.embeddings({
|
|
116
117
|
model: this.model,
|
|
117
|
-
prompt
|
|
118
|
+
prompt
|
|
118
119
|
});
|
|
119
120
|
return response.embedding;
|
|
120
121
|
}
|
|
@@ -2346,8 +2347,13 @@ import {
|
|
|
2346
2347
|
|
|
2347
2348
|
// src/oss/src/prompts/index.ts
|
|
2348
2349
|
import { z as z2 } from "zod";
|
|
2350
|
+
var factItem = z2.union([
|
|
2351
|
+
z2.string(),
|
|
2352
|
+
z2.object({ fact: z2.string() }).transform((o) => o.fact),
|
|
2353
|
+
z2.object({ text: z2.string() }).transform((o) => o.text)
|
|
2354
|
+
]);
|
|
2349
2355
|
var FactRetrievalSchema = z2.object({
|
|
2350
|
-
facts: z2.array(
|
|
2356
|
+
facts: z2.array(factItem).transform((arr) => arr.filter((s) => s.length > 0)).describe("An array of distinct facts extracted from the conversation.")
|
|
2351
2357
|
});
|
|
2352
2358
|
var MemoryUpdateSchema = z2.object({
|
|
2353
2359
|
memory: z2.array(
|
|
@@ -4659,7 +4665,8 @@ ${parsedMessages}`
|
|
|
4659
4665
|
const cleanResponse = removeCodeBlocks(response);
|
|
4660
4666
|
let facts = [];
|
|
4661
4667
|
try {
|
|
4662
|
-
|
|
4668
|
+
const parsed = FactRetrievalSchema.parse(JSON.parse(cleanResponse));
|
|
4669
|
+
facts = parsed.facts;
|
|
4663
4670
|
} catch (e) {
|
|
4664
4671
|
console.error(
|
|
4665
4672
|
"Failed to parse facts from LLM response:",
|