Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Oct 29, 2024
1 parent 24368f5 commit ab84bf0
Show file tree
Hide file tree
Showing 97 changed files with 21,249 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Eliza

<img src="./docs/eliza_banner.png" alt="Eliza Banner" width="100%">
<img src="./docs/eliza_banner.jpg" alt="Eliza Banner" width="100%">

*As seen powering [@DegenSpartanAI](https://x.com/degenspartanai) and [@MarcAIndreessen](https://x.com/pmairca)*

Expand Down
18 changes: 18 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
1 change: 1 addition & 0 deletions docs/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
119 changes: 119 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Eliza Documentation Site

This the official documentation site of eliza. A flexible, scalable and customizable agent for production apps. which Comes with batteries-including database, deployment and examples using Supabase and Cloudflare.

### Installation
Currently eliza is dependent on Supabase for local development. You can install it with the following command:


npm install eliza

# Select your database adapter

npm install sqlite-vss better-sqlite3 # for sqlite (simple, for local development)
```
npm install @supabase/supabase-js # for supabase (more complicated but can be deployed at scale)
```


### Set up environment variables

You will need a Supbase account, as well as an OpenAI developer account.

Copy and paste the .dev.vars.example to .dev.vars and fill in the environment variables:

SUPABASE_URL="https://your-supabase-url.supabase.co"
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 eliza.

import { BgentRuntime, SqliteDatabaseAdapter } from "eliza";
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.

Once you have the CLI installed, you can run the following commands to set up a local Supabase instance:

supabase init
```
supabase start
```

You can now start the eliza project with `npm run dev` and it will connect to the local Supabase instance by default.

NOTE: You will need Docker installed for this to work. If that is an issue for you, use the Supabase Cloud Setup instructions instead below).

### Supabase Cloud Setup
This library uses Supabase as a database. You can set up a free account at supabase.io and create a new project.

* Step 1: On the Subase All Projects Dashboard, select “New Project”.
* Step 2: Select the organization to store the new project in, assign a database name, password and region.
* Step 3: Select “Create New Project”.
* Step 4: Wait for the database to setup. This will take a few minutes as supabase setups various directories.
* Step 5: Select the “SQL Editor” tab from the left navigation menu.
* Step 6: Copy in your own SQL dump file or optionally use the provided file in the eliza directory at: "src/supabase/db.sql". Note: You can use the command "supabase db dump" if you have a pre-exisiting supabase database to generate the SQL dump file.
* Step 7: Paste the SQL code into the SQL Editor and hit run in the bottom right.
* Step 8: Select the “Databases” tab from the left navigation menu to verify all of the tables have been added properly.

Once you've set up your Supabase project, you can find your API key by going to the "Settings" tab and then "API". You will need to set the` SUPABASE_URL and SUPABASE_SERVICE_API_KEY` environment variables in your `.dev.vars` file.

### Local Model Setup

While eliza uses ChatGPT 3.5 by default, you can use a local model by setting the serverUrl to a local endpoint. The LocalAI project is a great way to run a local model with a compatible API endpoint.

const runtime = new BgentRuntime({
serverUrl: process.env.LOCALAI_URL,
token: process.env.LOCALAI_TOKEN, // Can be an API key or JWT token for your AI service
// ... other options
});


### Development

npm run dev # start the server
```
npm run shell # start the shell in another terminal to talk to the default agent
```
### Usage
import { BgentRuntime, SupabaseDatabaseAdapter, SqliteDatabaseAdapter } from "eliza";
const sqliteDatabaseAdapter = new SqliteDatabaseAdapter(new Database(":memory:"));
```
// 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: sqliteDatabaseAdapter,
actions: [
/* your custom actions */
],
evaluators: [
/* your custom evaluators */
],
model: "gpt-3.5-turbo", // whatever model you want to use
embeddingModel: "text-embedding-3-small", // whatever model you want to use
});


### what next?
it is good to interact with the eliza and read more about the documentation on https://www.eliza.org/docs
3 changes: 3 additions & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
1 change: 1 addition & 0 deletions docs/docs/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
label: "API"
Loading

0 comments on commit ab84bf0

Please sign in to comment.