Skip to content

Commit

Permalink
Decouple extraction and save
Browse files Browse the repository at this point in the history
  • Loading branch information
tedspare committed Oct 10, 2024
1 parent da7e56e commit dce59e1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- [2024-10-10] [Decouple extraction and save](https://github.com/RubricLab/memory/commit/d5fd7c08eff9458b9775ef439b480cd38922759d)
- [2024-10-09] [Add multi-turn examples](https://github.com/RubricLab/memory/commit/a0e32260e510a3ef1312030fcb5e2685ac2bb300)
- [2024-10-09] [Scaffold multi-turn evals](https://github.com/RubricLab/memory/commit/ecb5531acef6a924b81684660150eeb71d93e704)
- [2024-10-09] [Add TSConfig](https://github.com/RubricLab/memory/commit/ed521824cc492e46adff6d38a994e18cc08166b2)
Expand Down
6 changes: 4 additions & 2 deletions env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import z from 'zod'

export default createEnv({
runtimeEnv: {
OPENAI_API_KEY: process.env.OPENAI_API_KEY
OPENAI_API_KEY: process.env.OPENAI_API_KEY,
DATABASE_URL: process.env.DATABASE_URL
},
server: {
OPENAI_API_KEY: z.string().min(1)
OPENAI_API_KEY: z.string().min(1),
DATABASE_URL: z.string().min(1)
}
})
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@rubriclab/memory",
"module": "src/index.ts",
"version": "0.0.11",
"version": "0.0.12",
"private": false,
"type": "module",
"devDependencies": {
Expand Down
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ export class Memory {
"${content}"`
})

return { facts }
}

async insert({ content }: { content: string }) {
const { facts } = await this.extract({ content })

for await (const fact of facts) {
const { subject, relation, object } = fact

Expand All @@ -96,7 +102,5 @@ export class Memory {

const priorFacts = this.db.query('select * from facts').all()
console.log({ priorFacts })

return { facts }
}
}

0 comments on commit dce59e1

Please sign in to comment.