Skip to content

Commit 5ba4db5

Browse files
authored
Merge pull request #123 from alipay/dev
feat: Version 0.0.11 Release
2 parents 759bf74 + 0b99384 commit 5ba4db5

File tree

78 files changed

+2005
-150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+2005
-150
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ Note - Additional remarks regarding the version.
2424
***************************************************
2525

2626
# Version Update History
27+
## [0.0.11] - 2024-07-11
28+
### Added
29+
- DataAgent Autonomous Data Agent MVP Version Released
30+
- 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.
31+
- Added intermediate information streaming output capabilities in PEER and ReAct modes
32+
33+
### Note
34+
- Latest PEER research findings released
35+
- 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.
36+
- Added use cases
37+
- Andrew Ng's Reflexive Workflow Translation Agent Replication
38+
- Some code optimizations and documentation updates.
39+
2740
## [0.0.10] - 2024-06-28
2841
### Added
2942
- Added standard integration for the DeepSeek model in the LLM module.

CHANGELOG_zh.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ Note - 对于版本的额外说明。
2424
***************************************************
2525

2626
# 版本更新记录
27+
## [0.0.11] - 2024-07-11
28+
### Added
29+
- DataAgent数据自治智能体MVP版本发布
30+
- Minimum Viable Product版本,DataAgent旨在使用智能体能力让您的Agent拥有自我评价与演进的能力,详细内容请查阅用户文档。
31+
- 增加PEER、ReAct模式中间信息流式输出能力
32+
33+
### Note
34+
- PEER最新研究成果发布
35+
- 该文献详细介绍了介绍了PEER多智能体框架的机制原理,同时在实验部分通过验证证明了PEER模式的先进性,详细内容请查阅用户文档。
36+
- 新增使用案例
37+
- 吴恩达反思工作流翻译智能体复刻
38+
- 部分代码优化与文档更新
39+
2740
## [0.0.10] - 2024-06-28
2841
### Added
2942
- LLM组件新增DeepSeek模型标准接入

README.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Language version: [English](./README.md) | [中文](./README_zh.md) | [日本語
55
![](https://img.shields.io/badge/framework-agentUniverse-pink)
66
![](https://img.shields.io/badge/python-3.10%2B-blue?logo=Python)
77
[![](https://img.shields.io/badge/%20license-Apache--2.0-yellow)](LICENSE)
8-
[![Static Badge](https://img.shields.io/badge/pypi-v0.0.10-blue?logo=pypi)](https://pypi.org/project/agentUniverse/)
8+
[![Static Badge](https://img.shields.io/badge/pypi-v0.0.11-blue?logo=pypi)](https://pypi.org/project/agentUniverse/)
99

1010
![](docs/guidebook/_picture/logo_bar.jpg)
1111
****************************************
@@ -35,6 +35,7 @@ More patterns are coming soon...
3535
* [User Guide](#User-Guide)
3636
* [API Reference](#API-Reference)
3737
* [Support](#Support)
38+
* [Citation](#Citation)
3839
* [Acknowledgements](#Acknowledgements)
3940
****************************************
4041
## Quick Start
@@ -64,6 +65,11 @@ For more details, please read the [Quick Start](./docs/guidebook/en/1_3_Quick_St
6465

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

68+
[Andrew Ng's Reflexive Workflow Translation Agent Replication](./docs/guidebook/en/7_1_1_Translation_Case.md)
69+
70+
#### 🚩 DataAgent - Data Autonomous Agent
71+
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)
72+
6773
### 🌟 Example Projects
6874
[agentUniverse Example Projects](sample_standard_app)
6975

@@ -101,11 +107,26 @@ For more details, please read the [Quick Start](./docs/guidebook/en/1_3_Quick_St
101107
[jerry.zzw@antgroup.com](mailto:jerry.zzw@antgroup.com)
102108
[jinshi.zjs@antgroup.com](mailto:jinshi.zjs@antgroup.com)
103109

104-
#### WeChat Official Account
105-
106-
😊 Official Account ID: **agentUniverse智多星**
107-
108-
You can get more related articles and information in our WeChat Official Account.
110+
#### twitter
111+
ID: [@agentuniverse_](https://x.com/agentuniverse_)
112+
113+
### Citation
114+
The agentUniverse project is supported by the following research achievements.
115+
116+
BibTeX formatted
117+
```text
118+
@misc{wang2024peerexpertizingdomainspecifictasks,
119+
title={PEER: Expertizing Domain-Specific Tasks with a Multi-Agent Framework and Tuning Methods},
120+
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},
121+
year={2024},
122+
eprint={2407.06985},
123+
archivePrefix={arXiv},
124+
primaryClass={cs.AI},
125+
url={https://arxiv.org/abs/2407.06985},
126+
}
127+
```
128+
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.
129+
https://arxiv.org/pdf/2407.06985
109130

110131
## Acknowledgements
111132
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. 🙏🙏🙏

README_zh.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
![](https://img.shields.io/badge/framework-agentUniverse-pink)
66
![](https://img.shields.io/badge/python-3.10%2B-blue?logo=Python)
77
[![](https://img.shields.io/badge/%20license-Apache--2.0-yellow)](LICENSE)
8-
[![Static Badge](https://img.shields.io/badge/pypi-v0.0.10-blue?logo=pypi)](https://pypi.org/project/agentUniverse/)
8+
[![Static Badge](https://img.shields.io/badge/pypi-v0.0.11-blue?logo=pypi)](https://pypi.org/project/agentUniverse/)
99

1010
![](docs/guidebook/_picture/logo_bar.jpg)
1111
****************************************
@@ -34,6 +34,7 @@
3434
* [用户指南](#用户指南)
3535
* [API参考](#API参考)
3636
* [支持](#支持)
37+
* [文献](#文献)
3738
* [鸣谢](#鸣谢)
3839
****************************************
3940
## 快速开始
@@ -61,6 +62,12 @@ pip install agentUniverse
6162

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

65+
[吴恩达反思工作流翻译智能体复刻](./docs/guidebook/zh/7_1_1_翻译案例.md)
66+
67+
68+
#### 🚩 DataAgent - 数据自治智能体
69+
agentUniverse推出了DataAgent(Minimum Viable Product版本), DataAgent旨在使用智能体能力让您的Agent拥有自我评价与演进的能力。详情见文档: [DataAgent - 数据自治智能体](./docs/guidebook/zh/8_1_1_数据自治智能体.md)
70+
6471
### 🌟 示例项目
6572
[agentUniverse 示例项目](sample_standard_app)
6673

@@ -105,7 +112,30 @@ pip install agentUniverse
105112

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

115+
![](./docs/guidebook/_picture/wechat_official.png)
116+
108117
更多相关的文章与资讯你可以在微信公众号中获取。
109118

119+
#### twitter
120+
ID: [@agentuniverse_](https://x.com/agentuniverse_)
121+
122+
### 文献
123+
agentUniverse项目基于以下的研究成果支撑。
124+
125+
BibTeX formatted
126+
```text
127+
@misc{wang2024peerexpertizingdomainspecifictasks,
128+
title={PEER: Expertizing Domain-Specific Tasks with a Multi-Agent Framework and Tuning Methods},
129+
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},
130+
year={2024},
131+
eprint={2407.06985},
132+
archivePrefix={arXiv},
133+
primaryClass={cs.AI},
134+
url={https://arxiv.org/abs/2407.06985},
135+
}
136+
```
137+
文献简介:该文献详细介绍了介绍了PEER多智能体框架的机制原理,同时在实验部分分别从**完整性、相关性、紧凑性、事实性、逻辑性、结构性和全面性七个维度进行打分(各纬度满分为5分)**,PEER模式在每个测评维度的平均分数均高于BabyAGI,且在**完整性、相关性、逻辑性、结构性和全面性五个纬度有显著优势**;同时PEER模式在 GPT-3.5 turbo (16k) 模型下相较于 BabyAGI 的择优胜率达到 83%,在 GPT-4o 模型下择优胜率达到 81%,更多详情请阅读文献。
138+
https://arxiv.org/pdf/2407.06985
139+
110140
## 鸣谢
111141
本项目部分基于langchain、pydantic、gunicorn、flask、SQLAlchemy、chromadb等(详细依赖列表可见pyproject.toml)优秀开源项目实现,在此特别感谢相关项目与关联方。 🙏🙏🙏

agentuniverse/agent/default/executing_agent/executing_agent.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def execute(self, input_object: InputObject, agent_input: dict) -> dict:
7676
framework = agent_input.get('framework', [])
7777
futures = []
7878
for task in framework:
79-
agent_input_copy: dict = copy.deepcopy(agent_input)
79+
# note: agent input shallow copy.
80+
agent_input_copy: dict = dict(agent_input)
8081
agent_input_copy['input'] = task
8182
planner: Planner = PlannerManager().get_instance_obj(self.agent_model.plan.get('planner').get('name'))
8283
futures.append(
@@ -99,7 +100,8 @@ def process_intput_object(self, input_object: InputObject, subtask: str, planner
99100
# get agent toolsets.
100101
action: dict = self.agent_model.action or dict()
101102
tools: list = action.get('tool') or list()
102-
input_object_copy: InputObject = copy.deepcopy(input_object)
103+
# note: input object shallow copy.
104+
input_object_copy: InputObject = InputObject(input_object.to_dict())
103105
# wrap input_object for agent knowledge.
104106
input_object_copy.add_data(planner_input_key, subtask)
105107
# wrap input_object for agent toolsets.

agentuniverse/agent/memory/chat_memory.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,18 @@ def as_langchain(self) -> BaseChatMemory:
5050
max_token_limit=self.max_tokens, messages=self.messages,
5151
prompt_version=self.prompt_version)
5252

53-
def set_by_agent_model(self, **kwargs) -> None:
53+
def set_by_agent_model(self, **kwargs):
5454
""" Assign values of parameters to the ChatMemory model in the agent configuration."""
55-
super().set_by_agent_model(**kwargs)
55+
copied_obj = super().set_by_agent_model(**kwargs)
5656
if 'messages' in kwargs and kwargs['messages']:
57-
self.messages = kwargs['messages']
57+
copied_obj.messages = kwargs['messages']
5858
if 'llm' in kwargs and kwargs['llm']:
59-
self.llm = kwargs['llm']
59+
copied_obj.llm = kwargs['llm']
6060
if 'input_key' in kwargs and kwargs['input_key']:
61-
self.input_key = kwargs['input_key']
61+
copied_obj.input_key = kwargs['input_key']
6262
if 'output_key' in kwargs and kwargs['output_key']:
63-
self.output_key = kwargs['output_key']
63+
copied_obj.output_key = kwargs['output_key']
64+
return copied_obj
6465

6566
def initialize_by_component_configer(self, component_configer: MemoryConfiger) -> 'ChatMemory':
6667
"""Initialize the chat memory by the ComponentConfiger object.

agentuniverse/agent/memory/memory.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,15 @@ def as_langchain(self) -> BaseMemory:
4040
"""Convert the agentUniverse(aU) memory class to the langchain memory class."""
4141
pass
4242

43-
def set_by_agent_model(self, **kwargs) -> None:
43+
def set_by_agent_model(self, **kwargs):
4444
""" Assign values of parameters to the Memory model in the agent configuration."""
45+
# note: default shallow copy
46+
copied_obj = self.model_copy()
4547
if 'memory_key' in kwargs and kwargs['memory_key']:
46-
self.memory_key = kwargs['memory_key']
48+
copied_obj.memory_key = kwargs['memory_key']
4749
if 'max_tokens' in kwargs and kwargs['max_tokens']:
48-
self.max_tokens = kwargs['max_tokens']
50+
copied_obj.max_tokens = kwargs['max_tokens']
51+
return copied_obj
4952

5053
def get_instance_code(self) -> str:
5154
"""Return the full name of the memory."""

agentuniverse/agent/plan/planner/expressing_planner/expressing_planner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ def invoke(self, agent_model: AgentModel, planner_input: dict, input_object: Inp
5151
history_messages_key="chat_history",
5252
input_messages_key=self.input_key,
5353
) | StrOutputParser()
54-
res = asyncio.run(
55-
chain_with_history.ainvoke(input=planner_input, config={"configurable": {"session_id": "unused"}}))
54+
55+
res = self.invoke_chain(agent_model, chain_with_history, planner_input, chat_history, input_object)
5656
return {**planner_input, self.output_key: res, 'chat_history': generate_memories(chat_history)}
5757

5858
def handle_prompt(self, agent_model: AgentModel, planner_input: dict) -> Prompt:

agentuniverse/agent/plan/planner/peer_planner/peer_planner.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def invoke(self, agent_model: AgentModel, planner_input: dict, input_object: Inp
4242
"""
4343
planner_config = agent_model.plan.get('planner')
4444
sub_agents = self.generate_sub_agents(planner_config)
45-
return self.agents_run(sub_agents, planner_config, planner_input, input_object)
45+
return self.agents_run(agent_model, sub_agents, planner_config, planner_input, input_object)
4646

4747
@staticmethod
4848
def generate_sub_agents(planner_config: dict) -> dict:
@@ -79,7 +79,8 @@ def build_expert_framework(planner_config: dict, input_object: InputObject):
7979
elif context:
8080
input_object.add_data('expert_framework', context)
8181

82-
def agents_run(self, agents: dict, planner_config: dict, agent_input: dict, input_object: InputObject) -> dict:
82+
def agents_run(self, agent_mode: AgentModel, agents: dict, planner_config: dict, agent_input: dict,
83+
input_object: InputObject) -> dict:
8384
"""Planner agents run.
8485
8586
Args:
@@ -125,6 +126,10 @@ def agents_run(self, agents: dict, planner_config: dict, agent_input: dict, inpu
125126
for index, one_framework in enumerate(planning_result.get_data('framework')):
126127
logger_info += f"[{index + 1}] {one_framework} \n"
127128
LOGGER.info(logger_info)
129+
self.stream_output(input_object, {"data": {
130+
'output': planning_result.to_dict(),
131+
"agent_info": agent_mode.info
132+
}, "type": "planning"})
128133

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

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

161174
if not reviewing_result or jump_step in ["planning", "executing", "expressing", "reviewing"]:
162175
if not reviewingAgent:
@@ -172,14 +185,15 @@ def agents_run(self, agents: dict, planner_config: dict, agent_input: dict, inpu
172185
else:
173186
LOGGER.info(f"Starting reviewing agent.")
174187
reviewing_result = reviewingAgent.run(**input_object.to_dict())
188+
175189
input_object.add_data('reviewing_result', reviewing_result)
176190

177191
# add reviewing agent log info
178192
logger_info = f"\nReviewing agent execution result is :\n"
179193
reviewing_info_str = f"review suggestion: {reviewing_result.get_data('suggestion')} \n"
180194
reviewing_info_str += f"review score: {reviewing_result.get_data('score')} \n"
181195
LOGGER.info(logger_info + reviewing_info_str)
182-
196+
self.stream_output(input_object, {"data": reviewing_result.to_dict(), "type": "reviewing"})
183197
if reviewing_result.get_data('score') and reviewing_result.get_data('score') >= eval_threshold:
184198
loopResults.append({
185199
"planning_result": planning_result,

0 commit comments

Comments
 (0)