-
Notifications
You must be signed in to change notification settings - Fork 17
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
0 parents
commit d14850d
Showing
62 changed files
with
17,482 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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,4 @@ | ||
**/node_modules/* | ||
**/coverage/* | ||
**/dist/* | ||
**/types/* |
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,25 @@ | ||
{ | ||
"env": { | ||
"node": true, | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 2021, | ||
"sourceType": "module", | ||
"project": "./tsconfig.json" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint", | ||
"prettier" | ||
], | ||
"rules": { | ||
"prettier/prettier": "error" | ||
} | ||
} |
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,6 @@ | ||
.dev.vars | ||
.wrangler | ||
node_modules | ||
.env | ||
concatenated-output.ts | ||
embedding-cache.json |
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,4 @@ | ||
{ | ||
"tabWidth": 2, | ||
"useTabs": false | ||
} |
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,73 @@ | ||
# bgent <a href="https://discord.gg/qetWd7J9De"><img style="float: right" src="https://dcbadge.vercel.app/api/server/qetWd7J9De" alt=""></a> | ||
|
||
Flexible, scalable and customizable agents to do your bidding. | ||
|
||
<img src="resources/image.jpg"> | ||
|
||
[](https://github.com/lalalune/bgent/blob/main/LICENSE) | ||
[](https://github.com/lalalune/bgent) | ||
[](https://github.com/lalalune/bgent) | ||
|
||
## Features | ||
|
||
- Simple and extensible | ||
- Customizable to your use case | ||
- Retrievable memory and document store | ||
- Serverless artchitecture, deployable in minutes at scale with Cloudflare and Supabase | ||
- Multi-agent and room support | ||
- Reflection and summarization | ||
- Goal-directed behavior | ||
|
||
## Installation | ||
|
||
```bash | ||
npm install bgent | ||
``` | ||
|
||
## Try the agent | ||
|
||
``` | ||
npm run dev | ||
``` | ||
|
||
## Database setup | ||
|
||
This library uses Supabase as a database. You can set up a free account at [supabase.io](https://supabase.io) and create a new project. | ||
|
||
### TODO: Add script and instructions for deploying fresh copy of database | ||
|
||
### TODO: Local supabase deployment instructions | ||
|
||
## Usage | ||
|
||
```javascript | ||
const runtime = new BgentRuntime({ | ||
serverUrl: "https://api.openai.com/v1", | ||
token: process.env.OPENAI_API_KEY, | ||
supabase: createClient( | ||
process.env.SUPABASE_URL, | ||
process.env.SUPABASE_ANON_KEY, | ||
), | ||
}); | ||
``` | ||
|
||
## Examples | ||
|
||
There are two examples which are set up for cloudflare in `src/agents` | ||
|
||
- The `simple` example is a simple agent that can be deployed to cloudflare workers | ||
- The `cj` example is a more complex agent that has the ability to introduce users to each other | ||
|
||
### Custom actions | ||
|
||
Actions come in two flavors -- generic `actions` which run at any time they are considered valid, and `evaluators` which run when a condition is met at the end of a conversation turn. | ||
|
||
You can pass your own custom actions and evaluators into the BgentRuntime instance. Check out the `src/agents/cj` example for a simple example of how to do this. | ||
|
||
### Deployment | ||
|
||
Deploying to cloudflare is easy. `npm run deploy` will walk you through a deployment with wrangler, Cloudflare's deployment tool. | ||
|
||
# Contributions Welcome | ||
|
||
If you like this library and want to contribute in any way, please feel free to submit a PR and I will review it. Please note that the goal here is simplicity and accesibility, using common language and few dependencies. |
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,12 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
export default { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
rootDir: './src', | ||
testMatch: ['**/*.test.ts'], | ||
globals: { | ||
__DEV__: true, | ||
__TEST__: true, | ||
__VERSION__: '0.0.1' | ||
} | ||
} |
Oops, something went wrong.