This view is limited to 50 files because it contains too many changes.  See the raw diff here.
Files changed (50) hide show
  1. .gitattributes +7 -0
  2. .github/QRcode.jpg +0 -0
  3. .github/rumor-verification.mp4 +3 -0
  4. .github/snake-demo-video-zh.mp4 +3 -0
  5. .github/snake-game-demo-en.mp4 +3 -0
  6. .gitignore +169 -0
  7. .gitpod.yml +8 -0
  8. LICENSE +21 -0
  9. README.md +131 -11
  10. __pycache__/common.cpython-310.pyc +0 -0
  11. __pycache__/startup.cpython-310.pyc +0 -0
  12. __pycache__/ws_service.cpython-310.pyc +0 -0
  13. autoagents.egg-info/PKG-INFO +389 -0
  14. autoagents.egg-info/SOURCES.txt +68 -0
  15. autoagents.egg-info/dependency_links.txt +1 -0
  16. autoagents.egg-info/requires.txt +245 -0
  17. autoagents.egg-info/top_level.txt +1 -0
  18. autoagents/__init__.py +2 -0
  19. autoagents/__pycache__/__init__.cpython-310.pyc +0 -0
  20. autoagents/__pycache__/environment.cpython-310.pyc +0 -0
  21. autoagents/__pycache__/explorer.cpython-310.pyc +0 -0
  22. autoagents/actions/__init__.py +20 -0
  23. autoagents/actions/__pycache__/__init__.cpython-310.pyc +0 -0
  24. autoagents/actions/__pycache__/check_plans.cpython-310.pyc +0 -0
  25. autoagents/actions/__pycache__/check_roles.cpython-310.pyc +0 -0
  26. autoagents/actions/__pycache__/create_roles.cpython-310.pyc +0 -0
  27. autoagents/actions/__pycache__/custom_action.cpython-310.pyc +0 -0
  28. autoagents/actions/__pycache__/steps.cpython-310.pyc +0 -0
  29. autoagents/actions/action/README.md +2 -0
  30. autoagents/actions/action/__init__.py +2 -0
  31. autoagents/actions/action/__pycache__/__init__.cpython-310.pyc +0 -0
  32. autoagents/actions/action/__pycache__/action.cpython-310.pyc +0 -0
  33. autoagents/actions/action/__pycache__/action_output.cpython-310.pyc +0 -0
  34. autoagents/actions/action/action.py +70 -0
  35. autoagents/actions/action/action_output.py +43 -0
  36. autoagents/actions/action_bank/README.md +2 -0
  37. autoagents/actions/action_bank/__init__.py +6 -0
  38. autoagents/actions/action_bank/__pycache__/__init__.cpython-310.pyc +0 -0
  39. autoagents/actions/action_bank/__pycache__/design_api.cpython-310.pyc +0 -0
  40. autoagents/actions/action_bank/__pycache__/project_management.cpython-310.pyc +0 -0
  41. autoagents/actions/action_bank/__pycache__/requirement.cpython-310.pyc +0 -0
  42. autoagents/actions/action_bank/__pycache__/search_and_summarize.cpython-310.pyc +0 -0
  43. autoagents/actions/action_bank/__pycache__/write_code.cpython-310.pyc +0 -0
  44. autoagents/actions/action_bank/__pycache__/write_code_review.cpython-310.pyc +0 -0
  45. autoagents/actions/action_bank/__pycache__/write_prd.cpython-310.pyc +0 -0
  46. autoagents/actions/action_bank/design_api.py +143 -0
  47. autoagents/actions/action_bank/project_management.py +128 -0
  48. autoagents/actions/action_bank/requirement.py +7 -0
  49. autoagents/actions/action_bank/search_and_summarize.py +154 -0
  50. autoagents/actions/action_bank/write_code.py +81 -0
.gitattributes CHANGED
@@ -33,3 +33,10 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ .github/rumor-verification.mp4 filter=lfs diff=lfs merge=lfs -text
37
+ .github/snake-demo-video-zh.mp4 filter=lfs diff=lfs merge=lfs -text
38
+ .github/snake-game-demo-en.mp4 filter=lfs diff=lfs merge=lfs -text
39
+ frontend/app/images/10.jpg filter=lfs diff=lfs merge=lfs -text
40
+ frontend/app/images/14.jpg filter=lfs diff=lfs merge=lfs -text
41
+ frontend/app/images/16.jpg filter=lfs diff=lfs merge=lfs -text
42
+ frontend/app/images/19..jpg filter=lfs diff=lfs merge=lfs -text
.github/QRcode.jpg ADDED
.github/rumor-verification.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7633a17d77679eb8b9f776dfb5d25a38acf5e4856334085e3cd8669d054cd74a
3
+ size 4864301
.github/snake-demo-video-zh.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e0af9c120afc1d7001e4be882a3c860bc0f08cfa988caba59f380314edb2f1c7
3
+ size 9135232
.github/snake-game-demo-en.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2aba6d67f9d8e5b4182a0c0416b676bd72f047e46cf8fba02028aad60c5f61a2
3
+ size 9337713
.gitignore ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.swp
2
+ node_modules
3
+ .DS_Store
4
+
5
+ # Byte-compiled / optimized / DLL files
6
+ __pycache__/
7
+ *.py[cod]
8
+ *$py.class
9
+
10
+ # C extensions
11
+ *.so
12
+
13
+ # Distribution / packaging
14
+ .Python
15
+ build/
16
+ develop-eggs/
17
+ dist/
18
+ downloads/
19
+ eggs/
20
+ .eggs/
21
+ lib/
22
+ lib64/
23
+ parts/
24
+ sdist/
25
+ var/
26
+ wheels/
27
+ share/python-wheels/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+ MANIFEST
32
+
33
+ # PyInstaller
34
+ # Usually these files are written by a python script from a template
35
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
36
+ *.manifest
37
+ *.spec
38
+
39
+ # Installer logs
40
+ pip-log.txt
41
+ pip-delete-this-directory.txt
42
+
43
+ # Unit test / coverage reports
44
+ htmlcov/
45
+ .tox/
46
+ .nox/
47
+ .coverage
48
+ .coverage.*
49
+ .cache
50
+ nosetests.xml
51
+ coverage.xml
52
+ *.cover
53
+ *.py,cover
54
+ .hypothesis/
55
+ .pytest_cache/
56
+ cover/
57
+
58
+ # Translations
59
+ *.mo
60
+ *.pot
61
+
62
+ # Django stuff:
63
+ *.log
64
+ local_settings.py
65
+ db.sqlite3
66
+ db.sqlite3-journal
67
+
68
+ # Flask stuff:
69
+ instance/
70
+ .webassets-cache
71
+
72
+ # Scrapy stuff:
73
+ .scrapy
74
+
75
+ # Sphinx documentation
76
+ docs/_build/
77
+
78
+ # PyBuilder
79
+ .pybuilder/
80
+ target/
81
+
82
+ # Jupyter Notebook
83
+ .ipynb_checkpoints
84
+
85
+ # IPython
86
+ profile_default/
87
+ ipython_config.py
88
+
89
+ # pyenv
90
+ # For a library or package, you might want to ignore these files since the code is
91
+ # intended to run in multiple environments; otherwise, check them in:
92
+ # .python-version
93
+
94
+ # pipenv
95
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
96
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
97
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
98
+ # install all needed dependencies.
99
+ #Pipfile.lock
100
+
101
+ # poetry
102
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
103
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
104
+ # commonly ignored for libraries.
105
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
106
+ #poetry.lock
107
+
108
+ # pdm
109
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
110
+ #pdm.lock
111
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
112
+ # in version control.
113
+ # https://pdm.fming.dev/#use-with-ide
114
+ .pdm.toml
115
+
116
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
117
+ __pypackages__/
118
+
119
+ # Celery stuff
120
+ celerybeat-schedule
121
+ celerybeat.pid
122
+
123
+ # SageMath parsed files
124
+ *.sage.py
125
+
126
+ # Environments
127
+ .env
128
+ .venv
129
+ env/
130
+ venv/
131
+ ENV/
132
+ env.bak/
133
+ venv.bak/
134
+
135
+ # Spyder project settings
136
+ .spyderproject
137
+ .spyproject
138
+
139
+ # Rope project settings
140
+ .ropeproject
141
+
142
+ # mkdocs documentation
143
+ /site
144
+
145
+ # mypy
146
+ .mypy_cache/
147
+ .dmypy.json
148
+ dmypy.json
149
+
150
+ # Pyre type checker
151
+ .pyre/
152
+
153
+ # pytype static type analyzer
154
+ .pytype/
155
+
156
+ # Cython debug symbols
157
+ cython_debug/
158
+
159
+ # PyCharm
160
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
161
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
162
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
163
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
164
+ #.idea/
165
+
166
+ datasets/
167
+ outputs/
168
+ logs/
169
+ workspace/
.gitpod.yml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # This configuration file was automatically generated by Gitpod.
2
+ # Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
3
+ # and commit this file to your remote git repository to share the goodness with others.
4
+
5
+ # Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart
6
+
7
+ tasks:
8
+ - init: pip install -r requirements.txt
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Yemin Shi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md CHANGED
@@ -1,11 +1,131 @@
1
- ---
2
- title: AutoAgents
3
- emoji: 📚
4
- colorFrom: yellow
5
- colorTo: indigo
6
- sdk: docker
7
- pinned: false
8
- license: apache-2.0
9
- ---
10
-
11
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AutoAgents: A Framework for Automatic Agent Generation
2
+
3
+ <p align="center">
4
+ <a href=""><img src="docs/resources/logo-autoagents.jpg" alt="autoagents logo: A Framework for Automatic Agent Generation." width="150px"></a>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <b>Generate different roles for GPTs to form a collaborative entity for complex tasks.</b>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="docs/README_CN.md"><img src="https://img.shields.io/badge/文档-中文版-blue.svg" alt="CN doc"></a>
13
+ <a href="README.md"><img src="https://img.shields.io/badge/document-English-blue.svg" alt="EN doc"></a>
14
+ <a href="docs/README_JA.md"><img src="https://img.shields.io/badge/ドキュメント-日本語-blue.svg" alt="JA doc"></a>
15
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
16
+ </p>
17
+
18
+ AutoAgents is an experimental open-source application for an Automatic Agents Generation Experiment based on LLM. This program, driven by LLM, autonomously generates multi-agents to achieve whatever goal you set.
19
+
20
+ <p align="center">
21
+ <img src=./docs/resources/framework2.jpg width="800">
22
+ </p>
23
+
24
+ ## <a name="updates"/> :boom: Updates
25
+ - **2023.09.31**: 📝 We're excited to share our paper [AutoAgents: A Framework for Automatic Agent Generation](https://arxiv.org/abs/2309.17288) related to this repository.
26
+ <p align="center">
27
+ <img width="616" alt="The execution process of AutoAgents." src="docs/resources/process.jpg">
28
+ </p>
29
+
30
+ - **2023.08.30**: 🚀 Adding a custom agent collection, AgentBank, allows you to add custom agents.
31
+
32
+ ## 🚀 Features
33
+ - **Planner**: Determines the expert roles to be added and the specific execution plan according to the problem.
34
+ - **Tools**: The set of tools that can be used, currently only compatible with the search tools.
35
+ - **Observers**: Responsible for reflecting on whether the planner and the results in the execution process are reasonable, currently including reflection checks on Agents, Plan, and Action.
36
+ - **Agents**: Expert role agents generated by the planner, including name, expertise, tools used, and LLM enhancement.
37
+ - **Plan**: The execution plan is composed of the generated expert roles, each step of the execution plan has at least one expert role agent.
38
+ - **Actions**: The specific actions of the expert roles in the execution plan, such as calling tools or outputting results.
39
+
40
+ ## Demo
41
+ Online demo:
42
+ - [Demo / HuggingFace Spaces](https://huggingface.co/spaces/LinkSoul/AutoAgents)
43
+
44
+ Video demo:
45
+ - **Rumor Verification**
46
+ <video src='https://github.com/shiyemin/AutoAgents/assets/1501158/41898e0d-4137-450c-ad9b-bfb9b8c1d27b.mp4'></video>
47
+ - **Gluttonous Snake**
48
+ <video src='https://github.com/shiyemin/AutoAgents/assets/1501158/97e408cb-b70d-4045-82ea-07319c085138.mp4'></video>
49
+
50
+ ## Installation and Usage
51
+
52
+ ### Installation
53
+
54
+ ```bash
55
+ git clone https://github.com/LinkSoul-AI/AutoAgents
56
+ cd AutoAgents
57
+ python setup.py install
58
+ ```
59
+
60
+ ### Configuration
61
+
62
+ - Configure your `OPENAI_API_KEY` in any of `config/key.yaml / config/config.yaml / env`
63
+ - Priority order: `config/key.yaml > config/config.yaml > env`
64
+
65
+ ```bash
66
+ # Copy the configuration file and make the necessary modifications.
67
+ cp config/config.yaml config/key.yaml
68
+ ```
69
+
70
+ | Variable Name | config/key.yaml | env |
71
+ | ------------------------------------------ | ----------------------------------------- | ----------------------------------------------- |
72
+ | OPENAI_API_KEY # Replace with your own key | OPENAI_API_KEY: "sk-..." | export OPENAI_API_KEY="sk-..." |
73
+ | OPENAI_API_BASE # Optional | OPENAI_API_BASE: "https://<YOUR_SITE>/v1" | export OPENAI_API_BASE="https://<YOUR_SITE>/v1" |
74
+
75
+ ### Usage
76
+ - Commandline mode:
77
+ ```python
78
+ python main.py --mode commandline --llm_api_key YOUR_OPENAI_API_KEY --serpapi_key YOUR_SERPAPI_KEY --idea "Is LK-99 really a room temperature superconducting material?"
79
+ ```
80
+ - Websocket service mode:
81
+ ```python
82
+ python main.py --mode service --host "127.0.0.1" --port 9000
83
+ ```
84
+
85
+ ### Docker
86
+ - Build docker image:
87
+ ```bash
88
+ IMAGE="linksoul.ai/autoagents"
89
+ VERSION=1.0
90
+
91
+ docker build -f docker/Dockerfile -t "${IMAGE}:${VERSION}" .
92
+ ```
93
+ - Start docker container:
94
+ ```bash
95
+ docker run -it --rm -p 7860:7860 "${IMAGE}:${VERSION}"
96
+ ```
97
+ - Open http://127.0.0.1:7860 in the browser.
98
+
99
+ ## Contact Information
100
+
101
+ If you have any questions or feedback about this project, please feel free to contact us. We highly appreciate your suggestions!
102
+
103
+ - **Email:** gy.chen@foxmail.com, ymshi@linksoul.ai
104
+ - **GitHub Issues:** For more technical inquiries, you can also create a new issue in our [GitHub repository](https://github.com/LinkSoul-AI/AutoAgents/issues).
105
+
106
+ We will respond to all questions within 2-3 business days.
107
+
108
+ ## License
109
+
110
+ [MIT license](https://raw.githubusercontent.com/LinkSoul-AI/AutoAgents/main/LICENSE)
111
+
112
+ ## Citation
113
+
114
+ If you find our work and this repository useful, please consider giving a star :star: and citation :beer::
115
+ ```bibtex
116
+ @article{chen2023auto,
117
+ title={AutoAgents: The Automatic Agents Generation Framework},
118
+ author={Chen, Guangyao and Dong, Siwei and Shu, Yu and Zhang, Ge and Jaward, Sesay and Börje, Karlsson and Fu, Jie and Shi, Yemin},
119
+ journal={arXiv preprint},
120
+ year={2023}
121
+ }
122
+ ```
123
+
124
+ ## Wechat Group
125
+
126
+ <img src=".github/QRcode.jpg" alt="Wechat Group" width="200"/>
127
+
128
+ ## Acknowledgements
129
+ The [system](https://github.com/LinkSoul-AI/AutoAgents/tree/main/autoagents/system), [action_bank](https://github.com/LinkSoul-AI/AutoAgents/tree/main/autoagents/actions/action_bank) and [role_bank](https://github.com/LinkSoul-AI/AutoAgents/tree/main/autoagents/roles/role_bank) of this code base is built using [MetaGPT](https://github.com/geekan/MetaGPT)
130
+
131
+ Icons in the framework made by Darius Dan, Freepik, kmg design, Flat Icons, Vectorslab from [FlatIcon](https://www.flaticon.com)
__pycache__/common.cpython-310.pyc ADDED
Binary file (802 Bytes). View file
 
__pycache__/startup.cpython-310.pyc ADDED
Binary file (826 Bytes). View file
 
__pycache__/ws_service.cpython-310.pyc ADDED
Binary file (4.9 kB). View file
 
autoagents.egg-info/PKG-INFO ADDED
@@ -0,0 +1,389 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: autoagents
3
+ Version: 0.1
4
+ Summary: The Automatic Agents Generation Framework
5
+ Home-page: https://github.com/LinkSoul-AI/AutoAgents
6
+ Author: Guangyao Chen
7
+ Author-email: gy.chen@foxmail.com
8
+ License: Apache 2.0
9
+ Keywords: autoagent multi-agent agent-generation gpt llm
10
+ Requires-Python: >=3.9
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: matplotlib==3.8.0
14
+ Requires-Dist: matplotlib-inline==0.1.6
15
+ Requires-Dist: abstract_singleton==1.0.1
16
+ Requires-Dist: aiofiles==23.2.1
17
+ Requires-Dist: aiohttp==3.8.4
18
+ Requires-Dist: aiosignal==1.3.1
19
+ Requires-Dist: altair==5.1.1
20
+ Requires-Dist: anthropic==0.3.6
21
+ Requires-Dist: anyio==3.7.1
22
+ Requires-Dist: appdirs==1.4.4
23
+ Requires-Dist: asgiref==3.7.2
24
+ Requires-Dist: asttokens==2.2.1
25
+ Requires-Dist: astunparse==1.6.3
26
+ Requires-Dist: async-generator==1.10
27
+ Requires-Dist: async-timeout==4.0.2
28
+ Requires-Dist: asynctest==0.13.0
29
+ Requires-Dist: attrs==23.1.0
30
+ Requires-Dist: auto_gpt_plugin_template==0.0.3
31
+ Requires-Dist: autoflake==2.1.1
32
+ Requires-Dist: backcall==0.2.0
33
+ Requires-Dist: beautifulsoup4==4.12.2
34
+ Requires-Dist: black==23.3.0
35
+ Requires-Dist: blis==0.7.9
36
+ Requires-Dist: cachetools==5.3.0
37
+ Requires-Dist: camel-converter==3.0.2
38
+ Requires-Dist: catalogue==2.0.8
39
+ Requires-Dist: certifi==2023.7.22
40
+ Requires-Dist: cffi==1.15.1
41
+ Requires-Dist: cfgv==3.3.1
42
+ Requires-Dist: channels==4.0.0
43
+ Requires-Dist: chardet==5.1.0
44
+ Requires-Dist: charset-normalizer==3.1.0
45
+ Requires-Dist: click==8.1.3
46
+ Requires-Dist: colorama==0.4.6
47
+ Requires-Dist: common==0.1.2
48
+ Requires-Dist: confection==0.0.4
49
+ Requires-Dist: contourpy==1.1.1
50
+ Requires-Dist: coverage==7.2.5
51
+ Requires-Dist: cryptography==40.0.2
52
+ Requires-Dist: cssselect==1.2.0
53
+ Requires-Dist: cycler==0.11.0
54
+ Requires-Dist: cymem==2.0.7
55
+ Requires-Dist: dataclasses-json==0.5.7
56
+ Requires-Dist: decorator==5.1.1
57
+ Requires-Dist: diskcache==5.6.1
58
+ Requires-Dist: distlib==0.3.6
59
+ Requires-Dist: distro==1.8.0
60
+ Requires-Dist: Django==4.2.3
61
+ Requires-Dist: dnspython==2.3.0
62
+ Requires-Dist: docker==6.1.2
63
+ Requires-Dist: docker-pycreds==0.4.0
64
+ Requires-Dist: duckduckgo-search==2.9.4
65
+ Requires-Dist: et-xmlfile==1.1.0
66
+ Requires-Dist: exceptiongroup==1.1.1
67
+ Requires-Dist: execnet==1.9.0
68
+ Requires-Dist: executing==1.2.0
69
+ Requires-Dist: faiss-cpu==1.7.4
70
+ Requires-Dist: fastapi==0.103.1
71
+ Requires-Dist: ffmpy==0.3.1
72
+ Requires-Dist: filelock==3.12.0
73
+ Requires-Dist: fire==0.4.0
74
+ Requires-Dist: flake8==6.0.0
75
+ Requires-Dist: fonttools==4.42.1
76
+ Requires-Dist: frozenlist==1.3.3
77
+ Requires-Dist: fsspec==2023.9.2
78
+ Requires-Dist: ghp-import==2.1.0
79
+ Requires-Dist: gitdb==4.0.10
80
+ Requires-Dist: GitPython==3.1.31
81
+ Requires-Dist: google-api-core==2.11.0
82
+ Requires-Dist: google-api-python-client==2.86.0
83
+ Requires-Dist: google-auth==2.18.0
84
+ Requires-Dist: google-auth-httplib2==0.1.0
85
+ Requires-Dist: google-search-results==2.4.2
86
+ Requires-Dist: googleapis-common-protos==1.59.0
87
+ Requires-Dist: gradio==3.44.4
88
+ Requires-Dist: gradio_client==0.5.1
89
+ Requires-Dist: greenlet==2.0.2
90
+ Requires-Dist: gTTS==2.3.1
91
+ Requires-Dist: h11==0.14.0
92
+ Requires-Dist: httpcore==0.17.0
93
+ Requires-Dist: httplib2==0.22.0
94
+ Requires-Dist: httpx==0.24.0
95
+ Requires-Dist: huggingface-hub==0.17.2
96
+ Requires-Dist: icecream==2.1.3
97
+ Requires-Dist: identify==2.5.24
98
+ Requires-Dist: idna==3.4
99
+ Requires-Dist: importlib-metadata==6.8.0
100
+ Requires-Dist: importlib-resources==6.1.0
101
+ Requires-Dist: iniconfig==2.0.0
102
+ Requires-Dist: ipdb==0.13.13
103
+ Requires-Dist: ipython==8.14.0
104
+ Requires-Dist: iso-639==0.4.5
105
+ Requires-Dist: isort==5.12.0
106
+ Requires-Dist: jedi==0.18.2
107
+ Requires-Dist: Jinja2==3.1.2
108
+ Requires-Dist: joblib==1.3.2
109
+ Requires-Dist: jsonschema==4.17.3
110
+ Requires-Dist: kiwisolver==1.4.5
111
+ Requires-Dist: langchain==0.0.231
112
+ Requires-Dist: langchainplus-sdk==0.0.20
113
+ Requires-Dist: langcodes==3.3.0
114
+ Requires-Dist: langsmith==0.0.33
115
+ Requires-Dist: litellm==0.7.5
116
+ Requires-Dist: loguru==0.6.0
117
+ Requires-Dist: lxml==4.9.2
118
+ Requires-Dist: Markdown==3.3.7
119
+ Requires-Dist: MarkupSafe==2.1.2
120
+ Requires-Dist: marshmallow==3.19.0
121
+ Requires-Dist: marshmallow-enum==1.5.1
122
+ Requires-Dist: mccabe==0.7.0
123
+ Requires-Dist: meilisearch==0.21.0
124
+ Requires-Dist: mergedeep==1.3.4
125
+ Requires-Dist: mkdocs==1.4.3
126
+ Requires-Dist: mkl-service==2.4.0
127
+ Requires-Dist: multidict==6.0.4
128
+ Requires-Dist: murmurhash==1.0.9
129
+ Requires-Dist: mypy-extensions==1.0.0
130
+ Requires-Dist: nltk==3.8.1
131
+ Requires-Dist: nodeenv==1.8.0
132
+ Requires-Dist: numexpr==2.8.4
133
+ Requires-Dist: numpy==1.25.2
134
+ Requires-Dist: oauthlib==3.2.2
135
+ Requires-Dist: openai==0.27.2
136
+ Requires-Dist: openapi-python-client==0.13.4
137
+ Requires-Dist: openapi-schema-pydantic==1.2.4
138
+ Requires-Dist: opencv-python==4.8.0.76
139
+ Requires-Dist: openpyxl==3.2.0b1
140
+ Requires-Dist: orjson==3.8.10
141
+ Requires-Dist: outcome==1.2.0
142
+ Requires-Dist: packaging==23.1
143
+ Requires-Dist: pandas==1.4.1
144
+ Requires-Dist: parso==0.8.3
145
+ Requires-Dist: pathspec==0.11.1
146
+ Requires-Dist: pathtools==0.1.2
147
+ Requires-Dist: pathy==0.10.1
148
+ Requires-Dist: pexpect==4.8.0
149
+ Requires-Dist: pickleshare==0.7.5
150
+ Requires-Dist: Pillow==9.5.0
151
+ Requires-Dist: pinecone-client==2.2.1
152
+ Requires-Dist: pip==23.0.1
153
+ Requires-Dist: platformdirs==3.5.1
154
+ Requires-Dist: playsound==1.2.2
155
+ Requires-Dist: pluggy==1.0.0
156
+ Requires-Dist: pre-commit==3.3.1
157
+ Requires-Dist: preshed==3.0.8
158
+ Requires-Dist: promise==2.3
159
+ Requires-Dist: prompt-toolkit==3.0.38
160
+ Requires-Dist: protobuf==3.20.3
161
+ Requires-Dist: psutil==5.9.5
162
+ Requires-Dist: ptyprocess==0.7.0
163
+ Requires-Dist: pure-eval==0.2.2
164
+ Requires-Dist: py-cpuinfo==9.0.0
165
+ Requires-Dist: py3langid==0.2.2
166
+ Requires-Dist: pyasn1==0.5.0
167
+ Requires-Dist: pyasn1-modules==0.3.0
168
+ Requires-Dist: pycodestyle==2.10.0
169
+ Requires-Dist: pycparser==2.21
170
+ Requires-Dist: pydantic==1.10.7
171
+ Requires-Dist: pydub==0.25.1
172
+ Requires-Dist: pyflakes==3.0.1
173
+ Requires-Dist: Pygments==2.15.1
174
+ Requires-Dist: pymdown-extensions==10.0.1
175
+ Requires-Dist: pyOpenSSL==23.1.1
176
+ Requires-Dist: pyparsing==3.0.9
177
+ Requires-Dist: pyrsistent==0.19.3
178
+ Requires-Dist: PySocks==1.7.1
179
+ Requires-Dist: pytest==7.2.2
180
+ Requires-Dist: pytest-asyncio==0.21.0
181
+ Requires-Dist: pytest-benchmark==4.0.0
182
+ Requires-Dist: pytest-cov==4.0.0
183
+ Requires-Dist: pytest-integration==0.2.3
184
+ Requires-Dist: pytest-mock==3.10.0
185
+ Requires-Dist: pytest-recording==0.12.2
186
+ Requires-Dist: pytest-xdist==3.3.0
187
+ Requires-Dist: python-dateutil==2.8.2
188
+ Requires-Dist: python-docx==0.8.11
189
+ Requires-Dist: python-dotenv==1.0.0
190
+ Requires-Dist: python-multipart==0.0.6
191
+ Requires-Dist: pytz==2023.3
192
+ Requires-Dist: PyYAML==6.0
193
+ Requires-Dist: pyyaml_env_tag==0.1
194
+ Requires-Dist: readability-lxml==0.8.1
195
+ Requires-Dist: redis==4.5.5
196
+ Requires-Dist: regex==2023.5.5
197
+ Requires-Dist: requests==2.30.0
198
+ Requires-Dist: requests-oauthlib==1.3.1
199
+ Requires-Dist: rsa==4.9
200
+ Requires-Dist: scikit-learn==1.3.0
201
+ Requires-Dist: scipy==1.11.1
202
+ Requires-Dist: selenium==4.1.4
203
+ Requires-Dist: semantic-version==2.10.0
204
+ Requires-Dist: sentry-sdk==1.31.0
205
+ Requires-Dist: setproctitle==1.3.2
206
+ Requires-Dist: setuptools==65.6.3
207
+ Requires-Dist: shellingham==1.5.0.post1
208
+ Requires-Dist: shortuuid==1.0.11
209
+ Requires-Dist: six==1.16.0
210
+ Requires-Dist: smart-open==6.3.0
211
+ Requires-Dist: smmap==5.0.0
212
+ Requires-Dist: sniffio==1.3.0
213
+ Requires-Dist: socksio==1.0.0
214
+ Requires-Dist: sortedcontainers==2.4.0
215
+ Requires-Dist: soupsieve==2.4.1
216
+ Requires-Dist: spacy==3.5.3
217
+ Requires-Dist: spacy-legacy==3.0.12
218
+ Requires-Dist: spacy-loggers==1.0.4
219
+ Requires-Dist: SQLAlchemy==2.0.15
220
+ Requires-Dist: sqlparse==0.4.4
221
+ Requires-Dist: srsly==2.4.6
222
+ Requires-Dist: stack-data==0.6.2
223
+ Requires-Dist: starlette==0.27.0
224
+ Requires-Dist: tenacity==8.2.2
225
+ Requires-Dist: termcolor==2.3.0
226
+ Requires-Dist: thinc==8.1.10
227
+ Requires-Dist: threadpoolctl==2.2.0
228
+ Requires-Dist: tiktoken==0.5.1
229
+ Requires-Dist: tokenizers==0.13.3
230
+ Requires-Dist: tomli==2.0.1
231
+ Requires-Dist: toolz==0.12.0
232
+ Requires-Dist: tqdm==4.64.1
233
+ Requires-Dist: traitlets==5.9.0
234
+ Requires-Dist: trio==0.22.0
235
+ Requires-Dist: trio-websocket==0.10.2
236
+ Requires-Dist: tweepy==4.14.0
237
+ Requires-Dist: typer==0.7.0
238
+ Requires-Dist: typing_extensions==4.5.0
239
+ Requires-Dist: typing-inspect==0.8.0
240
+ Requires-Dist: uritemplate==4.1.1
241
+ Requires-Dist: urllib3==1.26.15
242
+ Requires-Dist: urllib3-secure-extra==0.1.0
243
+ Requires-Dist: uvicorn==0.23.2
244
+ Requires-Dist: vcrpy==4.2.1
245
+ Requires-Dist: virtualenv==20.23.0
246
+ Requires-Dist: wandb==0.13.2
247
+ Requires-Dist: wasabi==1.1.1
248
+ Requires-Dist: watchdog==3.0.0
249
+ Requires-Dist: wcwidth==0.2.6
250
+ Requires-Dist: webdriver-manager==3.8.6
251
+ Requires-Dist: websocket-client==1.5.1
252
+ Requires-Dist: websockets==11.0.3
253
+ Requires-Dist: wheel==0.38.4
254
+ Requires-Dist: wrapt==1.15.0
255
+ Requires-Dist: wsproto==1.2.0
256
+ Requires-Dist: yarl==1.9.2
257
+ Requires-Dist: zipp==3.17.0
258
+
259
+ # AutoAgents: A Framework for Automatic Agent Generation
260
+
261
+ <p align="center">
262
+ <a href=""><img src="docs/resources/logo-autoagents.jpg" alt="autoagents logo: A Framework for Automatic Agent Generation." width="150px"></a>
263
+ </p>
264
+
265
+ <p align="center">
266
+ <b>Generate different roles for GPTs to form a collaborative entity for complex tasks.</b>
267
+ </p>
268
+
269
+ <p align="center">
270
+ <a href="docs/README_CN.md"><img src="https://img.shields.io/badge/文档-中文版-blue.svg" alt="CN doc"></a>
271
+ <a href="README.md"><img src="https://img.shields.io/badge/document-English-blue.svg" alt="EN doc"></a>
272
+ <a href="docs/README_JA.md"><img src="https://img.shields.io/badge/ドキュメント-日本語-blue.svg" alt="JA doc"></a>
273
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
274
+ </p>
275
+
276
+ AutoAgents is an experimental open-source application for an Automatic Agents Generation Experiment based on LLM. This program, driven by LLM, autonomously generates multi-agents to achieve whatever goal you set.
277
+
278
+ <p align="center">
279
+ <img src=./docs/resources/framework2.jpg width="800">
280
+ </p>
281
+
282
+ ## <a name="updates"/> :boom: Updates
283
+ - **2023.09.31**: 📝 We're excited to share our paper [AutoAgents: A Framework for Automatic Agent Generation](https://arxiv.org/abs/2309.17288) related to this repository.
284
+ <p align="center">
285
+ <img width="616" alt="The execution process of AutoAgents." src="docs/resources/process.jpg">
286
+ </p>
287
+
288
+ - **2023.08.30**: 🚀 Adding a custom agent collection, AgentBank, allows you to add custom agents.
289
+
290
+ ## 🚀 Features
291
+ - **Planner**: Determines the expert roles to be added and the specific execution plan according to the problem.
292
+ - **Tools**: The set of tools that can be used, currently only compatible with the search tools.
293
+ - **Observers**: Responsible for reflecting on whether the planner and the results in the execution process are reasonable, currently including reflection checks on Agents, Plan, and Action.
294
+ - **Agents**: Expert role agents generated by the planner, including name, expertise, tools used, and LLM enhancement.
295
+ - **Plan**: The execution plan is composed of the generated expert roles, each step of the execution plan has at least one expert role agent.
296
+ - **Actions**: The specific actions of the expert roles in the execution plan, such as calling tools or outputting results.
297
+
298
+ ## Demo
299
+ Online demo:
300
+ - [Demo / HuggingFace Spaces](https://huggingface.co/spaces/LinkSoul/AutoAgents)
301
+
302
+ Video demo:
303
+ - **Rumor Verification**
304
+ <video src='https://github.com/shiyemin/AutoAgents/assets/1501158/41898e0d-4137-450c-ad9b-bfb9b8c1d27b.mp4'></video>
305
+ - **Gluttonous Snake**
306
+ <video src='https://github.com/shiyemin/AutoAgents/assets/1501158/97e408cb-b70d-4045-82ea-07319c085138.mp4'></video>
307
+
308
+ ## Installation and Usage
309
+
310
+ ### Installation
311
+
312
+ ```bash
313
+ git clone https://github.com/LinkSoul-AI/AutoAgents
314
+ cd AutoAgents
315
+ python setup.py install
316
+ ```
317
+
318
+ ### Configuration
319
+
320
+ - Configure your `OPENAI_API_KEY` in any of `config/key.yaml / config/config.yaml / env`
321
+ - Priority order: `config/key.yaml > config/config.yaml > env`
322
+
323
+ ```bash
324
+ # Copy the configuration file and make the necessary modifications.
325
+ cp config/config.yaml config/key.yaml
326
+ ```
327
+
328
+ | Variable Name | config/key.yaml | env |
329
+ | ------------------------------------------ | ----------------------------------------- | ----------------------------------------------- |
330
+ | OPENAI_API_KEY # Replace with your own key | OPENAI_API_KEY: "sk-..." | export OPENAI_API_KEY="sk-..." |
331
+ | OPENAI_API_BASE # Optional | OPENAI_API_BASE: "https://<YOUR_SITE>/v1" | export OPENAI_API_BASE="https://<YOUR_SITE>/v1" |
332
+
333
+ ### Usage
334
+ - Commandline mode:
335
+ ```python
336
+ python main.py --mode commandline --llm_api_key YOUR_OPENAI_API_KEY --serpapi_key YOUR_SERPAPI_KEY --idea "Is LK-99 really a room temperature superconducting material?"
337
+ ```
338
+ - Websocket service mode:
339
+ ```python
340
+ python main.py --mode service --host "127.0.0.1" --port 9000
341
+ ```
342
+
343
+ ### Docker
344
+ - Build docker image:
345
+ ```bash
346
+ IMAGE="linksoul.ai/autoagents"
347
+ VERSION=1.0
348
+
349
+ docker build -f docker/Dockerfile -t "${IMAGE}:${VERSION}" .
350
+ ```
351
+ - Start docker container:
352
+ ```bash
353
+ docker run -it --rm -p 7860:7860 "${IMAGE}:${VERSION}"
354
+ ```
355
+ - Open http://127.0.0.1:7860 in the browser.
356
+
357
+ ## Contact Information
358
+
359
+ If you have any questions or feedback about this project, please feel free to contact us. We highly appreciate your suggestions!
360
+
361
+ - **Email:** gy.chen@foxmail.com, ymshi@linksoul.ai
362
+ - **GitHub Issues:** For more technical inquiries, you can also create a new issue in our [GitHub repository](https://github.com/LinkSoul-AI/AutoAgents/issues).
363
+
364
+ We will respond to all questions within 2-3 business days.
365
+
366
+ ## License
367
+
368
+ [MIT license](https://raw.githubusercontent.com/LinkSoul-AI/AutoAgents/main/LICENSE)
369
+
370
+ ## Citation
371
+
372
+ If you find our work and this repository useful, please consider giving a star :star: and citation :beer::
373
+ ```bibtex
374
+ @article{chen2023auto,
375
+ title={AutoAgents: The Automatic Agents Generation Framework},
376
+ author={Chen, Guangyao and Dong, Siwei and Shu, Yu and Zhang, Ge and Jaward, Sesay and Börje, Karlsson and Fu, Jie and Shi, Yemin},
377
+ journal={arXiv preprint},
378
+ year={2023}
379
+ }
380
+ ```
381
+
382
+ ## Wechat Group
383
+
384
+ <img src=".github/QRcode.jpg" alt="Wechat Group" width="200"/>
385
+
386
+ ## Acknowledgements
387
+ The [system](https://github.com/LinkSoul-AI/AutoAgents/tree/main/autoagents/system), [action_bank](https://github.com/LinkSoul-AI/AutoAgents/tree/main/autoagents/actions/action_bank) and [role_bank](https://github.com/LinkSoul-AI/AutoAgents/tree/main/autoagents/roles/role_bank) of this code base is built using [MetaGPT](https://github.com/geekan/MetaGPT)
388
+
389
+ Icons in the framework made by Darius Dan, Freepik, kmg design, Flat Icons, Vectorslab from [FlatIcon](https://www.flaticon.com)
autoagents.egg-info/SOURCES.txt ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ autoagents/__init__.py
5
+ autoagents/environment.py
6
+ autoagents/explorer.py
7
+ autoagents.egg-info/PKG-INFO
8
+ autoagents.egg-info/SOURCES.txt
9
+ autoagents.egg-info/dependency_links.txt
10
+ autoagents.egg-info/requires.txt
11
+ autoagents.egg-info/top_level.txt
12
+ autoagents/actions/__init__.py
13
+ autoagents/actions/check_plans.py
14
+ autoagents/actions/check_roles.py
15
+ autoagents/actions/create_roles.py
16
+ autoagents/actions/custom_action.py
17
+ autoagents/actions/steps.py
18
+ autoagents/actions/action/__init__.py
19
+ autoagents/actions/action/action.py
20
+ autoagents/actions/action/action_output.py
21
+ autoagents/actions/action_bank/__init__.py
22
+ autoagents/actions/action_bank/design_api.py
23
+ autoagents/actions/action_bank/project_management.py
24
+ autoagents/actions/action_bank/requirement.py
25
+ autoagents/actions/action_bank/search_and_summarize.py
26
+ autoagents/actions/action_bank/write_code.py
27
+ autoagents/actions/action_bank/write_code_review.py
28
+ autoagents/actions/action_bank/write_prd.py
29
+ autoagents/roles/__init__.py
30
+ autoagents/roles/action_observer.py
31
+ autoagents/roles/custom_role.py
32
+ autoagents/roles/group.py
33
+ autoagents/roles/manager.py
34
+ autoagents/roles/observer.py
35
+ autoagents/roles/role.py
36
+ autoagents/roles/role_bank/__init__.py
37
+ autoagents/roles/role_bank/engineer.py
38
+ autoagents/roles/role_bank/predefined_roles.py
39
+ autoagents/system/__init__.py
40
+ autoagents/system/config.py
41
+ autoagents/system/const.py
42
+ autoagents/system/llm.py
43
+ autoagents/system/logs.py
44
+ autoagents/system/schema.py
45
+ autoagents/system/document_store/__init__.py
46
+ autoagents/system/document_store/base_store.py
47
+ autoagents/system/document_store/document.py
48
+ autoagents/system/document_store/faiss_store.py
49
+ autoagents/system/memory/__init__.py
50
+ autoagents/system/memory/longterm_memory.py
51
+ autoagents/system/memory/memory.py
52
+ autoagents/system/memory/memory_storage.py
53
+ autoagents/system/provider/__init__.py
54
+ autoagents/system/provider/anthropic_api.py
55
+ autoagents/system/provider/base_chatbot.py
56
+ autoagents/system/provider/base_gpt_api.py
57
+ autoagents/system/provider/openai_api.py
58
+ autoagents/system/tools/__init__.py
59
+ autoagents/system/tools/search_engine.py
60
+ autoagents/system/tools/search_engine_serpapi.py
61
+ autoagents/system/tools/search_engine_serper.py
62
+ autoagents/system/utils/__init__.py
63
+ autoagents/system/utils/common.py
64
+ autoagents/system/utils/mermaid.py
65
+ autoagents/system/utils/serialize.py
66
+ autoagents/system/utils/singleton.py
67
+ autoagents/system/utils/special_tokens.py
68
+ autoagents/system/utils/token_counter.py
autoagents.egg-info/dependency_links.txt ADDED
@@ -0,0 +1 @@
 
 
1
+
autoagents.egg-info/requires.txt ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ matplotlib==3.8.0
2
+ matplotlib-inline==0.1.6
3
+ abstract_singleton==1.0.1
4
+ aiofiles==23.2.1
5
+ aiohttp==3.8.4
6
+ aiosignal==1.3.1
7
+ altair==5.1.1
8
+ anthropic==0.3.6
9
+ anyio==3.7.1
10
+ appdirs==1.4.4
11
+ asgiref==3.7.2
12
+ asttokens==2.2.1
13
+ astunparse==1.6.3
14
+ async-generator==1.10
15
+ async-timeout==4.0.2
16
+ asynctest==0.13.0
17
+ attrs==23.1.0
18
+ auto_gpt_plugin_template==0.0.3
19
+ autoflake==2.1.1
20
+ backcall==0.2.0
21
+ beautifulsoup4==4.12.2
22
+ black==23.3.0
23
+ blis==0.7.9
24
+ cachetools==5.3.0
25
+ camel-converter==3.0.2
26
+ catalogue==2.0.8
27
+ certifi==2023.7.22
28
+ cffi==1.15.1
29
+ cfgv==3.3.1
30
+ channels==4.0.0
31
+ chardet==5.1.0
32
+ charset-normalizer==3.1.0
33
+ click==8.1.3
34
+ colorama==0.4.6
35
+ common==0.1.2
36
+ confection==0.0.4
37
+ contourpy==1.1.1
38
+ coverage==7.2.5
39
+ cryptography==40.0.2
40
+ cssselect==1.2.0
41
+ cycler==0.11.0
42
+ cymem==2.0.7
43
+ dataclasses-json==0.5.7
44
+ decorator==5.1.1
45
+ diskcache==5.6.1
46
+ distlib==0.3.6
47
+ distro==1.8.0
48
+ Django==4.2.3
49
+ dnspython==2.3.0
50
+ docker==6.1.2
51
+ docker-pycreds==0.4.0
52
+ duckduckgo-search==2.9.4
53
+ et-xmlfile==1.1.0
54
+ exceptiongroup==1.1.1
55
+ execnet==1.9.0
56
+ executing==1.2.0
57
+ faiss-cpu==1.7.4
58
+ fastapi==0.103.1
59
+ ffmpy==0.3.1
60
+ filelock==3.12.0
61
+ fire==0.4.0
62
+ flake8==6.0.0
63
+ fonttools==4.42.1
64
+ frozenlist==1.3.3
65
+ fsspec==2023.9.2
66
+ ghp-import==2.1.0
67
+ gitdb==4.0.10
68
+ GitPython==3.1.31
69
+ google-api-core==2.11.0
70
+ google-api-python-client==2.86.0
71
+ google-auth==2.18.0
72
+ google-auth-httplib2==0.1.0
73
+ google-search-results==2.4.2
74
+ googleapis-common-protos==1.59.0
75
+ gradio==3.44.4
76
+ gradio_client==0.5.1
77
+ greenlet==2.0.2
78
+ gTTS==2.3.1
79
+ h11==0.14.0
80
+ httpcore==0.17.0
81
+ httplib2==0.22.0
82
+ httpx==0.24.0
83
+ huggingface-hub==0.17.2
84
+ icecream==2.1.3
85
+ identify==2.5.24
86
+ idna==3.4
87
+ importlib-metadata==6.8.0
88
+ importlib-resources==6.1.0
89
+ iniconfig==2.0.0
90
+ ipdb==0.13.13
91
+ ipython==8.14.0
92
+ iso-639==0.4.5
93
+ isort==5.12.0
94
+ jedi==0.18.2
95
+ Jinja2==3.1.2
96
+ joblib==1.3.2
97
+ jsonschema==4.17.3
98
+ kiwisolver==1.4.5
99
+ langchain==0.0.231
100
+ langchainplus-sdk==0.0.20
101
+ langcodes==3.3.0
102
+ langsmith==0.0.33
103
+ litellm==0.7.5
104
+ loguru==0.6.0
105
+ lxml==4.9.2
106
+ Markdown==3.3.7
107
+ MarkupSafe==2.1.2
108
+ marshmallow==3.19.0
109
+ marshmallow-enum==1.5.1
110
+ mccabe==0.7.0
111
+ meilisearch==0.21.0
112
+ mergedeep==1.3.4
113
+ mkdocs==1.4.3
114
+ mkl-service==2.4.0
115
+ multidict==6.0.4
116
+ murmurhash==1.0.9
117
+ mypy-extensions==1.0.0
118
+ nltk==3.8.1
119
+ nodeenv==1.8.0
120
+ numexpr==2.8.4
121
+ numpy==1.25.2
122
+ oauthlib==3.2.2
123
+ openai==0.27.2
124
+ openapi-python-client==0.13.4
125
+ openapi-schema-pydantic==1.2.4
126
+ opencv-python==4.8.0.76
127
+ openpyxl==3.2.0b1
128
+ orjson==3.8.10
129
+ outcome==1.2.0
130
+ packaging==23.1
131
+ pandas==1.4.1
132
+ parso==0.8.3
133
+ pathspec==0.11.1
134
+ pathtools==0.1.2
135
+ pathy==0.10.1
136
+ pexpect==4.8.0
137
+ pickleshare==0.7.5
138
+ Pillow==9.5.0
139
+ pinecone-client==2.2.1
140
+ pip==23.0.1
141
+ platformdirs==3.5.1
142
+ playsound==1.2.2
143
+ pluggy==1.0.0
144
+ pre-commit==3.3.1
145
+ preshed==3.0.8
146
+ promise==2.3
147
+ prompt-toolkit==3.0.38
148
+ protobuf==3.20.3
149
+ psutil==5.9.5
150
+ ptyprocess==0.7.0
151
+ pure-eval==0.2.2
152
+ py-cpuinfo==9.0.0
153
+ py3langid==0.2.2
154
+ pyasn1==0.5.0
155
+ pyasn1-modules==0.3.0
156
+ pycodestyle==2.10.0
157
+ pycparser==2.21
158
+ pydantic==1.10.7
159
+ pydub==0.25.1
160
+ pyflakes==3.0.1
161
+ Pygments==2.15.1
162
+ pymdown-extensions==10.0.1
163
+ pyOpenSSL==23.1.1
164
+ pyparsing==3.0.9
165
+ pyrsistent==0.19.3
166
+ PySocks==1.7.1
167
+ pytest==7.2.2
168
+ pytest-asyncio==0.21.0
169
+ pytest-benchmark==4.0.0
170
+ pytest-cov==4.0.0
171
+ pytest-integration==0.2.3
172
+ pytest-mock==3.10.0
173
+ pytest-recording==0.12.2
174
+ pytest-xdist==3.3.0
175
+ python-dateutil==2.8.2
176
+ python-docx==0.8.11
177
+ python-dotenv==1.0.0
178
+ python-multipart==0.0.6
179
+ pytz==2023.3
180
+ PyYAML==6.0
181
+ pyyaml_env_tag==0.1
182
+ readability-lxml==0.8.1
183
+ redis==4.5.5
184
+ regex==2023.5.5
185
+ requests==2.30.0
186
+ requests-oauthlib==1.3.1
187
+ rsa==4.9
188
+ scikit-learn==1.3.0
189
+ scipy==1.11.1
190
+ selenium==4.1.4
191
+ semantic-version==2.10.0
192
+ sentry-sdk==1.31.0
193
+ setproctitle==1.3.2
194
+ setuptools==65.6.3
195
+ shellingham==1.5.0.post1
196
+ shortuuid==1.0.11
197
+ six==1.16.0
198
+ smart-open==6.3.0
199
+ smmap==5.0.0
200
+ sniffio==1.3.0
201
+ socksio==1.0.0
202
+ sortedcontainers==2.4.0
203
+ soupsieve==2.4.1
204
+ spacy==3.5.3
205
+ spacy-legacy==3.0.12
206
+ spacy-loggers==1.0.4
207
+ SQLAlchemy==2.0.15
208
+ sqlparse==0.4.4
209
+ srsly==2.4.6
210
+ stack-data==0.6.2
211
+ starlette==0.27.0
212
+ tenacity==8.2.2
213
+ termcolor==2.3.0
214
+ thinc==8.1.10
215
+ threadpoolctl==2.2.0
216
+ tiktoken==0.5.1
217
+ tokenizers==0.13.3
218
+ tomli==2.0.1
219
+ toolz==0.12.0
220
+ tqdm==4.64.1
221
+ traitlets==5.9.0
222
+ trio==0.22.0
223
+ trio-websocket==0.10.2
224
+ tweepy==4.14.0
225
+ typer==0.7.0
226
+ typing_extensions==4.5.0
227
+ typing-inspect==0.8.0
228
+ uritemplate==4.1.1
229
+ urllib3==1.26.15
230
+ urllib3-secure-extra==0.1.0
231
+ uvicorn==0.23.2
232
+ vcrpy==4.2.1
233
+ virtualenv==20.23.0
234
+ wandb==0.13.2
235
+ wasabi==1.1.1
236
+ watchdog==3.0.0
237
+ wcwidth==0.2.6
238
+ webdriver-manager==3.8.6
239
+ websocket-client==1.5.1
240
+ websockets==11.0.3
241
+ wheel==0.38.4
242
+ wrapt==1.15.0
243
+ wsproto==1.2.0
244
+ yarl==1.9.2
245
+ zipp==3.17.0
autoagents.egg-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ autoagents
autoagents/__init__.py ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
autoagents/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (166 Bytes). View file
 
autoagents/__pycache__/environment.cpython-310.pyc ADDED
Binary file (5.76 kB). View file
 
autoagents/__pycache__/explorer.cpython-310.pyc ADDED
Binary file (2.56 kB). View file
 
autoagents/actions/__init__.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ from enum import Enum
4
+
5
+ from .action import Action, ActionOutput
6
+
7
+ from .create_roles import CreateRoles
8
+ from .check_roles import CheckRoles
9
+ from .check_plans import CheckPlans
10
+ from .custom_action import CustomAction
11
+ from .steps import NextAction
12
+
13
+ # Predefined Actions
14
+ from .action_bank.requirement import Requirement
15
+ from .action_bank.write_code import WriteCode
16
+ from .action_bank.write_code_review import WriteCodeReview
17
+ from .action_bank.project_management import AssignTasks, WriteTasks
18
+ from .action_bank.design_api import WriteDesign
19
+ from .action_bank.write_prd import WritePRD
20
+ from .action_bank.search_and_summarize import SearchAndSummarize
autoagents/actions/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (960 Bytes). View file
 
autoagents/actions/__pycache__/check_plans.cpython-310.pyc ADDED
Binary file (4.38 kB). View file
 
autoagents/actions/__pycache__/check_roles.cpython-310.pyc ADDED
Binary file (7.81 kB). View file
 
autoagents/actions/__pycache__/create_roles.cpython-310.pyc ADDED
Binary file (10.1 kB). View file
 
autoagents/actions/__pycache__/custom_action.cpython-310.pyc ADDED
Binary file (5.57 kB). View file
 
autoagents/actions/__pycache__/steps.cpython-310.pyc ADDED
Binary file (4.12 kB). View file
 
autoagents/actions/action/README.md ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ ## Acknowledgements
2
+ The ```action``` and ```action_output``` from MetaGPT [MetaGPT](https://github.com/geekan/MetaGPT)
autoagents/actions/action/__init__.py ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ from .action import Action
2
+ from .action_output import ActionOutput
autoagents/actions/action/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (268 Bytes). View file
 
autoagents/actions/action/__pycache__/action.cpython-310.pyc ADDED
Binary file (2.74 kB). View file
 
autoagents/actions/action/__pycache__/action_output.cpython-310.pyc ADDED
Binary file (1.91 kB). View file
 
autoagents/actions/action/action.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # coding: utf-8
3
+ """
4
+ @Time : 2023/5/11 14:43
5
+ @Author : alexanderwu
6
+ @From : https://github.com/geekan/MetaGPT/blob/main/metagpt/actions/action.py
7
+ """
8
+ from abc import ABC
9
+ from typing import Optional
10
+
11
+ from tenacity import retry, stop_after_attempt, wait_fixed
12
+
13
+ from .action_output import ActionOutput
14
+ from autoagents.system.llm import LLM
15
+ from autoagents.system.utils.common import OutputParser
16
+ from autoagents.system.logs import logger
17
+
18
+ class Action(ABC):
19
+ def __init__(self, name: str = '', context=None, llm: LLM = None, serpapi_api_key=None):
20
+ self.name: str = name
21
+ # if llm is None:
22
+ # llm = LLM(proxy, api_key)
23
+ self.llm = llm
24
+ self.context = context
25
+ self.prefix = ""
26
+ self.profile = ""
27
+ self.desc = ""
28
+ self.content = ""
29
+ self.serpapi_api_key = serpapi_api_key
30
+ self.instruct_content = None
31
+
32
+ def set_prefix(self, prefix, profile, proxy, api_key, serpapi_api_key):
33
+ """Set prefix for later usage"""
34
+ self.prefix = prefix
35
+ self.profile = profile
36
+ self.llm = LLM(proxy, api_key)
37
+ self.serpapi_api_key = serpapi_api_key
38
+
39
+ def __str__(self):
40
+ return self.__class__.__name__
41
+
42
+ def __repr__(self):
43
+ return self.__str__()
44
+
45
+ async def _aask(self, prompt: str, system_msgs: Optional[list[str]] = None) -> str:
46
+ """Append default prefix"""
47
+ if not system_msgs:
48
+ system_msgs = []
49
+ system_msgs.append(self.prefix)
50
+ return await self.llm.aask(prompt, system_msgs)
51
+
52
+ @retry(stop=stop_after_attempt(2), wait=wait_fixed(1))
53
+ async def _aask_v1(self, prompt: str, output_class_name: str,
54
+ output_data_mapping: dict,
55
+ system_msgs: Optional[list[str]] = None) -> ActionOutput:
56
+ """Append default prefix"""
57
+ if not system_msgs:
58
+ system_msgs = []
59
+ system_msgs.append(self.prefix)
60
+ content = await self.llm.aask(prompt, system_msgs)
61
+ logger.debug(content)
62
+ output_class = ActionOutput.create_model_class(output_class_name, output_data_mapping)
63
+ parsed_data = OutputParser.parse_data_with_mapping(content, output_data_mapping)
64
+ logger.debug(parsed_data)
65
+ instruct_content = output_class(**parsed_data)
66
+ return ActionOutput(content, instruct_content)
67
+
68
+ async def run(self, *args, **kwargs):
69
+ """Run action"""
70
+ raise NotImplementedError("The run method should be implemented in a subclass.")
autoagents/actions/action/action_output.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # coding: utf-8
3
+ """
4
+ @Time : 2023/7/11 10:03
5
+ @Author : chengmaoyu
6
+ @File : action_output
7
+ @From : https://github.com/geekan/MetaGPT/blob/main/metagpt/actions/action_output.py
8
+ """
9
+
10
+ from typing import Dict, Type
11
+
12
+ from pydantic import BaseModel, create_model, root_validator, validator
13
+
14
+
15
+ class ActionOutput:
16
+ content: str
17
+ instruct_content: BaseModel
18
+
19
+ def __init__(self, content: str, instruct_content: BaseModel):
20
+ self.content = content
21
+ self.instruct_content = instruct_content
22
+
23
+ @classmethod
24
+ def create_model_class(cls, class_name: str, mapping: Dict[str, Type]):
25
+ new_class = create_model(class_name, **mapping)
26
+
27
+ @validator('*', allow_reuse=True)
28
+ def check_name(v, field):
29
+ if field.name not in mapping.keys():
30
+ raise ValueError(f'Unrecognized block: {field.name}')
31
+ return v
32
+
33
+ @root_validator(pre=True, allow_reuse=True)
34
+ def check_missing_fields(values):
35
+ required_fields = set(mapping.keys())
36
+ missing_fields = required_fields - set(values.keys())
37
+ if missing_fields:
38
+ raise ValueError(f'Missing fields: {missing_fields}')
39
+ return values
40
+
41
+ new_class.__validator_check_name = classmethod(check_name)
42
+ new_class.__root_validator_check_missing_fields = classmethod(check_missing_fields)
43
+ return new_class
autoagents/actions/action_bank/README.md ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ ## Acknowledgements
2
+ The ```design_api.py```, ```project_management.py```, ```requirement.py```, ```search_and_summarize.py```, ```write_code_review.py```, ```write_code.py``` and ```write_prd.py``` from [MetaGPT](https://github.com/geekan/MetaGPT)
autoagents/actions/action_bank/__init__.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ from .write_code import WriteCode
2
+ from .write_code_review import WriteCodeReview
3
+ from .project_management import AssignTasks, WriteTasks
4
+ from .design_api import WriteDesign
5
+ from .write_prd import WritePRD
6
+ from .search_and_summarize import SearchAndSummarize
autoagents/actions/action_bank/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (513 Bytes). View file
 
autoagents/actions/action_bank/__pycache__/design_api.cpython-310.pyc ADDED
Binary file (5.45 kB). View file
 
autoagents/actions/action_bank/__pycache__/project_management.cpython-310.pyc ADDED
Binary file (4.3 kB). View file
 
autoagents/actions/action_bank/__pycache__/requirement.cpython-310.pyc ADDED
Binary file (610 Bytes). View file
 
autoagents/actions/action_bank/__pycache__/search_and_summarize.cpython-310.pyc ADDED
Binary file (6 kB). View file
 
autoagents/actions/action_bank/__pycache__/write_code.cpython-310.pyc ADDED
Binary file (4.11 kB). View file
 
autoagents/actions/action_bank/__pycache__/write_code_review.cpython-310.pyc ADDED
Binary file (3.08 kB). View file
 
autoagents/actions/action_bank/__pycache__/write_prd.cpython-310.pyc ADDED
Binary file (5.16 kB). View file
 
autoagents/actions/action_bank/design_api.py ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ @Time : 2023/5/11 14:43
5
+ @Author : alexanderwu
6
+ @From : https://github.com/geekan/MetaGPT/blob/main/metagpt/actions/design_api.py
7
+ """
8
+ import shutil
9
+ from pathlib import Path
10
+ from typing import List
11
+
12
+ from autoagents.actions import Action, ActionOutput
13
+ from autoagents.system.const import WORKSPACE_ROOT
14
+ from autoagents.system.logs import logger
15
+ from autoagents.system.utils.common import CodeParser
16
+ from autoagents.system.utils.mermaid import mermaid_to_file
17
+
18
+ PROMPT_TEMPLATE = """
19
+ # Context
20
+ {context}
21
+
22
+ ## Format example
23
+ {format_example}
24
+ -----
25
+ Role: You are an architect; the goal is to design a SOTA PEP8-compliant python system; make the best use of good open source tools
26
+ Requirement: Fill in the following missing information based on the context, note that all sections are response with code form separately
27
+ Max Output: 8192 chars or 2048 tokens. Try to use them up.
28
+ Attention: Use '##' to split sections, not '#', and '## <SECTION_NAME>' SHOULD WRITE BEFORE the code and triple quote.
29
+
30
+ ## Implementation approach: Provide as Plain text. Analyze the difficult points of the requirements, select the appropriate open-source framework.
31
+
32
+ ## Python package name: Provide as Python str with python triple quoto, concise and clear, characters only use a combination of all lowercase and underscores
33
+
34
+ ## File list: Provided as Python list[str], the list of ONLY REQUIRED files needed to write the program(LESS IS MORE!). Only need relative paths, comply with PEP8 standards. ALWAYS write a main.py or app.py here
35
+
36
+ ## Data structures and interface definitions: Use mermaid classDiagram code syntax, including classes (INCLUDING __init__ method) and functions (with type annotations), CLEARLY MARK the RELATIONSHIPS between classes, and comply with PEP8 standards. The data structures SHOULD BE VERY DETAILED and the API should be comprehensive with a complete design.
37
+
38
+ ## Program call flow: Use sequenceDiagram code syntax, COMPLETE and VERY DETAILED, using CLASSES AND API DEFINED ABOVE accurately, covering the CRUD AND INIT of each object, SYNTAX MUST BE CORRECT.
39
+
40
+ ## Anything UNCLEAR: Provide as Plain text. Make clear here.
41
+
42
+ """
43
+ FORMAT_EXAMPLE = """
44
+ ---
45
+ ## Implementation approach
46
+ We will ...
47
+
48
+ ## Python package name
49
+ ```python
50
+ "snake_game"
51
+ ```
52
+
53
+ ## File list
54
+ ```python
55
+ [
56
+ "main.py",
57
+ ]
58
+ ```
59
+
60
+ ## Data structures and interface definitions
61
+ ```mermaid
62
+ classDiagram
63
+ class Game{
64
+ +int score
65
+ }
66
+ ...
67
+ Game "1" -- "1" Food: has
68
+ ```
69
+
70
+ ## Program call flow
71
+ ```mermaid
72
+ sequenceDiagram
73
+ participant M as Main
74
+ ...
75
+ G->>M: end game
76
+ ```
77
+
78
+ ## Anything UNCLEAR
79
+ The requirement is clear to me.
80
+ ---
81
+ """
82
+ OUTPUT_MAPPING = {
83
+ "Implementation approach": (str, ...),
84
+ "Python package name": (str, ...),
85
+ "File list": (List[str], ...),
86
+ "Data structures and interface definitions": (str, ...),
87
+ "Program call flow": (str, ...),
88
+ "Anything UNCLEAR": (str, ...),
89
+ }
90
+
91
+
92
+ class WriteDesign(Action):
93
+ def __init__(self, name, context=None, llm=None):
94
+ super().__init__(name, context, llm)
95
+ self.desc = "Based on the PRD, think about the system design, and design the corresponding APIs, " \
96
+ "data structures, library tables, processes, and paths. Please provide your design, feedback " \
97
+ "clearly and in detail."
98
+
99
+ def recreate_workspace(self, workspace: Path):
100
+ try:
101
+ shutil.rmtree(workspace)
102
+ except FileNotFoundError:
103
+ pass # 文件夹不存在,但我们不在意
104
+ workspace.mkdir(parents=True, exist_ok=True)
105
+
106
+ def _save_prd(self, docs_path, resources_path, prd):
107
+ prd_file = docs_path / 'prd.md'
108
+ quadrant_chart = CodeParser.parse_code(block="Competitive Quadrant Chart", text=prd)
109
+ mermaid_to_file(quadrant_chart, resources_path / 'competitive_analysis')
110
+ logger.info(f"Saving PRD to {prd_file}")
111
+ prd_file.write_text(prd)
112
+
113
+ def _save_system_design(self, docs_path, resources_path, content):
114
+ data_api_design = CodeParser.parse_code(block="Data structures and interface definitions", text=content)
115
+ seq_flow = CodeParser.parse_code(block="Program call flow", text=content)
116
+ mermaid_to_file(data_api_design, resources_path / 'data_api_design')
117
+ mermaid_to_file(seq_flow, resources_path / 'seq_flow')
118
+ system_design_file = docs_path / 'system_design.md'
119
+ logger.info(f"Saving System Designs to {system_design_file}")
120
+ system_design_file.write_text(content)
121
+
122
+ def _save(self, context, system_design):
123
+ if isinstance(system_design, ActionOutput):
124
+ content = system_design.content
125
+ ws_name = CodeParser.parse_str(block="Python package name", text=content)
126
+ else:
127
+ content = system_design
128
+ ws_name = CodeParser.parse_str(block="Python package name", text=system_design)
129
+ workspace = WORKSPACE_ROOT / ws_name
130
+ self.recreate_workspace(workspace)
131
+ docs_path = workspace / 'docs'
132
+ resources_path = workspace / 'resources'
133
+ docs_path.mkdir(parents=True, exist_ok=True)
134
+ resources_path.mkdir(parents=True, exist_ok=True)
135
+ self._save_prd(docs_path, resources_path, context[-1].content)
136
+ self._save_system_design(docs_path, resources_path, content)
137
+
138
+ async def run(self, context):
139
+ prompt = PROMPT_TEMPLATE.format(context=context, format_example=FORMAT_EXAMPLE)
140
+ # system_design = await self._aask(prompt)
141
+ system_design = await self._aask_v1(prompt, "system_design", OUTPUT_MAPPING)
142
+ self._save(context, system_design)
143
+ return system_design
autoagents/actions/action_bank/project_management.py ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ @Time : 2023/5/11 14:43
5
+ @Author : alexanderwu
6
+ @From : https://github.com/geekan/MetaGPT/blob/main/metagpt/actions/project_management.py
7
+ """
8
+ from typing import List, Tuple
9
+
10
+ from autoagents.actions.action import Action
11
+ from autoagents.system.const import WORKSPACE_ROOT
12
+ from autoagents.system.utils.common import CodeParser
13
+
14
+ PROMPT_TEMPLATE = '''
15
+ # Context
16
+ {context}
17
+
18
+ ## Format example
19
+ {format_example}
20
+ -----
21
+ Role: You are a project manager; the goal is to break down tasks according to PRD/technical design, give a task list, and analyze task dependencies to start with the prerequisite modules
22
+ Requirements: Based on the context, fill in the following missing information, note that all sections are returned in Python code triple quote form seperatedly. Here the granularity of the task is a file, if there are any missing files, you can supplement them
23
+ Attention: Use '##' to split sections, not '#', and '## <SECTION_NAME>' SHOULD WRITE BEFORE the code and triple quote.
24
+
25
+ ## Required Python third-party packages: Provided in requirements.txt format
26
+
27
+ ## Required Other language third-party packages: Provided in requirements.txt format
28
+
29
+ ## Full API spec: Use OpenAPI 3.0. Describe all APIs that may be used by both frontend and backend.
30
+
31
+ ## Logic Analysis: Provided as a Python list[str, str]. the first is filename, the second is class/method/function should be implemented in this file. Analyze the dependencies between the files, which work should be done first
32
+
33
+ ## Task list: Provided as Python list[str]. Each str is a filename, the more at the beginning, the more it is a prerequisite dependency, should be done first
34
+
35
+ ## Shared Knowledge: Anything that should be public like utils' functions, config's variables details that should make clear first.
36
+
37
+ ## Anything UNCLEAR: Provide as Plain text. Make clear here. For example, don't forget a main entry. don't forget to init 3rd party libs.
38
+
39
+ '''
40
+
41
+ FORMAT_EXAMPLE = '''
42
+ ---
43
+ ## Required Python third-party packages
44
+ ```python
45
+ """
46
+ flask==1.1.2
47
+ bcrypt==3.2.0
48
+ """
49
+ ```
50
+
51
+ ## Required Other language third-party packages
52
+ ```python
53
+ """
54
+ No third-party ...
55
+ """
56
+ ```
57
+
58
+ ## Full API spec
59
+ ```python
60
+ """
61
+ openapi: 3.0.0
62
+ ...
63
+ description: A JSON object ...
64
+ """
65
+ ```
66
+
67
+ ## Logic Analysis
68
+ ```python
69
+ [
70
+ ("game.py", "Contains ..."),
71
+ ]
72
+ ```
73
+
74
+ ## Task list
75
+ ```python
76
+ [
77
+ "game.py",
78
+ ]
79
+ ```
80
+
81
+ ## Shared Knowledge
82
+ ```python
83
+ """
84
+ 'game.py' contains ...
85
+ """
86
+ ```
87
+
88
+ ## Anything UNCLEAR
89
+ We need ... how to start.
90
+ ---
91
+ '''
92
+
93
+ OUTPUT_MAPPING = {
94
+ "Required Python third-party packages": (str, ...),
95
+ "Required Other language third-party packages": (str, ...),
96
+ "Full API spec": (str, ...),
97
+ "Logic Analysis": (List[Tuple[str, str]], ...),
98
+ "Task list": (List[str], ...),
99
+ "Shared Knowledge": (str, ...),
100
+ "Anything UNCLEAR": (str, ...),
101
+ }
102
+
103
+
104
+ class WriteTasks(Action):
105
+
106
+ def __init__(self, name="CreateTasks", context=None, llm=None):
107
+ super().__init__(name, context, llm)
108
+
109
+ def _save(self, context, rsp):
110
+ ws_name = CodeParser.parse_str(block="Python package name", text=context[-1].content)
111
+ file_path = WORKSPACE_ROOT / ws_name / 'docs/api_spec_and_tasks.md'
112
+ file_path.write_text(rsp.content)
113
+
114
+ # Write requirements.txt
115
+ requirements_path = WORKSPACE_ROOT / ws_name / 'requirements.txt'
116
+ requirements_path.write_text(rsp.instruct_content.dict().get("Required Python third-party packages").strip('"\n'))
117
+
118
+ async def run(self, context):
119
+ prompt = PROMPT_TEMPLATE.format(context=context, format_example=FORMAT_EXAMPLE)
120
+ rsp = await self._aask_v1(prompt, "task", OUTPUT_MAPPING)
121
+ self._save(context, rsp)
122
+ return rsp
123
+
124
+
125
+ class AssignTasks(Action):
126
+ async def run(self, *args, **kwargs):
127
+ # Here you should implement the actual action
128
+ pass
autoagents/actions/action_bank/requirement.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ from autoagents.actions import Action
2
+
3
+
4
+ class Requirement(Action):
5
+ """Requirement without any implementation details"""
6
+ async def run(self, *args, **kwargs):
7
+ raise NotImplementedError
autoagents/actions/action_bank/search_and_summarize.py ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ @Time : 2023/5/11 14:43
5
+ @Author : alexanderwu
6
+ @From : https://github.com/geekan/MetaGPT/blob/main/metagpt/actions/search_and_summarize.py
7
+ """
8
+ import time
9
+
10
+ from autoagents.actions import Action
11
+ from autoagents.system.config import Config
12
+ from autoagents.system.logs import logger
13
+ from autoagents.system.schema import Message
14
+ from autoagents.system.tools.search_engine import SearchEngine
15
+
16
+ SEARCH_AND_SUMMARIZE_SYSTEM = """### Requirements
17
+ 1. Please summarize the latest dialogue based on the reference information (secondary) and dialogue history (primary). Do not include text that is irrelevant to the conversation.
18
+ - The context is for reference only. If it is irrelevant to the user's search request history, please reduce its reference and usage.
19
+ 2. If there are citable links in the context, annotate them in the main text in the format [main text](citation link). If there are none in the context, do not write links.
20
+ 3. The reply should be graceful, clear, non-repetitive, smoothly written, and of moderate length, in {LANG}.
21
+
22
+ ### Dialogue History (For example)
23
+ A: MLOps competitors
24
+
25
+ ### Current Question (For example)
26
+ A: MLOps competitors
27
+
28
+ ### Current Reply (For example)
29
+ 1. Alteryx Designer: <desc> etc. if any
30
+ 2. Matlab: ditto
31
+ 3. IBM SPSS Statistics
32
+ 4. RapidMiner Studio
33
+ 5. DataRobot AI Platform
34
+ 6. Databricks Lakehouse Platform
35
+ 7. Amazon SageMaker
36
+ 8. Dataiku
37
+ """
38
+
39
+ SEARCH_AND_SUMMARIZE_SYSTEM_EN_US = SEARCH_AND_SUMMARIZE_SYSTEM.format(LANG='en-us')
40
+
41
+ SEARCH_AND_SUMMARIZE_PROMPT = """
42
+ ### Reference Information
43
+ {CONTEXT}
44
+
45
+ ### Dialogue History
46
+ {QUERY_HISTORY}
47
+ {QUERY}
48
+
49
+ ### Current Question
50
+ {QUERY}
51
+
52
+ ### Current Reply: Based on the information, please write the reply to the Question
53
+
54
+
55
+ """
56
+
57
+
58
+ SEARCH_AND_SUMMARIZE_SALES_SYSTEM = """## Requirements
59
+ 1. Please summarize the latest dialogue based on the reference information (secondary) and dialogue history (primary). Do not include text that is irrelevant to the conversation.
60
+ - The context is for reference only. If it is irrelevant to the user's search request history, please reduce its reference and usage.
61
+ 2. If there are citable links in the context, annotate them in the main text in the format [main text](citation link). If there are none in the context, do not write links.
62
+ 3. The reply should be graceful, clear, non-repetitive, smoothly written, and of moderate length, in Simplified Chinese.
63
+
64
+ # Example
65
+ ## Reference Information
66
+ ...
67
+
68
+ ## Dialogue History
69
+ user: Which facial cleanser is good for oily skin?
70
+ Salesperson: Hello, for oily skin, it is suggested to choose a product that can deeply cleanse, control oil, and is gentle and skin-friendly. According to customer feedback and market reputation, the following facial cleansers are recommended:...
71
+ user: Do you have any by L'Oreal?
72
+ > Salesperson: ...
73
+
74
+ ## Ideal Answer
75
+ Yes, I've selected the following for you:
76
+ 1. L'Oreal Men's Facial Cleanser: Oil control, anti-acne, balance of water and oil, pore purification, effectively against blackheads, deep exfoliation, refuse oil shine. Dense foam, not tight after washing.
77
+ 2. L'Oreal Age Perfect Hydrating Cleanser: Added with sodium cocoyl glycinate and Centella Asiatica, two effective ingredients, it can deeply cleanse, tighten the skin, gentle and not tight.
78
+ """
79
+
80
+ SEARCH_AND_SUMMARIZE_SALES_PROMPT = """
81
+ ## Reference Information
82
+ {CONTEXT}
83
+
84
+ ## Dialogue History
85
+ {QUERY_HISTORY}
86
+ {QUERY}
87
+ > {ROLE}:
88
+
89
+ """
90
+
91
+ SEARCH_FOOD = """
92
+ # User Search Request
93
+ What are some delicious foods in Xiamen?
94
+
95
+ # Requirements
96
+ You are a member of a professional butler team and will provide helpful suggestions:
97
+ 1. Please summarize the user's search request based on the context and avoid including unrelated text.
98
+ 2. Use [main text](reference link) in markdown format to **naturally annotate** 3-5 textual elements (such as product words or similar text sections) within the main text for easy navigation.
99
+ 3. The response should be elegant, clear, **without any repetition of text**, smoothly written, and of moderate length.
100
+ """
101
+
102
+
103
+ class SearchAndSummarize(Action):
104
+ def __init__(self, name="", context=None, llm=None, engine=None, search_func=None, serpapi_api_key=None):
105
+ self.config = Config()
106
+ self.serpapi_api_key = serpapi_api_key
107
+ self.engine = engine or self.config.search_engine
108
+ self.search_engine = SearchEngine(self.engine, run_func=search_func, serpapi_api_key=serpapi_api_key)
109
+ self.result = ""
110
+ super().__init__(name, context, llm, serpapi_api_key)
111
+
112
+ async def run(self, context: list[Message], system_text=SEARCH_AND_SUMMARIZE_SYSTEM) -> str:
113
+ no_serpapi = not self.config.serpapi_api_key or 'YOUR_API_KEY' == self.config.serpapi_api_key
114
+ no_serper = not self.config.serper_api_key or 'YOUR_API_KEY' == self.config.serper_api_key
115
+ no_google = not self.config.google_api_key or 'YOUR_API_KEY' == self.config.google_api_key
116
+ no_self_serpapi = self.serpapi_api_key is None
117
+
118
+ if no_serpapi and no_google and no_serper and no_self_serpapi:
119
+ logger.warning('Configure one of SERPAPI_API_KEY, SERPER_API_KEY, GOOGLE_API_KEY to unlock full feature')
120
+ return ""
121
+
122
+ query = context[-1].content
123
+ # logger.debug(query)
124
+ try_count = 0
125
+ while True:
126
+ try:
127
+ rsp = await self.search_engine.run(query)
128
+ break
129
+ except ValueError as e:
130
+ try_count += 1
131
+ if try_count >= 3:
132
+ # Retry 3 times to fail
133
+ raise e
134
+ time.sleep(1)
135
+
136
+ self.result = rsp
137
+ if not rsp:
138
+ logger.error('empty rsp...')
139
+ return ""
140
+ # logger.info(rsp)
141
+
142
+ system_prompt = [system_text]
143
+
144
+ prompt = SEARCH_AND_SUMMARIZE_PROMPT.format(
145
+ # PREFIX = self.prefix,
146
+ ROLE=self.profile,
147
+ CONTEXT=rsp,
148
+ QUERY_HISTORY='\n'.join([str(i) for i in context[:-1]]),
149
+ QUERY=str(context[-1])
150
+ )
151
+ result = await self._aask(prompt, system_prompt)
152
+ logger.debug(prompt)
153
+ logger.debug(result)
154
+ return result
autoagents/actions/action_bank/write_code.py ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ @Time : 2023/5/11 14:43
5
+ @Author : alexanderwu
6
+ @From : https://github.com/geekan/MetaGPT/blob/main/metagpt/actions/write_code.py
7
+ """
8
+ from .design_api import WriteDesign
9
+ from autoagents.actions.action import Action
10
+ from autoagents.system.const import WORKSPACE_ROOT
11
+ from autoagents.system.logs import logger
12
+ from autoagents.system.schema import Message
13
+ from autoagents.system.utils.common import CodeParser
14
+ from tenacity import retry, stop_after_attempt, wait_fixed
15
+
16
+ PROMPT_TEMPLATE = """
17
+ NOTICE
18
+ Role: You are a professional engineer; the main goal is to write PEP8 compliant, elegant, modular, easy to read and maintain Python 3.9 code (but you can also use other programming language)
19
+ ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenced "Format example".
20
+
21
+ ## Code: {filename} Write code with triple quoto, based on the following list and context.
22
+ 1. Do your best to implement THIS ONLY ONE FILE. ONLY USE EXISTING API. IF NO API, IMPLEMENT IT.
23
+ 2. Requirement: Based on the context, implement one following code file, note to return only in code form, your code will be part of the entire project, so please implement complete, reliable, reusable code snippets
24
+ 3. Attention1: If there is any setting, ALWAYS SET A DEFAULT VALUE, ALWAYS USE STRONG TYPE AND EXPLICIT VARIABLE.
25
+ 4. Attention2: YOU MUST FOLLOW "Data structures and interface definitions". DONT CHANGE ANY DESIGN.
26
+ 5. Think before writing: What should be implemented and provided in this document?
27
+ 6. CAREFULLY CHECK THAT YOU DONT MISS ANY NECESSARY CLASS/FUNCTION IN THIS FILE.
28
+ 7. Do not use public member functions that do not exist in your design.
29
+
30
+ -----
31
+ # Context
32
+ {context}
33
+ -----
34
+ ## Format example
35
+ -----
36
+ ## Code: {filename}
37
+ ```python
38
+ ## {filename}
39
+ ...
40
+ ```
41
+ -----
42
+ """
43
+
44
+
45
+ class WriteCode(Action):
46
+ def __init__(self, name="WriteCode", context: list[Message] = None, llm=None):
47
+ super().__init__(name, context, llm)
48
+
49
+ def _is_invalid(self, filename):
50
+ return any(i in filename for i in ["mp3", "wav"])
51
+
52
+ def _save(self, context, filename, code):
53
+ # logger.info(filename)
54
+ # logger.info(code_rsp)
55
+ if self._is_invalid(filename):
56
+ return
57
+
58
+ design = [i for i in context if i.cause_by == WriteDesign][0]
59
+
60
+ ws_name = CodeParser.parse_str(block="Python package name", text=design.content)
61
+ ws_path = WORKSPACE_ROOT / ws_name
62
+ if f"{ws_name}/" not in filename and all(i not in filename for i in ["requirements.txt", ".md"]):
63
+ ws_path = ws_path / ws_name
64
+ code_path = ws_path / filename
65
+ code_path.parent.mkdir(parents=True, exist_ok=True)
66
+ code_path.write_text(code)
67
+ logger.info(f"Saving Code to {code_path}")
68
+
69
+ @retry(stop=stop_after_attempt(2), wait=wait_fixed(1))
70
+ async def write_code(self, prompt):
71
+ code_rsp = await self._aask(prompt)
72
+ code = CodeParser.parse_code(block="", text=code_rsp)
73
+ return code
74
+
75
+ async def run(self, context, filename):
76
+ prompt = PROMPT_TEMPLATE.format(context=context, filename=filename)
77
+ logger.info(f'Writing {filename}..')
78
+ code = await self.write_code(prompt)
79
+ # code_rsp = await self._aask_v1(prompt, "code_rsp", OUTPUT_MAPPING)
80
+ # self._save(context, filename, code)
81
+ return code