|
1 |
| -# Eliza Documentation Site |
| 1 | +# Eliza |
2 | 2 |
|
3 |
| -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. |
| 3 | +<img src="./docs/static/img/eliza_banner.jpg" alt="Eliza Banner" width="100%" /> |
4 | 4 |
|
5 |
| -### Installation |
| 5 | +_As seen powering [@DegenSpartanAI](https://x.com/degenspartanai) and [@MarcAIndreessen](https://x.com/pmairca)_ |
6 | 6 |
|
7 |
| -Currently eliza is dependent on Supabase for local development. You can install it with the following command: |
| 7 | +- Multi-agent simulation framework |
| 8 | +- Add as many unique characters as you want with [characterfile](https://github.com/lalalune/characterfile/) |
| 9 | +- Full-featured Discord and Twitter connectors, with Discord voice channel support |
| 10 | +- Full conversational and document RAG memory |
| 11 | +- Can read links and PDFs, transcribe audio and videos, summarize conversations, and more |
| 12 | +- Highly extensible - create your own actions and clients to extend Eliza's capabilities |
| 13 | +- Supports open source and local models (default configured with Nous Hermes Llama 3.1B) |
| 14 | +- Supports OpenAI for cloud inference on a light-weight device |
| 15 | +- "Ask Claude" mode for calling Claude on more complex queries |
| 16 | +- 100% Typescript |
8 | 17 |
|
9 |
| - pnpm install eliza |
| 18 | +# Getting Started |
10 | 19 |
|
11 |
| -# Select your database adapter |
| 20 | +**Prerequisites (MUST):** |
12 | 21 |
|
13 |
| - pnpm install sqlite-vss better-sqlite3 # for sqlite (simple, for local development) |
| 22 | +- [Node.js 22+](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) |
| 23 | +- [pnpm](https://pnpm.io/installation) |
14 | 24 |
|
15 |
| -``` |
| 25 | +### Edit the .env file |
| 26 | + |
| 27 | +- Copy .env.example to .env and fill in the appropriate values |
| 28 | +- Edit the TWITTER environment variables to add your bot's username and password |
| 29 | + |
| 30 | +### Edit the character file |
| 31 | + |
| 32 | +- Check out the file `src/core/defaultCharacter.ts` - you can modify this |
| 33 | +- You can also load characters with the `pnpm start --characters="path/to/your/character.json"` and run multiple bots at the same time. |
16 | 34 |
|
17 |
| - pnpm install @supabase/supabase-js # for supabase (more complicated but can be deployed at scale) |
| 35 | +After setting up the .env file and character file, you can start the bot with the following command: |
| 36 | + |
| 37 | +``` |
| 38 | +pnpm i |
| 39 | +pnpm start |
18 | 40 | ```
|
19 | 41 |
|
20 |
| -### Set up environment variables |
| 42 | +# Customising Eliza |
21 | 43 |
|
22 |
| -You will need a Supbase account, as well as an OpenAI developer account. |
| 44 | +### Adding custom actions |
23 | 45 |
|
24 |
| -Copy and paste the .dev.vars.example to .dev.vars and fill in the environment variables: |
| 46 | +To avoid git clashes in the core directory, we recommend adding custom actions to a `custom_actions` directory and then adding them to the `elizaConfig.yaml` file. See the `elizaConfig.example.yaml` file for an example. |
25 | 47 |
|
26 |
| -SUPABASE_URL="https://your-supabase-url.supabase.co" |
27 |
| -SUPABASE_SERVICE_API_KEY="your-supabase-service-api-key" |
28 |
| -OPENAI_API_KEY="your-openai-api-key" |
| 48 | +## Running with different models |
29 | 49 |
|
30 |
| -### SQLite Local Setup (Easiest) |
| 50 | +### Run with Llama |
31 | 51 |
|
32 |
| -You can use SQLite for local development. This is the easiest way to get started with eliza. |
| 52 | +You can run Llama 70B or 405B models by setting the `XAI_MODEL` environment variable to `meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo` or `meta-llama/Meta-Llama-3.1-405B-Instruct` |
33 | 53 |
|
34 |
| - import { AgentRuntime, SqliteDatabaseAdapter } from "eliza"; |
35 |
| - import { Database } from "sqlite3"; |
36 |
| - const sqliteDatabaseAdapter = new SqliteDatabaseAdapter(new Database(":memory:")); |
| 54 | +### Run with Grok |
37 | 55 |
|
38 |
| - const runtime = new AgentRuntime({ |
39 |
| - serverUrl: "https://api.openai.com/v1", |
40 |
| - token: process.env.OPENAI_API_KEY, // Can be an API key or JWT token for your AI services |
41 |
| - databaseAdapter: sqliteDatabaseAdapter, |
42 |
| - // ... other options |
43 |
| - }); |
| 56 | +You can run Grok models by setting the `XAI_MODEL` environment variable to `grok-beta` |
44 | 57 |
|
45 |
| -### Supabase Local Setup |
| 58 | +### Run with OpenAI |
46 | 59 |
|
47 |
| -First, you will need to install the Supabase CLI. You can install it using the instructions here. |
| 60 | +You can run OpenAI models by setting the `XAI_MODEL` environment variable to `gpt-4o-mini` or `gpt-4o` |
48 | 61 |
|
49 |
| -Once you have the CLI installed, you can run the following commands to set up a local Supabase instance: |
| 62 | +## Additional Requirements |
50 | 63 |
|
51 |
| - supabase init |
| 64 | +You may need to install Sharp. If you see an error when starting up, try installing it with the following command: |
52 | 65 |
|
| 66 | +``` |
| 67 | +pnpm install --include=optional sharp |
53 | 68 | ```
|
54 | 69 |
|
55 |
| -supabase start |
| 70 | +# Environment Setup |
| 71 | + |
| 72 | +You will need to add environment variables to your .env file to connect to various platforms: |
| 73 | + |
56 | 74 | ```
|
| 75 | +# Required environment variables |
| 76 | +DISCORD_APPLICATION_ID= |
| 77 | +DISCORD_API_TOKEN= # Bot token |
| 78 | +OPENAI_API_KEY=sk-* # OpenAI API key, starting with sk- |
| 79 | +ELEVENLABS_XI_API_KEY= # API key from elevenlabs |
57 | 80 |
|
58 |
| -You can now start the eliza project with `pnpm run dev` and it will connect to the local Supabase instance by default. |
| 81 | +# ELEVENLABS SETTINGS |
| 82 | +ELEVENLABS_MODEL_ID=eleven_multilingual_v2 |
| 83 | +ELEVENLABS_VOICE_ID=21m00Tcm4TlvDq8ikWAM |
| 84 | +ELEVENLABS_VOICE_STABILITY=0.5 |
| 85 | +ELEVENLABS_VOICE_SIMILARITY_BOOST=0.9 |
| 86 | +ELEVENLABS_VOICE_STYLE=0.66 |
| 87 | +ELEVENLABS_VOICE_USE_SPEAKER_BOOST=false |
| 88 | +ELEVENLABS_OPTIMIZE_STREAMING_LATENCY=4 |
| 89 | +ELEVENLABS_OUTPUT_FORMAT=pcm_16000 |
59 | 90 |
|
60 |
| -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). |
| 91 | +TWITTER_DRY_RUN=false |
| 92 | +TWITTER_USERNAME= # Account username |
| 93 | +TWITTER_PASSWORD= # Account password |
| 94 | +TWITTER_EMAIL= # Account email |
| 95 | +TWITTER_COOKIES= # Account cookies |
61 | 96 |
|
62 |
| -### Supabase Cloud Setup |
| 97 | +X_SERVER_URL= |
| 98 | +XAI_API_KEY= |
| 99 | +XAI_MODEL= |
63 | 100 |
|
64 |
| -This library uses Supabase as a database. You can set up a free account at supabase.io and create a new project. |
65 | 101 |
|
66 |
| -- Step 1: On the Subase All Projects Dashboard, select “New Project”. |
67 |
| -- Step 2: Select the organization to store the new project in, assign a database name, password and region. |
68 |
| -- Step 3: Select “Create New Project”. |
69 |
| -- Step 4: Wait for the database to setup. This will take a few minutes as supabase setups various directories. |
70 |
| -- Step 5: Select the “SQL Editor” tab from the left navigation menu. |
71 |
| -- 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. |
72 |
| -- Step 7: Paste the SQL code into the SQL Editor and hit run in the bottom right. |
73 |
| -- Step 8: Select the “Databases” tab from the left navigation menu to verify all of the tables have been added properly. |
| 102 | +# For asking Claude stuff |
| 103 | +ANTHROPIC_API_KEY= |
74 | 104 |
|
75 |
| -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. |
| 105 | +WALLET_SECRET_KEY=EXAMPLE_WALLET_SECRET_KEY |
| 106 | +WALLET_PUBLIC_KEY=EXAMPLE_WALLET_PUBLIC_KEY |
76 | 107 |
|
77 |
| -### Local Model Setup |
| 108 | +BIRDEYE_API_KEY= |
78 | 109 |
|
79 |
| -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. |
| 110 | +SOL_ADDRESS=So11111111111111111111111111111111111111112 |
| 111 | +SLIPPAGE=1 |
| 112 | +RPC_URL=https://api.mainnet-beta.solana.com |
| 113 | +HELIUS_API_KEY= |
80 | 114 |
|
81 |
| - const runtime = new AgentRuntime({ |
82 |
| - serverUrl: process.env.LOCALAI_URL, |
83 |
| - token: process.env.LOCALAI_TOKEN, // Can be an API key or JWT token for your AI service |
84 |
| - // ... other options |
85 |
| - }); |
86 | 115 |
|
87 |
| -### Development |
| 116 | +## Telegram |
| 117 | +TELEGRAM_BOT_TOKEN= |
| 118 | +
|
| 119 | +TOGETHER_API_KEY= |
| 120 | +``` |
88 | 121 |
|
89 |
| - pnpm run dev # start the server |
| 122 | +# Local Inference Setup |
| 123 | + |
| 124 | +### CUDA Setup |
| 125 | + |
| 126 | +If you have an NVIDIA GPU, you can install CUDA to speed up local inference dramatically. |
90 | 127 |
|
91 | 128 | ```
|
92 |
| -pnpm run shell # start the shell in another terminal to talk to the default agent |
| 129 | +pnpm install |
| 130 | +npx --no node-llama-cpp source download --gpu cuda |
93 | 131 | ```
|
94 | 132 |
|
95 |
| -### Usage |
96 |
| - |
97 |
| - import { AgentRuntime, SupabaseDatabaseAdapter, SqliteDatabaseAdapter } from "eliza"; |
98 |
| - |
99 |
| - const sqliteDatabaseAdapter = new SqliteDatabaseAdapter(new Database(":memory:")); |
100 |
| - |
101 |
| - ``` |
102 |
| - // You can also use Supabase like this |
103 |
| - // const supabaseDatabaseAdapter = new SupabaseDatabaseAdapter( |
104 |
| - // process.env.SUPABASE_URL, |
105 |
| - // process.env.SUPABASE_SERVICE_API_KEY) |
106 |
| - // ; |
107 |
| - |
108 |
| - ``` |
109 |
| - const runtime = new AgentRuntime({ |
110 |
| - serverUrl: "https://api.openai.com/v1", |
111 |
| - token: process.env.OPENAI_API_KEY, // Can be an API key or JWT token for your AI services |
112 |
| - databaseAdapter: sqliteDatabaseAdapter, |
113 |
| - actions: [ |
114 |
| - /* your custom actions */ |
115 |
| - ], |
116 |
| - evaluators: [ |
117 |
| - /* your custom evaluators */ |
118 |
| - ], |
119 |
| - model: "gpt-3.5-turbo", // whatever model you want to use |
120 |
| - embeddingModel: "text-embedding-3-small", // whatever model you want to use |
121 |
| - }); |
122 |
| - |
123 |
| -### what next? |
124 |
| - |
125 |
| -it is good to interact with the eliza and read more about the documentation on https://www.eliza.org/docs |
| 133 | +Make sure that you've installed the CUDA Toolkit, including cuDNN and cuBLAS. |
| 134 | + |
| 135 | +### Running locally |
| 136 | + |
| 137 | +Add XAI_MODEL and set it to one of the above options from [Run with |
| 138 | +Llama](#run-with-llama) - you can leave X_SERVER_URL and XAI_API_KEY blank, it |
| 139 | +downloads the model from huggingface and queries it locally |
| 140 | + |
| 141 | +# Clients |
| 142 | + |
| 143 | +## Discord Bot |
| 144 | + |
| 145 | +For help with setting up your Discord Bot, check out here: https://discordjs.guide/preparations/setting-up-a-bot-application.html |
| 146 | + |
| 147 | +# Development |
| 148 | + |
| 149 | +## Testing |
| 150 | + |
| 151 | +To run the test suite: |
| 152 | + |
| 153 | +```bash |
| 154 | +pnpm test # Run tests once |
| 155 | +pnpm test:watch # Run tests in watch mode |
| 156 | +``` |
| 157 | + |
| 158 | +For database-specific tests: |
| 159 | +```bash |
| 160 | +pnpm test:sqlite # Run tests with SQLite |
| 161 | +pnpm test:sqljs # Run tests with SQL.js |
| 162 | +``` |
| 163 | + |
| 164 | +Tests are written using Jest and can be found in `src/**/*.test.ts` files. The test environment is configured to: |
| 165 | +- Load environment variables from `.env.test` |
| 166 | +- Use a 2-minute timeout for long-running tests |
| 167 | +- Support ESM modules |
| 168 | +- Run tests in sequence (--runInBand) |
| 169 | + |
| 170 | +To create new tests, add a `.test.ts` file adjacent to the code you're testing. |
0 commit comments