Skip to content

Commit

Permalink
Merge pull request #9 from OriginTrail/improvements/code-cleanup
Browse files Browse the repository at this point in the history
Code cleanup, readme update, added example character
  • Loading branch information
brkagithub authored Jan 23, 2025
2 parents ec1d92c + 9ec5656 commit b15eb45
Show file tree
Hide file tree
Showing 4 changed files with 533 additions and 475 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ timeline_cache.json

*.sqlite

characters/

packages/core/src/providers/cache
packages/core/src/providers/cache/*
cache/*
Expand Down
197 changes: 64 additions & 133 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,181 +1,112 @@
# Eliza 🤖
![image](https://github.com/user-attachments/assets/17da3a5f-aed1-43d4-ab83-d984a9cc06df)

<div align="center">
<img src="./docs/static/img/eliza_banner.jpg" alt="Eliza Banner" width="100%" />
</div>
# Elizagraph - DKG Eliza Agent starter kit

<div align="center">
ElizaOS agent powered by Knowledge Graph memories.
Based on the ElizaOS plugin enabling integration with the OriginTrail Decentralized Knowledge Graph (DKG) for enhanced knowledge graph retrieval, search and knowledge management with ElizaOS agents.

📑 [Technical Report](https://arxiv.org/pdf/2501.06781) | 📖 [Documentation](https://elizaos.github.io/eliza/) | 🎯 [Examples](https://github.com/thejoven/awesome-eliza)
## Description

</div>
The DKG plugin extends ElizaOS functionality by allowing agents to create knowledge graph based memories in the form of Knowledge assets on the OriginTrail Decentralized Knowledge Graph. This plugin enables SPARQL-based searches on the DKG and combines these results with Eliza's regular search results. Additionally, it creates a memory as a Knowledge Asset on the DKG after a response, making it available for future SPARQL queries.

## 🌍 README Translations
This is an experimental project. Feel free to clone, play around and contribute bug fixes or new features. Use this repo as a "agent starter repo". The plugin-dkg will be included into the official ElizaOS repo as well in the coming weeks

[中文说明](i18n/readme/README_CN.md) | [日本語の説明](i18n/readme/README_JA.md) | [한국어 설명](i18n/readme/README_KOR.md) | [Persian](i18n/readme/README_FA.md) | [Français](i18n/readme/README_FR.md) | [Português](i18n/readme/README_PTBR.md) | [Türkçe](i18n/readme/README_TR.md) | [Русский](i18n/readme/README_RU.md) | [Español](i18n/readme/README_ES.md) | [Italiano](i18n/readme/README_IT.md) | [ไทย](i18n/readme/README_TH.md) | [Deutsch](i18n/readme/README_DE.md) | [Tiếng Việt](i18n/readme/README_VI.md) | [עִברִית](i18n/readme/README_HE.md) | [Tagalog](i18n/readme/README_TG.md) | [Polski](i18n/readme/README_PL.md) | [Arabic](i18n/readme/README_AR.md) | [Hungarian](i18n/readme/README_HU.md) | [Srpski](i18n/readme/README_RS.md) | [Română](i18n/readme/README_RO.md) | [Nederlands](i18n/readme/README_NL.md) | [Ελληνικά](i18n/readme/README_GR.md)
Check out the example agent running on X: https://x.com/ChatDKG

## 🚩 Overview
## Features

<div align="center">
<img src="./docs/static/img/eliza_diagram.png" alt="Eliza Diagram" width="100%" />
</div>
### 1. OriginTrail DKG Integration

## ✨ Features
- Perform knowledge graph queries on the DKG for knowledge extraction (using SPARQL)
- Combine DKG query results with Eliza's internal search capabilities.
- Enhance responses with decentralized and trusted knowledge.

- 🛠️ Full-featured Discord, Twitter and Telegram connectors
- 🔗 Support for every model (Llama, Grok, OpenAI, Anthropic, Gemini, etc.)
- 👥 Multi-agent and room support
- 📚 Easily ingest and interact with your documents
- 💾 Retrievable memory and document store
- 🚀 Highly extensible - create your own actions and clients
- 📦 Just works!
### 2. Knowledge Asset Creation

## Video Tutorials
- Automatically generate Knowledge Assets based on interactions.
- Publish memory Knowledge Assets to the DKG for future retrieval.

[AI Agent Dev School](https://www.youtube.com/watch?v=ArptLpQiKfI&list=PLx5pnFXdPTRzWla0RaOxALTSTnVq53fKL)
## Providers

## 🎯 Use Cases
### 1. DKG Search Provider

- 🤖 Chatbots
- 🕵️ Autonomous Agents
- 📈 Business Process Handling
- 🎮 Video Game NPCs
- 🧠 Trading
- Executes SPARQL queries on the OriginTrail DKG.
- Retrieves and formats relevant results.
- Integrates DKG data with Eliza’s response system.

## 🚀 Quick Start
## Plugins

### Prerequisites
### 1. Memory Creation Plugin

- [Python 2.7+](https://www.python.org/downloads/)
- [Node.js 23+](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
- [pnpm](https://pnpm.io/installation)
- Creates Knowledge Assets from agent interactions.
- Publishes assets to the DKG with contextual metadata.

> **Note for Windows Users:** [WSL 2](https://learn.microsoft.com/en-us/windows/wsl/install-manual) is required.
## INSTALLATION

### Use the Starter (Recommended)
## Prerequisites

```bash
git clone https://github.com/elizaos/eliza-starter.git
cd eliza-starter
cp .env.example .env
pnpm i && pnpm build && pnpm start
```
- Python 2.7+
- Node.js 23+
- pnpm

### Manually Start Eliza (Only recommended if you know what you are doing)
## Development

#### Checkout the latest release
1. Clone the repository
2. Install dependencies:

```bash
# Clone the repository
git clone https://github.com/elizaos/eliza.git

# This project iterates fast, so we recommend checking out the latest release
git checkout $(git describe --tags --abbrev=0)
# If the above doesn't checkout the latest release, this should work:
# git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
```

#### Edit the .env file

Copy .env.example to .env and fill in the appropriate values.

```
cp .env.example .env
pnpm install
```

Note: .env is optional. If you're planning to run multiple distinct agents, you can pass secrets through the character JSON

#### Start Eliza

```bash
pnpm i
pnpm build
pnpm start

# The project iterates fast, sometimes you need to clean the project if you are coming back to the project
pnpm clean
```

### Interact via Browser

Once the agent is running, you should see the message to run "pnpm start:client" at the end.

Open another terminal, move to same directory, run the command below, then follow the URL to chat with your agent.
3. Build the plugin:

```bash
pnpm start:client
pnpm run build
```

Then read the [Documentation](https://elizaos.github.io/eliza/) to learn how to customize your Eliza.

---

### Automatically Start Eliza

The start script provides an automated way to set up and run Eliza:
4. Run linting:

```bash
sh scripts/start.sh
pnpm run lint
```

For detailed instructions on using the start script, including character management and troubleshooting, see our [Start Script Guide](./docs/docs/guides/start-script.md).
## Usage

> **Note**: The start script handles all dependencies, environment setup, and character management automatically.
### 1. Set Up Environment Variables

---
- Copy the `.env.example` file and rename it to `.env`.
- Fill in the necessary details:
- Node information.
- LLM key.
- Twitter credentials.

### Modify Character
### 2. Customize DKG Knowledge Asset & Query Templates

1. Open `packages/core/src/defaultCharacter.ts` to modify the default character. Uncomment and edit.
- Modify the templates in `plugin-dkg/constants.ts` if you need to change the ontology or data format used in the Knowledge Graph.

2. To load custom characters:
- Use `pnpm start --characters="path/to/your/character.json"`
- Multiple character files can be loaded simultaneously
3. Connect with X (Twitter)
- change `"clients": []` to `"clients": ["twitter"]` in the character file to connect with X
### 3. Create a Character and Run the Agent

---
- Create a character file in the `characters` folder.
- Run the character using the following command:
```bash
pnpm start --characters="characters/chatdkg.character.json"
```

#### Additional Requirements

You may need to install Sharp. If you see an error when starting up, try installing it with the following command:

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

---
- There is no need to manually add `plugin-dkg` to the `plugins` array; You should instead change the plugins imported in the agent/src/index.ts file.
- Ensure you configure the Twitter client and select your LLM provider in the character settings.

### Start Eliza with Gitpod

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/elizaos/eliza/tree/main)

---

### Community & contact

- [GitHub Issues](https://github.com/elizaos/eliza/issues). Best for: bugs you encounter using Eliza, and feature proposals.
- [Discord](https://discord.gg/ai16z). Best for: sharing your applications and hanging out with the community.

## Citation

We now have a [paper](https://arxiv.org/pdf/2501.06781) you can cite for the Eliza OS:
```bibtex
@article{walters2025eliza,
title={Eliza: A Web3 friendly AI Agent Operating System},
author={Walters, Shaw and Gao, Sam and Nerd, Shakker and Da, Feng and Williams, Warren and Meng, Ting-Chien and Han, Hunter and He, Frank and Zhang, Allen and Wu, Ming and others},
journal={arXiv preprint arXiv:2501.06781},
year={2025}
}
```
## Dependencies

## Contributors
- @elizaos/core: workspace:\*
- SPARQL query library: workspace:\*
- DKG JavaScript SDK: dkg.js > ^8.0.4

<a href="https://github.com/elizaos/eliza/graphs/contributors">
<img src="https://contrib.rocks/image?repo=elizaos/eliza" alt="Eliza project contributors" />
</a>
## Contributing

Contributions are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information.

## Star History
## License

[![Star History Chart](https://api.star-history.com/svg?repos=elizaos/eliza&type=Date)](https://star-history.com/#elizaos/eliza&Date)
This plugin is part of the Eliza project. See the main project repository for license information.
Loading

0 comments on commit b15eb45

Please sign in to comment.