-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
479 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"name": "@agent-smith/smem", | ||
"version": "0.0.1", | ||
"description": "An api to create human friendly agents: the semantic memory", | ||
"repository": "https://github.com/synw/agent-smith", | ||
"scripts": { | ||
"buildrl": "rm -rf dist/* && rollup -c", | ||
"build": "rm -rf dist/* && tsc", | ||
"test": "jest --coverage", | ||
"docs": "typedoc --entryPointStrategy expand" | ||
}, | ||
"dependencies": { | ||
"@xenova/transformers": "^2.15.1", | ||
"apache-arrow": "^15.0.1", | ||
"vectordb": "^0.4.12" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-node-resolve": "^15.2.3", | ||
"@rollup/plugin-terser": "^0.4.4", | ||
"@rollup/plugin-typescript": "^11.1.6", | ||
"@types/node": "^20.11.20", | ||
"markdown-it-replace-link": "^1.2.1", | ||
"rollup": "^4.12.0", | ||
"tslib": "^2.6.2", | ||
"typedoc": "^0.25.8", | ||
"typedoc-plugin-markdown": "^3.17.1", | ||
"typedoc-plugin-rename-defaults": "^0.7.0", | ||
"typescript": "^5.3.3" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"module": "./dist/main.js", | ||
"types": "./dist/main.d.ts", | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
"import": "./dist/main.js" | ||
} | ||
}, | ||
"publishConfig": { | ||
"access": "public", | ||
"registry": "https://registry.npmjs.org/" | ||
}, | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import typescript from '@rollup/plugin-typescript'; | ||
import terser from '@rollup/plugin-terser'; | ||
|
||
//const isProduction = !process.env.ROLLUP_WATCH; | ||
|
||
export default { | ||
input: 'src/main.ts', | ||
output: [ | ||
{ | ||
file: 'dist/api.es.js', | ||
format: 'esm' | ||
}, | ||
{ | ||
file: 'dist/api.min.js', | ||
format: 'iife', | ||
name: '$agentbrain', | ||
plugins: [terser()] | ||
}], | ||
plugins: [ | ||
typescript(), | ||
resolve({ | ||
jsnext: true, | ||
main: true, | ||
browser: true, | ||
}), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { useSmem } from "./useSmem.js"; | ||
import { useSnode } from "./useSnode.js"; | ||
import { | ||
SmemNodeFieldSchema, | ||
SmemNodeSchema, | ||
SmemNode, | ||
Smem, | ||
} from "./smeminterfaces.js" | ||
|
||
export { | ||
useSmem, | ||
useSnode, | ||
SmemNodeFieldSchema, | ||
SmemNodeSchema, | ||
SmemNode, | ||
Smem, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Connection, Table } from "vectordb"; | ||
import { Schema } from "apache-arrow"; | ||
|
||
interface SmemNodeFieldSchema { | ||
name: string; | ||
type: FieldDataType, | ||
nullable?: boolean; | ||
} | ||
|
||
interface SmemNode { | ||
table: Table; | ||
vectorSourceCol: string; | ||
open: () => Promise<Table>; | ||
add: (data: Array<Record<string, unknown>>) => Promise<void>; | ||
addRaw: (data: Array<Record<string, unknown>>) => Promise<void>; | ||
upsert: (data: Array<Record<string, unknown>>, idCol?: string) => Promise<void>; | ||
upsertRaw: (data: Array<Record<string, unknown>>, idCol?: string) => Promise<void>; | ||
} | ||
|
||
interface Smem { | ||
nodes: Record<string, SmemNode>; | ||
init: (dbpath: string) => Promise<Connection>; | ||
node: (name: string, schema: SmemNodeSchema, vectorSourceCol: string) => Promise<SmemNode>; | ||
nodeNames: () => Promise<string[]>; | ||
nodeFromSchema: (name: string, schema: Schema, vectorSourceCol: string) => Promise<SmemNode>; | ||
openTable: (name: string, sourceCol: string) => Promise<Table>; | ||
vector: (text: string) => Promise<number[]>; | ||
embed: (data: unknown[]) => Promise<number[][]>; | ||
} | ||
|
||
type SmemNodeSchema = Array<SmemNodeFieldSchema>; | ||
|
||
type FieldDataType = "string" | "int" | "float" | "boolean"; | ||
|
||
export { | ||
SmemNodeFieldSchema, | ||
SmemNodeSchema, | ||
SmemNode, | ||
Smem, | ||
} |
Oops, something went wrong.