Skip to content

Commit

Permalink
add instructions to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Mar 19, 2024
1 parent 712abd7 commit 8419797
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,23 @@ SUPABASE_SERVICE_API_KEY="your-supabase-service-api-key"
OPENAI_API_KEY="your-openai-api-key"
```

### SQLite Local Setup (Easiest)

You can use SQLite for local development. This is the easiest way to get started with bgent.

```typescript
import { BgentRuntime, SqliteDatabaseAdapter } from "bgent";
import { Database } from "sqlite3";
const sqliteDatabaseAdapter = new SqliteDatabaseAdapter(new Database(":memory:"));

const runtime = new BgentRuntime({
serverUrl: "https://api.openai.com/v1",
token: process.env.OPENAI_API_KEY, // Can be an API key or JWT token for your AI services
databaseAdapter: sqliteDatabaseAdapter,
// ... other options
});
```

### Supabase Local Setup

First, you will need to install the Supabase CLI. You can install it using the instructions [here](https://supabase.com/docs/guides/cli/getting-started).
Expand Down Expand Up @@ -119,17 +136,20 @@ npm run shell # start the shell in another terminal to talk to the default agent
## Usage

```typescript
import { BgentRuntime, SupabaseDatabaseAdapter } from "bgent";
import { BgentRuntime, SupabaseDatabaseAdapter, SqliteDatabaseAdapter } from "bgent";

const sqliteDatabaseAdapter = new SqliteDatabaseAdapter(new Database(":memory:"));

const databaseAdapter = new SupabaseDatabaseAdapter(
process.env.SUPABASE_URL,
process.env.SUPABASE_SERVICE_API_KEY)
;
// You can also use Supabase like this
// const supabaseDatabaseAdapter = new SupabaseDatabaseAdapter(
// process.env.SUPABASE_URL,
// process.env.SUPABASE_SERVICE_API_KEY)
// ;

const runtime = new BgentRuntime({
serverUrl: "https://api.openai.com/v1",
token: process.env.OPENAI_API_KEY, // Can be an API key or JWT token for your AI services
databaseAdapter,
databaseAdapter: sqliteDatabaseAdapter,
actions: [
/* your custom actions */
],
Expand Down

0 comments on commit 8419797

Please sign in to comment.