diff --git a/CHANGELOG.md b/CHANGELOG.md index 2aca38f..3d6c299 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +- [2024-10-15] [Improve editing ability](https://github.com/RubricLab/memory/commit/c4e105be1a85152af88e77c9b41ef061660e7138) - [2024-10-15] [Trigger release](https://github.com/RubricLab/memory/commit/cb0a86ef9092c626da76b2aa74fd497afaeb7601) - [2024-10-15] [Prompt eng and handle errors](https://github.com/RubricLab/memory/commit/fd5267164d4af76b0ec26846cb0f54f906825f82) - [2024-10-15] [Remove user filter](https://github.com/RubricLab/memory/commit/a879c56559e8cbbd82b317ed53d8c49cf0aab98d) diff --git a/package.json b/package.json index 5cefd21..68a89f5 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@rubriclab/memory", "module": "src/index.ts", "main": "src/index.ts", - "version": "0.0.28", + "version": "0.0.29", "private": false, "type": "module", "devDependencies": { diff --git a/src/index.ts b/src/index.ts index 5e1a977..75e0f03 100644 --- a/src/index.ts +++ b/src/index.ts @@ -239,50 +239,43 @@ export class Memory { console.log('relatedFacts', relatedFacts) const { - object: { corrections } + object: { toDelete } } = await generateObject({ - model: openai('gpt-4o-2024-08-06'), + model: openai(this.model), schema: z.object({ - corrections: z + toDelete: z .array( z.object({ - index: z.number(), - newStatement: z.string() + index: z.number() }) ) .optional() }), - prompt: clean`Given the following statements and some new information, please identify any statements which have been strictly falsified. + prompt: clean`Given the following facts and some new information, please identify any statements which have been proven wrong. - Prior statements: - """ + Prior knowledge: ${relatedFacts.map((r, i) => `${i}. ${r.body}`).join('\n')} - """ New information: - """ ${facts.map(f => `- ${f}`).join('\n')} - """ - New information will be appended by default. + Chosen statements will be deleted permanently. Only pick them if certain! + Let's do it. You've got this! 🦾 ` }) - console.log('corrections', corrections) - console.log(`made corrections: ${(performance.now() - start).toFixed(2)}ms`) + console.log('toDelete', toDelete) + console.log(`identified deletions: ${(performance.now() - start).toFixed(2)}ms`) const updates = - corrections?.flatMap(({ index, newStatement }) => { + toDelete?.flatMap(({ index }) => { const outdated = relatedFacts[index] if (!outdated) return [] - return this.db.fact.update({ + return this.db.fact.delete({ where: { id: outdated.id - }, - data: { - body: newStatement } }) }) || []