Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Version 0.0.11 Release #123

Merged
merged 35 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
fdb94a7
improvement: add serialize method in monitor module and tweak executi…
EdwinInAu Jul 2, 2024
2b6af77
improvement: add exception handling and retry mechanism in peer agents.
EdwinInAu Jul 3, 2024
33d2082
add stream output
weizjajj Jul 3, 2024
f03c756
fix proxy
weizjajj Jul 3, 2024
7b9b6f2
feat: add the data agent to build datasets and evaluate the quality o…
EdwinInAu Jul 3, 2024
ed359d0
improvement: tweak set_by_agent_model method and remove deep copy logic.
EdwinInAu Jul 4, 2024
3618aa0
fix
weizjajj Jul 4, 2024
b335716
improvement: add serialize method in monitor module and tweak executi…
EdwinInAu Jul 4, 2024
1edb7a5
Merge pull request #113 from alipay/dev_weizj
LandJerry Jul 4, 2024
f10764e
fix
weizjajj Jul 5, 2024
ae62e1e
fix: remove exception handling and retry mechanism in peer agents
EdwinInAu Jul 8, 2024
1648552
fix end error
weizjajj Jul 9, 2024
85652c9
feat: add the data agent to build datasets and evaluate the quality o…
EdwinInAu Jul 8, 2024
c9612a8
Merge pull request #119 from alipay/dev_weizj
LandJerry Jul 9, 2024
d3e6b96
feat: add the data agent to build datasets and evaluate the quality o…
EdwinInAu Jul 9, 2024
34581d3
feat: add the data agent to build datasets and evaluate the quality o…
EdwinInAu Jul 9, 2024
122fa27
feat: add the data agent to build datasets and evaluate the quality o…
EdwinInAu Jul 10, 2024
9587962
add sql tool
weizjajj Jul 10, 2024
4b23919
fix yaml
weizjajj Jul 10, 2024
0839106
Merge pull request #112 from alipay/dev_chongshi
LandJerry Jul 10, 2024
15b8351
feat: add the data agent to build datasets and evaluate the quality o…
EdwinInAu Jul 10, 2024
ba6ed25
feat: add the data agent English doc.
EdwinInAu Jul 10, 2024
eab2fea
feat: add the data agent English doc.
EdwinInAu Jul 10, 2024
1ec1eca
tool support agent
weizjajj Jul 11, 2024
7861c42
tool support agent
weizjajj Jul 11, 2024
cb2d1a2
Merge branch 'dev' into dev_weizj
weizjajj Jul 11, 2024
51be5ed
tool support agent
weizjajj Jul 11, 2024
ab249f8
fix stream
weizjajj Jul 11, 2024
d71c57e
add review,planning stream
weizjajj Jul 11, 2024
8bcf3b1
remove
weizjajj Jul 11, 2024
3ec6e25
fix type
weizjajj Jul 11, 2024
d19723e
Merge pull request #114 from alipay/dev_chongshi_data
LandJerry Jul 11, 2024
772909a
Merge pull request #121 from alipay/dev_weizj
LandJerry Jul 11, 2024
5a05949
docs: update README & modify index of guidebook
LandJerry Jul 11, 2024
0b99384
feat: Version 0.0.11 Release
LandJerry Jul 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ Note - Additional remarks regarding the version.
***************************************************

# Version Update History
## [0.0.11] - 2024-07-11
### Added
- DataAgent Autonomous Data Agent MVP Version Released
- Minimum Viable Product version, DataAgent aims to empower your agent with the capability of self-assessment and evolution through intelligent agent abilities. For detailed information, please refer to the user documentation.
- Added intermediate information streaming output capabilities in PEER and ReAct modes

### Note
- Latest PEER research findings released
- This paper provides a detailed introduction to the mechanisms and principles of the PEER multi-agent framework. Experimental validation proves the advancement of the PEER model. For detailed information, please refer to the user documentation.
- Added use cases
- Andrew Ng's Reflexive Workflow Translation Agent Replication
- Some code optimizations and documentation updates.

## [0.0.10] - 2024-06-28
### Added
- Added standard integration for the DeepSeek model in the LLM module.
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ Note - 对于版本的额外说明。
***************************************************

# 版本更新记录
## [0.0.11] - 2024-07-11
### Added
- DataAgent数据自治智能体MVP版本发布
- Minimum Viable Product版本,DataAgent旨在使用智能体能力让您的Agent拥有自我评价与演进的能力,详细内容请查阅用户文档。
- 增加PEER、ReAct模式中间信息流式输出能力

### Note
- PEER最新研究成果发布
- 该文献详细介绍了介绍了PEER多智能体框架的机制原理,同时在实验部分通过验证证明了PEER模式的先进性,详细内容请查阅用户文档。
- 新增使用案例
- 吴恩达反思工作流翻译智能体复刻
- 部分代码优化与文档更新

## [0.0.10] - 2024-06-28
### Added
- LLM组件新增DeepSeek模型标准接入
Expand Down
33 changes: 27 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Language version: [English](./README.md) | [中文](./README_zh.md) | [日本語
![](https://img.shields.io/badge/framework-agentUniverse-pink)
![](https://img.shields.io/badge/python-3.10%2B-blue?logo=Python)
[![](https://img.shields.io/badge/%20license-Apache--2.0-yellow)](LICENSE)
[![Static Badge](https://img.shields.io/badge/pypi-v0.0.10-blue?logo=pypi)](https://pypi.org/project/agentUniverse/)
[![Static Badge](https://img.shields.io/badge/pypi-v0.0.11-blue?logo=pypi)](https://pypi.org/project/agentUniverse/)

![](docs/guidebook/_picture/logo_bar.jpg)
****************************************
Expand Down Expand Up @@ -35,6 +35,7 @@ More patterns are coming soon...
* [User Guide](#User-Guide)
* [API Reference](#API-Reference)
* [Support](#Support)
* [Citation](#Citation)
* [Acknowledgements](#Acknowledgements)
****************************************
## Quick Start
Expand Down Expand Up @@ -64,6 +65,11 @@ For more details, please read the [Quick Start](./docs/guidebook/en/1_3_Quick_St

[Financial Event Analysis Based on PEER Multi-Agent Mode](./docs/guidebook/en/6_4_1_Financial_Event_Analysis_Case.md)

[Andrew Ng's Reflexive Workflow Translation Agent Replication](./docs/guidebook/en/7_1_1_Translation_Case.md)

#### 🚩 DataAgent - Data Autonomous Agent
agentUniverse has launched DataAgent (Minimum Viable Product Version). DataAgent aims to empower your agent with the capability of self-assessment and evolution through the use of intelligent agent abilities. For more details, please refer to the documentation. [DataAgent - Data Autonomous Agent](./docs/guidebook/en/8_1_1_data_autonomous_agent.md)

### 🌟 Example Projects
[agentUniverse Example Projects](sample_standard_app)

Expand Down Expand Up @@ -98,11 +104,26 @@ For more details, please read the [Quick Start](./docs/guidebook/en/1_3_Quick_St
#### Contact Us via Administrator Email
😊 Email: [jerry.zzw@antgroup.com](mailto:jerry.zzw@antgroup.com)

#### WeChat Official Account

😊 Official Account ID: **agentUniverse智多星**

You can get more related articles and information in our WeChat Official Account.
#### twitter
ID: [@agentuniverse_](https://x.com/agentuniverse_)

### Citation
The agentUniverse project is supported by the following research achievements.

BibTeX formatted
```text
@misc{wang2024peerexpertizingdomainspecifictasks,
title={PEER: Expertizing Domain-Specific Tasks with a Multi-Agent Framework and Tuning Methods},
author={Yiying Wang and Xiaojing Li and Binzhu Wang and Yueyang Zhou and Han Ji and Hong Chen and Jinshi Zhang and Fei Yu and Zewei Zhao and Song Jin and Renji Gong and Wanqing Xu},
year={2024},
eprint={2407.06985},
archivePrefix={arXiv},
primaryClass={cs.AI},
url={https://arxiv.org/abs/2407.06985},
}
```
Overview: This document provides a detailed introduction to the mechanisms and principles of the PEER multi-agent framework. In the experimental section, scores were assigned across seven dimensions: completeness, relevance, conciseness, factualness, logicality, structure, and comprehensiveness (each dimension has a maximum score of 5 points). The PEER model scored higher on average in each evaluation dimension compared to BabyAGI and demonstrated significant advantages in the dimensions of completeness, relevance, logicality, structure, and comprehensiveness. Additionally, the PEER model achieved a superior rate of 83% over BabyAGI using the GPT-3.5 Turbo (16k) model, and 81% using the GPT-4 model. For more details, please refer to the document.
https://arxiv.org/pdf/2407.06985

## Acknowledgements
This project is partially built on excellent open-source projects such as langchain, pydantic, gunicorn, flask, SQLAlchemy, chromadb, etc. (The detailed dependency list can be found in pyproject.toml). We would like to extend special thanks to the related projects and contributors. 🙏🙏🙏
32 changes: 31 additions & 1 deletion README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
![](https://img.shields.io/badge/framework-agentUniverse-pink)
![](https://img.shields.io/badge/python-3.10%2B-blue?logo=Python)
[![](https://img.shields.io/badge/%20license-Apache--2.0-yellow)](LICENSE)
[![Static Badge](https://img.shields.io/badge/pypi-v0.0.10-blue?logo=pypi)](https://pypi.org/project/agentUniverse/)
[![Static Badge](https://img.shields.io/badge/pypi-v0.0.11-blue?logo=pypi)](https://pypi.org/project/agentUniverse/)

![](docs/guidebook/_picture/logo_bar.jpg)
****************************************
Expand Down Expand Up @@ -34,6 +34,7 @@
* [用户指南](#用户指南)
* [API参考](#API参考)
* [支持](#支持)
* [文献](#文献)
* [鸣谢](#鸣谢)
****************************************
## 快速开始
Expand Down Expand Up @@ -61,6 +62,12 @@ pip install agentUniverse

[基于PEER协同模式的金融事件分析](./docs/guidebook/zh/6_4_1_金融事件分析案例.md)

[吴恩达反思工作流翻译智能体复刻](./docs/guidebook/zh/7_1_1_翻译案例.md)


#### 🚩 DataAgent - 数据自治智能体
agentUniverse推出了DataAgent(Minimum Viable Product版本), DataAgent旨在使用智能体能力让您的Agent拥有自我评价与演进的能力。详情见文档: [DataAgent - 数据自治智能体](./docs/guidebook/zh/8_1_1_数据自治智能体.md)

### 🌟 示例项目
[agentUniverse 示例项目](sample_standard_app)

Expand Down Expand Up @@ -105,7 +112,30 @@ pip install agentUniverse

😊 公众号ID:**agentUniverse智多星**

![](./docs/guidebook/_picture/wechat_official.png)

更多相关的文章与资讯你可以在微信公众号中获取。

#### twitter
ID: [@agentuniverse_](https://x.com/agentuniverse_)

### 文献
agentUniverse项目基于以下的研究成果支撑。

BibTeX formatted
```text
@misc{wang2024peerexpertizingdomainspecifictasks,
title={PEER: Expertizing Domain-Specific Tasks with a Multi-Agent Framework and Tuning Methods},
author={Yiying Wang and Xiaojing Li and Binzhu Wang and Yueyang Zhou and Han Ji and Hong Chen and Jinshi Zhang and Fei Yu and Zewei Zhao and Song Jin and Renji Gong and Wanqing Xu},
year={2024},
eprint={2407.06985},
archivePrefix={arXiv},
primaryClass={cs.AI},
url={https://arxiv.org/abs/2407.06985},
}
```
文献简介:该文献详细介绍了介绍了PEER多智能体框架的机制原理,同时在实验部分分别从**完整性、相关性、紧凑性、事实性、逻辑性、结构性和全面性七个维度进行打分(各纬度满分为5分)**,PEER模式在每个测评维度的平均分数均高于BabyAGI,且在**完整性、相关性、逻辑性、结构性和全面性五个纬度有显著优势**;同时PEER模式在 GPT-3.5 turbo (16k) 模型下相较于 BabyAGI 的择优胜率达到 83%,在 GPT-4o 模型下择优胜率达到 81%,更多详情请阅读文献。
https://arxiv.org/pdf/2407.06985

## 鸣谢
本项目部分基于langchain、pydantic、gunicorn、flask、SQLAlchemy、chromadb等(详细依赖列表可见pyproject.toml)优秀开源项目实现,在此特别感谢相关项目与关联方。 🙏🙏🙏
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ def execute(self, input_object: InputObject, agent_input: dict) -> dict:
framework = agent_input.get('framework', [])
futures = []
for task in framework:
agent_input_copy: dict = copy.deepcopy(agent_input)
# note: agent input shallow copy.
agent_input_copy: dict = dict(agent_input)
agent_input_copy['input'] = task
planner: Planner = PlannerManager().get_instance_obj(self.agent_model.plan.get('planner').get('name'))
futures.append(
Expand All @@ -99,7 +100,8 @@ def process_intput_object(self, input_object: InputObject, subtask: str, planner
# get agent toolsets.
action: dict = self.agent_model.action or dict()
tools: list = action.get('tool') or list()
input_object_copy: InputObject = copy.deepcopy(input_object)
# note: input object shallow copy.
input_object_copy: InputObject = InputObject(input_object.to_dict())
# wrap input_object for agent knowledge.
input_object_copy.add_data(planner_input_key, subtask)
# wrap input_object for agent toolsets.
Expand Down
13 changes: 7 additions & 6 deletions agentuniverse/agent/memory/chat_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,18 @@ def as_langchain(self) -> BaseChatMemory:
max_token_limit=self.max_tokens, messages=self.messages,
prompt_version=self.prompt_version)

def set_by_agent_model(self, **kwargs) -> None:
def set_by_agent_model(self, **kwargs):
""" Assign values of parameters to the ChatMemory model in the agent configuration."""
super().set_by_agent_model(**kwargs)
copied_obj = super().set_by_agent_model(**kwargs)
if 'messages' in kwargs and kwargs['messages']:
self.messages = kwargs['messages']
copied_obj.messages = kwargs['messages']
if 'llm' in kwargs and kwargs['llm']:
self.llm = kwargs['llm']
copied_obj.llm = kwargs['llm']
if 'input_key' in kwargs and kwargs['input_key']:
self.input_key = kwargs['input_key']
copied_obj.input_key = kwargs['input_key']
if 'output_key' in kwargs and kwargs['output_key']:
self.output_key = kwargs['output_key']
copied_obj.output_key = kwargs['output_key']
return copied_obj

def initialize_by_component_configer(self, component_configer: MemoryConfiger) -> 'ChatMemory':
"""Initialize the chat memory by the ComponentConfiger object.
Expand Down
9 changes: 6 additions & 3 deletions agentuniverse/agent/memory/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@ def as_langchain(self) -> BaseMemory:
"""Convert the agentUniverse(aU) memory class to the langchain memory class."""
pass

def set_by_agent_model(self, **kwargs) -> None:
def set_by_agent_model(self, **kwargs):
""" Assign values of parameters to the Memory model in the agent configuration."""
# note: default shallow copy
copied_obj = self.model_copy()
if 'memory_key' in kwargs and kwargs['memory_key']:
self.memory_key = kwargs['memory_key']
copied_obj.memory_key = kwargs['memory_key']
if 'max_tokens' in kwargs and kwargs['max_tokens']:
self.max_tokens = kwargs['max_tokens']
copied_obj.max_tokens = kwargs['max_tokens']
return copied_obj

def get_instance_code(self) -> str:
"""Return the full name of the memory."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def invoke(self, agent_model: AgentModel, planner_input: dict, input_object: Inp
history_messages_key="chat_history",
input_messages_key=self.input_key,
) | StrOutputParser()
res = asyncio.run(
chain_with_history.ainvoke(input=planner_input, config={"configurable": {"session_id": "unused"}}))

res = self.invoke_chain(agent_model, chain_with_history, planner_input, chat_history, input_object)
return {**planner_input, self.output_key: res, 'chat_history': generate_memories(chat_history)}

def handle_prompt(self, agent_model: AgentModel, planner_input: dict) -> Prompt:
Expand Down
20 changes: 17 additions & 3 deletions agentuniverse/agent/plan/planner/peer_planner/peer_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def invoke(self, agent_model: AgentModel, planner_input: dict, input_object: Inp
"""
planner_config = agent_model.plan.get('planner')
sub_agents = self.generate_sub_agents(planner_config)
return self.agents_run(sub_agents, planner_config, planner_input, input_object)
return self.agents_run(agent_model, sub_agents, planner_config, planner_input, input_object)

@staticmethod
def generate_sub_agents(planner_config: dict) -> dict:
Expand Down Expand Up @@ -79,7 +79,8 @@ def build_expert_framework(planner_config: dict, input_object: InputObject):
elif context:
input_object.add_data('expert_framework', context)

def agents_run(self, agents: dict, planner_config: dict, agent_input: dict, input_object: InputObject) -> dict:
def agents_run(self, agent_mode: AgentModel, agents: dict, planner_config: dict, agent_input: dict,
input_object: InputObject) -> dict:
"""Planner agents run.

Args:
Expand Down Expand Up @@ -125,6 +126,10 @@ def agents_run(self, agents: dict, planner_config: dict, agent_input: dict, inpu
for index, one_framework in enumerate(planning_result.get_data('framework')):
logger_info += f"[{index + 1}] {one_framework} \n"
LOGGER.info(logger_info)
self.stream_output(input_object, {"data": {
'output': planning_result.to_dict(),
"agent_info": agent_mode.info
}, "type": "planning"})

if not executing_result or jump_step in ["planning", "executing"]:
if not executingAgent:
Expand All @@ -143,6 +148,10 @@ def agents_run(self, agents: dict, planner_config: dict, agent_input: dict, inpu
one_exec_log_info += f"[{index + 1}] output: {one_exec_res['output']}\n"
logger_info += one_exec_log_info
LOGGER.info(logger_info)
self.stream_output(input_object, {"data": {
'output': executing_result.to_dict(),
"agent_info": agent_mode.info
}, "type": "executing"})

if not expressing_result or jump_step in ["planning", "executing", "expressing"]:
if not expressingAgent:
Expand All @@ -157,6 +166,10 @@ def agents_run(self, agents: dict, planner_config: dict, agent_input: dict, inpu
logger_info = f"\nExpressing agent execution result is :\n"
logger_info += f"{expressing_result.get_data('output')}"
LOGGER.info(logger_info)
self.stream_output(input_object, {"data": {
'output': expressing_result.get_data('output'),
"agent_info": agent_mode.info
}, "type": "expressing"})

if not reviewing_result or jump_step in ["planning", "executing", "expressing", "reviewing"]:
if not reviewingAgent:
Expand All @@ -172,14 +185,15 @@ def agents_run(self, agents: dict, planner_config: dict, agent_input: dict, inpu
else:
LOGGER.info(f"Starting reviewing agent.")
reviewing_result = reviewingAgent.run(**input_object.to_dict())

input_object.add_data('reviewing_result', reviewing_result)

# add reviewing agent log info
logger_info = f"\nReviewing agent execution result is :\n"
reviewing_info_str = f"review suggestion: {reviewing_result.get_data('suggestion')} \n"
reviewing_info_str += f"review score: {reviewing_result.get_data('score')} \n"
LOGGER.info(logger_info + reviewing_info_str)

self.stream_output(input_object, {"data": reviewing_result.to_dict(), "type": "reviewing"})
if reviewing_result.get_data('score') and reviewing_result.get_data('score') >= eval_threshold:
loopResults.append({
"planning_result": planning_result,
Expand Down
Loading