Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
astinz authored Jan 1, 2025
2 parents 2ad7576 + 41b83b9 commit ac8bd00
Show file tree
Hide file tree
Showing 77 changed files with 8,268 additions and 1,231 deletions.
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ LARGE_GAIANET_SERVER_URL= # Default: https://qwen72b.gaia.domains/v1
GAIANET_EMBEDDING_MODEL=
USE_GAIANET_EMBEDDING= # Set to TRUE for GAIANET/768, leave blank for local

# Volcengine Configuration
VOLENGINE_API_URL= # Volcengine API Endpoint, Default: https://open.volcengineapi.com/api/v3/
VOLENGINE_MODEL=
SMALL_VOLENGINE_MODEL= # Default: doubao-lite-128k
MEDIUM_VOLENGINE_MODEL= # Default: doubao-pro-128k
LARGE_VOLENGINE_MODEL= # Default: doubao-pro-256k
VOLENGINE_EMBEDDING_MODEL= # Default: doubao-embedding

# EVM
EVM_PRIVATE_KEY=
EVM_PROVIDER_URL=
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@

[中文说明](./README_CN.md) | [日本語の説明](./README_JA.md) | [한국어 설명](./README_KOR.md) | [Français](./README_FR.md) | [Português](./README_PTBR.md) | [Türkçe](./README_TR.md) | [Русский](./README_RU.md) | [Español](./README_ES.md) | [Italiano](./README_IT.md) | [ไทย](./README_TH.md) | [Deutsch](./README_DE.md) | [Tiếng Việt](./README_VI.md) | [עִברִית](https://github.com/elizaos/Elisa/blob/main/README_HE.md) | [Tagalog](./README_TG.md) | [Polski](./README_PL.md)

## 🚩 Overview

<div align="center">
<img src="./docs/static/img/eliza_diagram.jpg" alt="Eliza Diagram" width="100%" />
</div>

## ✨ Features

- 🛠️ Full-featured Discord, Twitter and Telegram connectors
Expand Down
6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Eliza - Multi-agent simulation framework

# https://github.com/elizaos/eliza
# https://github.com/elizaOS/eliza

# Visit https://eliza.builders for support

## 🌍 README Translations

[中文说明](./README_CN.md) | [Deutsch](./README_DE.md) | [Français](./README_FR.md) | [ไทย](./README_TH.md)
[中文说明](./README_CN.md) | [Deutsch](./README_DE.md) | [Français](./README_FR.md) | [ไทย](./README_TH.md) | [Español](README_ES.md)

# dev branch

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

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

Expand Down
179 changes: 179 additions & 0 deletions docs/README_ES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
# Eliza - Framework de simulación multi-agente

# https://github.com/elizaOS/eliza

# Visita https://eliza.builders para ayuda

## 🌍 Traducciones del README

[中文说明](./README_CN.md) | [Deutsch](./README_DE.md) | [Français](./README_FR.md) | [ไทย](./README_TH.md) | [English](README.md)

# dev branch

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

_Respaldado por [@DegenSpartanAI](https://x.com/degenspartanai) y [@MarcAIndreessen](https://x.com/pmairca)_

- Framework de simulación multi-agente
- Añade tantos caracteres únicos como quieras con [characterfile](https://github.com/elizaOS/characterfile/)
- Conectores Discord y Twitter con todas las funciones y compatibilidad con canales de voz de Discord.
- Sistema de memoria RAG completo para conversaciones y documentos.
- Capacidad para leer enlaces y archivos PDF, transcribir audio y vídeos, resumir conversaciones, etc.
- Gran capacidad de ampliación: cree sus propias acciones y clientes para ampliar las posibilidades de Eliza.
- Admite modelos locales y de código abierto (configurado por defecto con Nous Hermes Llama 3.1B).
- Compatible con OpenAI para la inferencia en la nube en un dispositivo ligero.
- Modo "Ask Claude" para llamar a Claude en consultas más complejas
- 100% Typescript

# Primeros pasos

**Prerrequisitos (OBLIGATORIOS):**

- [Node.js 23+](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
- [pnpm](https://pnpm.io/installation)

### Edita el archivo .env

- Copie .env.example en .env y rellene los valores apropiados
- Edita las variables de entorno de TWITTER para añadir el nombre de usuario y la contraseña de tu bot

### Edita el archivo del character

- Mira el archivo `src/core/defaultCharacter.ts` - tú puedes modificarlo
- También puede cargar caracteres con el comando `pnpm start --characters="path/to/your/character.json"` y ejecutar múltiples bots al mismo tiempo.

Después de configurar el archivo .env y el archivo de caracteres, puedes iniciar el bot con el siguiente comando:

```
pnpm i
pnpm start
```

# Personalizando Eliza

### Añadir acciones personalizadas

Para evitar conflictos de git en el directorio core, recomendamos añadir acciones personalizadas a un directorio `custom_actions` y luego añadirlas al archivo `elizaConfig.yaml`. Consulte el archivo `elizaConfig.example.yaml` para ver un ejemplo.

## Ejecutando con diferentes modelos

### Ejecuta con Llama

Tú puedes ejecutar los modelos Llama 70B o 405B configurando el ambiente `XAI_MODEL` en la variable `meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo` o `meta-llama/Meta-Llama-3.1-405B-Instruct`

### Ejecuta con Grok

Tú puedes ejecutar modelos Grok configurando el ambiente `XAI_MODEL` en la variable `grok-beta`

### Ejecuta con OpenAI

Tú puedes ejecutar modelos OpenAI configurando el ambiente `XAI_MODEL` en la variable `gpt-4-mini` o `gpt-4o`

## Requerimientos adicionales

Puede que necesite instalar Sharp. Si aparece un error al arrancar, intente instalarlo con el siguiente comando:

```
pnpm install --include=optional sharp
```

# Configuración del entorno

Tendrás que añadir variables de entorno a tu archivo .env para conectarte a distintas plataformas:

```
# Variables de entorno necesarias
DISCORD_APPLICATION_ID=
DISCORD_API_TOKEN= # Bot token
OPENAI_API_KEY=sk-* # OpenAI API key, starting with sk-
ELEVENLABS_XI_API_KEY= # API key from elevenlabs
# CONFIGURACION DE ELEVENLABS
ELEVENLABS_MODEL_ID=eleven_multilingual_v2
ELEVENLABS_VOICE_ID=21m00Tcm4TlvDq8ikWAM
ELEVENLABS_VOICE_STABILITY=0.5
ELEVENLABS_VOICE_SIMILARITY_BOOST=0.9
ELEVENLABS_VOICE_STYLE=0.66
ELEVENLABS_VOICE_USE_SPEAKER_BOOST=false
ELEVENLABS_OPTIMIZE_STREAMING_LATENCY=4
ELEVENLABS_OUTPUT_FORMAT=pcm_16000
TWITTER_DRY_RUN=false
TWITTER_USERNAME= # Account username
TWITTER_PASSWORD= # Account password
TWITTER_EMAIL= # Account email
X_SERVER_URL=
XAI_API_KEY=
XAI_MODEL=
# Para preguntarle cosas a Claude
ANTHROPIC_API_KEY=
WALLET_SECRET_KEY=EXAMPLE_WALLET_SECRET_KEY
WALLET_PUBLIC_KEY=EXAMPLE_WALLET_PUBLIC_KEY
BIRDEYE_API_KEY=
SOL_ADDRESS=So11111111111111111111111111111111111111112
SLIPPAGE=1
RPC_URL=https://api.mainnet-beta.solana.com
HELIUS_API_KEY=
## Telegram
TELEGRAM_BOT_TOKEN=
TOGETHER_API_KEY=
```

# Configuración de la inferencia local

### Configuración CUDA

Si tienes una GPU NVIDIA, puedes instalar CUDA para acelerar drásticamente la inferencia local.

```
pnpm install
npx --no node-llama-cpp source download --gpu cuda
```

Asegúrese de que ha instalado el kit de herramientas CUDA, incluidos cuDNN y cuBLAS.

### Ejecutando localmente

Añade XAI_MODEL y ajústalo a una de las opciones anteriores de [Run with Llama](#run-with-llama) - puedes dejar X_SERVER_URL y XAI_API_KEY en blanco, descarga el modelo de huggingface y lo consulta localmente.

# Clientes

## Discord Bot

Para obtener ayuda con la configuración de su Bot Discord, echa un vistazo aquí: https://discordjs.guide/preparations/setting-up-a-bot-application.html

# Desarrollo

## Pruebas

Para ejecutar el conjunto de pruebas:

```bash
pnpm test # Ejecutar las pruebas una vez
pnpm test:watch # Ejecutar pruebas en modo vigilancia
```

Para pruebas database-specific:

```bash
pnpm test:sqlite # Ejecuta pruebas con SQLite
pnpm test:sqljs # Ejecuta pruebas con with SQL.js
```

Las pruebas se escriben usando Jest y se encuentran en los archivos `src/**/*.test.ts`. El entorno de pruebas está configurado para:

- Cargar variables de entorno desde `.env.test`.
- Uso de un tiempo de espera de 2 minutos para pruebas de larga duración
- Compatibilidad con módulos ESM
- Ejecutar pruebas en secuencia (--runInBand)

Para crear nuevas pruebas, añade un archivo `.test.ts` junto al código que estás probando.
2 changes: 1 addition & 1 deletion docs/docs/core/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const runtime = new AgentRuntime({

## State Management

This section should cover how agents manage and update state, with a focus on initial state composition and updating methods. The runtime maintains state through the [State](/api/interfaces/state) interface:
This section covers how agents manage and update state, with a focus on initial state composition and updating methods. The runtime maintains state through the [State](/api/interfaces/state) interface:

```typescript
interface State {
Expand Down
1 change: 1 addition & 0 deletions docs/docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Eliza's architecture consists of several interconnected components:
- **Agents**: These are the core elements that represent individual AI personalities. Agents operate within a runtime environment and interact with various platforms.
- **Actions**: Actions are predefined behaviors that agents can execute in response to messages, enabling them to perform tasks and interact with external systems.
- **Clients**: Clients act as interfaces between agents and specific platforms, such as Discord, Twitter, and Telegram. They handle platform-specific message formats and communication protocols.
- **Plugins**: Plugins are modular way to extend the core functionality with additional features, actions, evaluators, and providers. They are self-contained modules that can be easily added or removed to customize your agent's capabilities
- **Providers**: Providers supply agents with contextual information, including time awareness, user relationships, and data from external sources.
- **Evaluators**: These modules assess and extract information from conversations, helping agents track goals, build memory, and maintain context awareness.
- **Character Files**: These JSON files define the personality, knowledge, and behavior of each AI agent.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/guides/local-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,4 +447,4 @@ npx knowledge2character <character-file> <knowledge-file>
- [Configuration Guide](./configuration.md) for setup details
- [Advanced Usage](./advanced.md) for complex features
- [API Documentation](/api) for complete API reference
- [Contributing Guide](../community/contributing.md) for contribution guidelines
- [Contributing Guide](../contributing.md) for contribution guidelines
Binary file added docs/static/img/eliza_diagram.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/adapter-postgres/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ BEGIN
-- Then check for Ollama
ELSIF current_setting('app.use_ollama_embedding', TRUE) = 'true' THEN
RETURN 1024; -- Ollama mxbai-embed-large dimension
-- Then check for GAIANET
ELSIF current_setting('app.use_gaianet_embedding', TRUE) = 'true' THEN
RETURN 768; -- Gaianet nomic-embed dimension
ELSE
RETURN 384; -- BGE/Other embedding dimension
END IF;
Expand Down
7 changes: 7 additions & 0 deletions packages/adapter-postgres/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,19 @@ export class PostgresDatabaseAdapter
if (embeddingConfig.provider === EmbeddingProvider.OpenAI) {
await client.query("SET app.use_openai_embedding = 'true'");
await client.query("SET app.use_ollama_embedding = 'false'");
await client.query("SET app.use_gaianet_embedding = 'false'");
} else if (embeddingConfig.provider === EmbeddingProvider.Ollama) {
await client.query("SET app.use_openai_embedding = 'false'");
await client.query("SET app.use_ollama_embedding = 'true'");
await client.query("SET app.use_gaianet_embedding = 'false'");
} else if (embeddingConfig.provider === EmbeddingProvider.GaiaNet){
await client.query("SET app.use_openai_embedding = 'false'");
await client.query("SET app.use_ollama_embedding = 'false'");
await client.query("SET app.use_gaianet_embedding = 'true'");
} else {
await client.query("SET app.use_openai_embedding = 'false'");
await client.query("SET app.use_ollama_embedding = 'false'");
await client.query("SET app.use_gaianet_embedding = 'false'");
}

// Check if schema already exists (check for a core table)
Expand Down
19 changes: 19 additions & 0 deletions packages/adapter-supabase/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,21 @@ CREATE TABLE memories_1024 (
CONSTRAINT fk_agent FOREIGN KEY ("agentId") REFERENCES accounts("id") ON DELETE CASCADE
);

CREATE TABLE memories_768 (
"id" UUID PRIMARY KEY,
"type" TEXT NOT NULL,
"createdAt" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
"content" JSONB NOT NULL,
"embedding" vector(768), -- Gaianet nomic-embed
"userId" UUID REFERENCES accounts("id"),
"agentId" UUID REFERENCES accounts("id"),
"roomId" UUID REFERENCES rooms("id"),
"unique" BOOLEAN DEFAULT true NOT NULL,
CONSTRAINT fk_room FOREIGN KEY ("roomId") REFERENCES rooms("id") ON DELETE CASCADE,
CONSTRAINT fk_user FOREIGN KEY ("userId") REFERENCES accounts("id") ON DELETE CASCADE,
CONSTRAINT fk_agent FOREIGN KEY ("agentId") REFERENCES accounts("id") ON DELETE CASCADE
);

CREATE TABLE memories_384 (
"id" UUID PRIMARY KEY,
"type" TEXT NOT NULL,
Expand All @@ -82,6 +97,8 @@ CREATE VIEW memories AS
UNION ALL
SELECT * FROM memories_1024
UNION ALL
SELECT * FROM memories_768;
UNION ALL
SELECT * FROM memories_384;


Expand Down Expand Up @@ -136,6 +153,8 @@ CREATE TABLE relationships (
-- Add index for Ollama table
CREATE INDEX idx_memories_1024_embedding ON memories_1024 USING hnsw ("embedding" vector_cosine_ops);
CREATE INDEX idx_memories_1024_type_room ON memories_1024("type", "roomId");
CREATE INDEX idx_memories_768_embedding ON memories_768 USING hnsw ("embedding" vector_cosine_ops);
CREATE INDEX idx_memories_768_type_room ON memories_768("type", "roomId");
CREATE INDEX idx_memories_1536_embedding ON memories_1536 USING hnsw ("embedding" vector_cosine_ops);
CREATE INDEX idx_memories_384_embedding ON memories_384 USING hnsw ("embedding" vector_cosine_ops);
CREATE INDEX idx_memories_1536_type_room ON memories_1536("type", "roomId");
Expand Down
62 changes: 62 additions & 0 deletions packages/client-direct/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {

import { REST, Routes } from "discord.js";
import { DirectClient } from ".";
import { stringToUuid } from "@elizaos/core";

export function createApiRouter(
agents: Map<string, AgentRuntime>,
Expand Down Expand Up @@ -121,5 +122,66 @@ export function createApiRouter(
}
});

router.get("/agents/:agentId/:roomId/memories", async (req, res) => {
const agentId = req.params.agentId;
const roomId = stringToUuid(req.params.roomId);
let runtime = agents.get(agentId);

// if runtime is null, look for runtime with the same name
if (!runtime) {
runtime = Array.from(agents.values()).find(
(a) => a.character.name.toLowerCase() === agentId.toLowerCase()
);
}

if (!runtime) {
res.status(404).send("Agent not found");
return;
}

try {
const memories = await runtime.messageManager.getMemories({
roomId,
});
const response = {
agentId,
roomId,
memories: memories.map((memory) => ({
id: memory.id,
userId: memory.userId,
agentId: memory.agentId,
createdAt: memory.createdAt,
content: {
text: memory.content.text,
action: memory.content.action,
source: memory.content.source,
url: memory.content.url,
inReplyTo: memory.content.inReplyTo,
attachments: memory.content.attachments?.map(
(attachment) => ({
id: attachment.id,
url: attachment.url,
title: attachment.title,
source: attachment.source,
description: attachment.description,
text: attachment.text,
contentType: attachment.contentType,
})
),
},
embedding: memory.embedding,
roomId: memory.roomId,
unique: memory.unique,
similarity: memory.similarity,
})),
};

res.json(response);
} catch (error) {
console.error("Error fetching memories:", error);
res.status(500).json({ error: "Failed to fetch memories" });
}
});

return router;
}
Loading

0 comments on commit ac8bd00

Please sign in to comment.