Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/madjin/eliza into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Nov 1, 2024
2 parents c90dc39 + 7ee8ad9 commit fe018ed
Show file tree
Hide file tree
Showing 100 changed files with 1,495 additions and 101 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added docs/api/guides/advanced.md
Empty file.
Empty file added docs/api/guides/basic-usage.md
Empty file.
Empty file.
File renamed without changes.
Empty file added docs/api/installation.md
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added docs/api/intro.md
Empty file.
File renamed without changes.
Empty file added docs/api/quickstart.md
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
129 changes: 129 additions & 0 deletions docs/backup_docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
// @ts-check
// `@type` JSDoc annotations allow editor autocompletion and type checking
// (when paired with `@ts-check`).
// There are various equivalent ways to declare your Docusaurus config.
// See: https://docusaurus.io/docs/api/docusaurus-config

import { themes as prismThemes } from "prism-react-renderer";

/** @type {import('@docusaurus/types').Config} */
const config = {
title: "eliza",
tagline: "The flexible, scalable AI agent for everyone",
favicon: "img/favicon.ico",

// Set the production url of your site here
url: "https://docs.ai16z.ai",
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: "/",

// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: "ai16z", // Usually your GitHub org/user name.
projectName: "eliza", // Usually your repo name.

onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",

// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
// may want to replace "en" with "zh-Hans".
i18n: {
defaultLocale: "en",
locales: ["en"],
},

plugins: [
[
"docusaurus-plugin-typedoc",

// Plugin / TypeDoc options
{
entryPoints: ["../src/index.ts"],
tsconfig: "../tsconfig.json",
out: "./docs",
},
],
],

presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: "./sidebars.js",
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl: "https://github.com/ai16z/eliza/tree/main/docs/",
},
theme: {
customCss: "./src/css/custom.css",
},
}),
],
],

themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
// Replace with your project's social card
image: "img/docusaurus-social-card.jpg",
navbar: {
title: "eliza",
items: [
{
type: "docSidebar",
sidebarId: "tutorialSidebar",
position: "left",
label: "API Documentation",
},
{
href: "https://github.com/ai16z/eliza",
label: "GitHub",
position: "right",
},
],
},
footer: {
style: "dark",
links: [
{
title: "Docs",
items: [],
},

{
title: "Community",
items: [
{
label: "Discord",
href: "https://discord.gg/xe7HtWru",
},
{
label: "Twitter",
href: "https://twitter.com/pmairca",
},
],
},
{
title: "More",
items: [
{
label: "GitHub",
href: "https://github.com/ai16z/eliza",
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} ai16z.ai`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
}),
};

export default config;
20 changes: 20 additions & 0 deletions docs/backup_sidebars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Creating a sidebar enables you to:
- create an ordered group of docs
- render a sidebar for each doc of that group
- provide next/previous navigation
The sidebars can be generated from the filesystem, or explicitly defined here.
Create as many sidebars as you want.
*/

// @ts-check

/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
// By default, Docusaurus generates a sidebar from the docs folder structure
tutorialSidebar: [{ type: "autogenerated", dirName: "." }],
};

export default sidebars;
Empty file added docs/docs/guides/advanced.md
Empty file.
Empty file added docs/docs/guides/basic-usage.md
Empty file.
194 changes: 194 additions & 0 deletions docs/docs/guides/characterfile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
---
sidebar_position: 4
---

# Character Files

Character files are JSON-formatted configurations that define an AI character's personality, knowledge, and behavior patterns. This guide explains how to create effective character files for use with LLM agents.

## Structure Overview

A character file contains several key sections that work together to define the character's personality and behavior:

```json
{
"name": "character_name",
"bio": [],
"lore": [],
"knowledge": [],
"messageExamples": [],
"postExamples": [],
"topics": [],
"style": {},
"adjectives": []
}
```

## Core Components

### Bio Array

- Contains biographical information about the character
- Can be a single comprehensive biography or multiple shorter statements
- Multiple statements are randomized to create variety in responses
- Example:

```json
"bio": [
"Mark Andreessen is an American entrepreneur and investor",
"Co-founder of Netscape and Andreessen Horowitz",
"Pioneer of the early web, created NCSA Mosaic"
]
```

### Lore Array

- Contains interesting facts and details about the character
- Helps define personality and unique traits
- Gets randomly sampled during conversations
- Example:

```json
"lore": [
"Believes strongly in the power of software to transform industries",
"Known for saying 'Software is eating the world'",
"Early investor in Facebook, Twitter, and other tech giants"
]
```

### Knowledge Array

- Used for RAG (Retrieval Augmented Generation)
- Can contain chunks of text from articles, books, or other sources
- Helps ground the character's responses in factual information
- Can be generated from PDFs or other documents using provided tools

### Message Examples

- Sample conversations between users and the character
- Helps establish the character's conversational style
- Should cover various topics and scenarios
- Example:

```json
"messageExamples": [
[
{"user": "user1", "content": {"text": "What's your view on AI?"}},
{"user": "character", "content": {"text": "AI is transforming every industry..."}}
]
]
```

### Style Object

Contains three key sections:

1. `all`: General style instructions for all interactions
2. `chat`: Specific instructions for chat interactions
3. `post`: Specific instructions for social media posts

Each section can contain multiple instructions that guide the character's communication style.

### Topics Array

- List of subjects the character is interested in or knowledgeable about
- Used to guide conversations and generate relevant content
- Helps maintain character consistency

### Adjectives Array

- Words that describe the character's traits and personality
- Used for generating responses with consistent tone
- Can be used in "Mad Libs" style content generation

## Best Practices

1. **Randomization for Variety**

- Break bio and lore into smaller chunks
- This creates more natural, varied responses
- Prevents repetitive or predictable behavior

2. **Knowledge Management**

- Use the provided tools to convert documents into knowledge:

```bash
npx folder2knowledge <path/to/folder>
npx knowledge2character <character-file> <knowledge-file>
```

3. **Style Instructions**

- Be specific about communication patterns
- Include both dos and don'ts
- Consider platform-specific behavior (chat vs posts)
4. **Message Examples**
- Include diverse scenarios
- Show character-specific responses
- Demonstrate typical interaction patterns
## Tools and Utilities
1. **Generate from Twitter**
```bash
npx tweets2character
```
2. **Convert Documents to Knowledge**
```bash
npx folder2knowledge <path/to/folder>
```
3. **Add Knowledge to Character**
```bash
npx knowledge2character <character-file> <knowledge-file>
```
## Context Length Considerations
- Modern LLMs support longer contexts (128k tokens)
- No strict limits on section lengths
- Focus on quality and relevance rather than size
- Consider randomization for large collections of information
## Validation
You can validate your character file against the schema using provided tools:
```bash
# Python
python examples/validate.py
# JavaScript
node examples/validate.mjs
```
## Tips for Quality
1. **Bio and Lore**
- Mix factual and personality-defining information
- Include both historical and current details
- Break into modular, reusable pieces
2. **Style Instructions**
- Be specific about tone and mannerisms
- Include platform-specific guidance
- Define clear boundaries and limitations
3. **Examples**
- Cover common scenarios
- Show character-specific reactions
- Demonstrate proper tone and style
4. **Knowledge**
- Focus on relevant information
- Organize in digestible chunks
- Update regularly to maintain relevance
Empty file.
Loading

0 comments on commit fe018ed

Please sign in to comment.