Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
1ce78b4
basic conversation agent done.
chenweize1998 May 16, 2023
fbe1a23
fix bugs in initializing OpenAIChat model
chenweize1998 May 16, 2023
ed47ff7
add some comment
chenweize1998 May 16, 2023
f9e6c77
add tool agent
chenweize1998 May 17, 2023
0cd7da1
fix bugs in tool agent
chenweize1998 May 17, 2023
aa4666e
add registry for memory and agent
chenweize1998 May 17, 2023
87d0718
add summary memory
chenweize1998 May 17, 2023
4534e83
remove unnecessary codees
chenweize1998 May 17, 2023
4df7d14
some code cleaning
chenweize1998 May 17, 2023
a742d50
fix a bug in classroom_withtool example
chenweize1998 May 17, 2023
240a2db
add ui
yushengsu-thu May 18, 2023
8140bfa
add dist for ui
chenweize1998 May 18, 2023
00a396f
basic prisoner not finished yet
chanchimin May 18, 2023
cd4c1ce
delete redundant UI code.
yushengsu-thu May 18, 2023
1ca1231
creative
chanchimin May 18, 2023
6aa306f
remove key
chanchimin May 18, 2023
1f22aa4
add environment in agent parse
chanchimin May 18, 2023
0c80def
remove key
chanchimin May 18, 2023
218d49f
fix
chanchimin May 18, 2023
f38b8c5
remove conflic
chanchimin May 18, 2023
766fc4f
pull origin
chanchimin May 18, 2023
3160379
merge
chanchimin May 18, 2023
018bfb1
add history message in demo.
yushengsu-thu May 18, 2023
1ff9626
fix config
chanchimin May 18, 2023
21e33cf
fix parser
chanchimin May 18, 2023
8957448
add prison ui.
yushengsu-thu May 18, 2023
e903aa0
config.yaml
chanchimin May 18, 2023
69fe8e9
text example
yushengsu-thu May 18, 2023
4ee6aa9
add the logic of interacting by pressing space.
chenweize1998 May 19, 2023
23e9a77
Merge branch 'remove_langchain' of github.com:OpenBMB/AgentVerse into…
chenweize1998 May 19, 2023
6ae0090
proper prompt
yushengsu-thu May 19, 2023
ff530b1
update config
chenweize1998 May 19, 2023
446d4b3
add personality and relation_ship
chanchimin May 19, 2023
4c85f27
Merge branch 'zqm_dev' of https://github.com/OpenBMB/AgentVerse into …
chanchimin May 19, 2023
33ec726
ui uses rex plugins. add input box
chenweize1998 May 19, 2023
0241891
p->s1->p->s2
chanchimin May 19, 2023
d0c2f22
pokemon example can now talk to one npc
chenweize1998 May 20, 2023
c8b9856
fix the bug of waiting box not disappear. add npc face direction
chenweize1998 May 20, 2023
58111dc
add multiple npcs
chenweize1998 May 20, 2023
1a98b8f
Merge remote-tracking branch 'origin/zqm_dev' into remove_langchain
chenweize1998 May 21, 2023
e538e21
reorganize prisoner dilema task
chenweize1998 May 21, 2023
3ee2b60
add prisoner_dilema demo
yushengsu-thu May 21, 2023
82c85e0
add avarts in the prison case.
yushengsu-thu May 21, 2023
71dd784
update demo
yushengsu-thu May 21, 2023
d4ea3ab
add: agentverse for database diagnosis
May 22, 2023
8dc861b
Merge branch 'remove_langchain' into database_diagnosis
May 22, 2023
f35a967
Merge pull request #5 from zhouxh19/database_diagnosis
chenweize1998 May 22, 2023
c790535
update pokemon assets
chenweize1998 May 22, 2023
3a9fd29
Merge branch 'remove_langchain' of github.com:OpenBMB/AgentVerse into…
chenweize1998 May 22, 2023
94b41c7
add bottom
yushengsu-thu May 23, 2023
0759a65
code cleaning
chenweize1998 May 23, 2023
98c0df1
Merge branch 'remove_langchain' of github.com:OpenBMB/AgentVerse into…
chenweize1998 May 23, 2023
79e0925
remove unnecessary files
chenweize1998 May 23, 2023
e40e2e1
remove debugging code
chenweize1998 May 23, 2023
ed507e3
Update README.md
chenweize1998 May 23, 2023
e8413df
Update README.md
chenweize1998 May 23, 2023
fc7b241
Update README.md
chenweize1998 May 23, 2023
33febc1
Update README.md
chenweize1998 May 24, 2023
2dc33b7
Update README
chenweize1998 May 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ __pycache__/
.Python
build/
develop-eggs/
dist/
**/dist/*
!**/dist/assets
!**/dist/index.html
downloads/
eggs/
.eggs/
Expand Down Expand Up @@ -158,9 +160,11 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea
.vscode
.DS_Store
figs
frontend

g_push.sh
raw/
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

- 🛠 **Tools (Plugins) Utilization**: AgentVerse supports the multi-agent environments with tools. Currently, AgentVerse supports tools provided in [BMTools](https://github.com/OpenBMB/BMTools).

- 🤖 **Supports a Wide Range of LLMs**: Our framework is built on top of [LangChain](https://github.com/hwchase17/langchain), which supports a wide range of different large language models. You can also easily customize your own LLM by referring to the [LangChain documentation](https://python.langchain.com/en/latest/modules/models/llms/examples/custom_llm.html).
- 🤖 **Supports a Wide Range of LLMs**: You can easily customize your own LLM by implementing a new LLM by inheriting and extending our BaseLLM class (tutorial coming soon).

### 🗓 Coming Soon

Expand Down Expand Up @@ -119,7 +119,7 @@ By abstracting the environment into these five components, we have created a hig

### Agent

Another fundamental component is the agent. The agent in our framework is built on LangChain. Thanks for the wide variety of LLMs supported in LangChain, our framework can takes in different LLM as the backend of the agent.
Another fundamental component is the agent. Currently we provide two types of agents: **ConversationAgent** and **ToolAgent**. You can also customize your own agent by inheriting BaseAgent class (tutorial coming soon).



Expand All @@ -145,19 +145,19 @@ First, we need to create a task directory and write our configuration file for t
```yaml
# config.yaml
environment:
env_type: base # Use the basic environment provided in AgentVerse
env_type: basic # Use the basic environment provided in AgentVerse
max_turns: 10 # Specify the maximum number of dialogue turns
rule:
order:
type: sequential # Use the sequential order
visibility:
type: all # Each message can be seen by all agents
selector:
type: base # Basic selector (do not select)
type: basic # Basic selector (do not select)
updater:
type: base # Basic updater (update the message to all agents)
type: basic # Basic updater (update the message to all agents)
describer:
type: base # Basic describer (no description)
type: basic # Basic describer (no description)
```

This configuration specifies that we will use the basic environment provided in AgentVerse, with a maximum of 10 dialogue turns. We'll use the sequential order, with all messages visible to all agents. We won't be using any selectors, our updater will update the messages to all the agents and our describer will provide no description.
Expand All @@ -170,25 +170,24 @@ Next, we'll configure the agents. In the `config.yaml` file, we'll add the confi
# config.yaml
agents:
-
agent_type: chat
agent_type: conversation
name: Professor Micheal # Name of the agent
role_description: You are Prof. Micheal, ... # Description of the agent
memory:
memory_type: chat_message_history # Will store all the chat history
prefix_prompt: *prefix_prompt
format_prompt: *format_prompt
suffix_prompt: *suffix_prompt
memory_type: chat_history # Will store all the chat history
prompt_template: *professor_prompt
llm:
llm_type: text-davinci-003
llm_type: text-davinci-003 # Will use OpenAICompletion LLM
model: text-davinci-003 # The argument passed to the api call
temperature: 0.7
max_tokens: 250
```

In this example, we'll use the `chat` agent type. We've given the agent a name and a description, and we'll store the chat history in memory. We've also provided a pr ompt for the agent, divided into three parts: `prefix_prompt`, `format_prompt`, and `suffix_prompt`. These will be concatenated to form the final prompt given to the agent.
In this example, we'll use the `conversation` agent type. We've given the agent a name and a description, and we'll store the chat history in memory. We've also provided a prompt template with placeholders marked as ${placeholder}. These will be instantiated by the `_fill_prompt_template` method of the agent.

##### 3. Writing an Output Parser

The next step is to write a simple parser for your agent's response. Because you have specified the output format in `format_prompt`, you need to provide a corresponding parser. In this example, we let the model to output in the following format
The next step is to write a simple parser for your agent's response. Because you may have specified the output format in your prompt template, you need to provide a corresponding parser. In this example, we inform the model to output in the following format in our prompt template

```
Action: Speak
Expand All @@ -201,11 +200,11 @@ With these steps, we've successfully built a simple classroom environment and cu

### Customization Guide for More Complex Environments

While we provide a basic framework for building environments with our five rule components, more complex environments may require further customization. Here are some steps you can take to customize your environment:
While we provide a basic framework for building environments with our five rule components, more complex environments may require further customization. A detailed documentation and tutorial is coming soon. Here we briefly introduce some steps you can take to customize your environment:

1. **Customize the five rule components**. Each rule component has an interface, allowing you to customize its behavior to suit your specific needs. It's important to note that these components are not necessarily independent and can interact through the `rule_params` dictionary in the environment. You can create your own rule components and integrate them with the existing ones to build more complex interactions between agents.
2. **Customize the environment itself**. Our `base` environment provides a default execution order for the five rule components that is suitable for most cases, but you can inherit the `BaseEnvironment` class and write your own `run` method to implement a more sophisticated execution order.
3. **Customize the agent**. Depending on your specific use case, you may also need to customize the `Agent` class. For example, you may want to use your local LLM as your agents or create agents with specialized knowledge or skills.
2. **Customize the environment itself**. Our `basic` environment provides a default execution order for the five rule components that is suitable for most cases, but you can inherit the `BaseEnvironment` class and write your own `run` method to implement a more sophisticated execution order.
3. **Customize the agent**. Depending on your specific use case, you may also need to customize the `Agent` class. For example, you may want to use your local LLM as your agents or create agents with specialized knowledge or skills.



Expand All @@ -220,3 +219,4 @@ Here's a brief overview of each example:
3. `nlp_classroom_9players_group`: This example introduces group discussions. The professor can launch a group discussion when necessary, and students can only interact with other students in the same group during the group discussion.
4. `nlp_classroom_3players_withtool`: Students in this classroom can use Bing search API when listening to the class.
5. `math_problem_2players_tools`: A simple example demonstrating how two agents can use the WolframAlpha API to play an arithmetic game.
6. `prisoner_dilema`: A simple example showing how LLMs handle the prisoner dilema.
66 changes: 0 additions & 66 deletions agentverse/UI.py

This file was deleted.

12 changes: 10 additions & 2 deletions agentverse/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .tasks import *
from .agents import Agent

# from .agents import Agent
from .environments import env_registry
from .environments.rules import Rule
from .environments.rules.order import order_registry
Expand All @@ -8,4 +9,11 @@
from .environments.rules.updater import updater_registry
from .environments.rules.visibility import visibility_registry
from .agentverse import AgentVerse
from .initialization import prepare_task_config, load_agent, load_environment, load_tools, load_llm, load_memory
from .initialization import (
prepare_task_config,
load_agent,
load_environment,
load_tools,
load_llm,
load_memory,
)
10 changes: 9 additions & 1 deletion agentverse/agents/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
from .agent import Agent
# from .agent import Agent
from agentverse.registry import Registry

agent_registry = Registry(name="AgentRegistry")

from .base import BaseAgent
from .conversation_agent import ConversationAgent
from .tool_agent import ToolAgent
from .prisoner_dilema_agent import PoliceAgent, PrisonerAgent
Loading