mem0ai 2.2.3 → 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/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.js
CHANGED
|
@@ -173,9 +173,10 @@ var OllamaEmbedder = class {
|
|
|
173
173
|
} catch (err) {
|
|
174
174
|
logger.error(`Error ensuring model exists: ${err}`);
|
|
175
175
|
}
|
|
176
|
+
const prompt = typeof text === "string" ? text : JSON.stringify(text);
|
|
176
177
|
const response = await this.ollama.embeddings({
|
|
177
178
|
model: this.model,
|
|
178
|
-
prompt
|
|
179
|
+
prompt
|
|
179
180
|
});
|
|
180
181
|
return response.embedding;
|
|
181
182
|
}
|
|
@@ -2403,8 +2404,13 @@ var import_messages = require("@langchain/core/messages");
|
|
|
2403
2404
|
|
|
2404
2405
|
// src/oss/src/prompts/index.ts
|
|
2405
2406
|
var import_zod2 = require("zod");
|
|
2407
|
+
var factItem = import_zod2.z.union([
|
|
2408
|
+
import_zod2.z.string(),
|
|
2409
|
+
import_zod2.z.object({ fact: import_zod2.z.string() }).transform((o) => o.fact),
|
|
2410
|
+
import_zod2.z.object({ text: import_zod2.z.string() }).transform((o) => o.text)
|
|
2411
|
+
]);
|
|
2406
2412
|
var FactRetrievalSchema = import_zod2.z.object({
|
|
2407
|
-
facts: import_zod2.z.array(
|
|
2413
|
+
facts: import_zod2.z.array(factItem).transform((arr) => arr.filter((s) => s.length > 0)).describe("An array of distinct facts extracted from the conversation.")
|
|
2408
2414
|
});
|
|
2409
2415
|
var MemoryUpdateSchema = import_zod2.z.object({
|
|
2410
2416
|
memory: import_zod2.z.array(
|
|
@@ -4712,7 +4718,8 @@ ${parsedMessages}`
|
|
|
4712
4718
|
const cleanResponse = removeCodeBlocks(response);
|
|
4713
4719
|
let facts = [];
|
|
4714
4720
|
try {
|
|
4715
|
-
|
|
4721
|
+
const parsed = FactRetrievalSchema.parse(JSON.parse(cleanResponse));
|
|
4722
|
+
facts = parsed.facts;
|
|
4716
4723
|
} catch (e) {
|
|
4717
4724
|
console.error(
|
|
4718
4725
|
"Failed to parse facts from LLM response:",
|