martinjosifoski
commited on
Commit
•
b52b47e
1
Parent(s):
bf1e64a
First commit.
Browse files- .gitignore +443 -0
- AutoGPT.yaml +40 -0
- AutoGPTFlow.py +103 -0
- AutoGPTFlow.yaml +137 -0
- README.md +23 -0
- __init__.py +15 -0
- pip_requirements.txt +1 -0
- run.py +71 -0
.gitignore
ADDED
@@ -0,0 +1,443 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Created by https://www.toptal.com/developers/gitignore/api/python,java,c++,pycharm,visualstudiocode,macos,linux,windows
|
2 |
+
# Edit at https://www.toptal.com/developers/gitignore?templates=python,java,c++,pycharm,visualstudiocode,macos,linux,windows
|
3 |
+
|
4 |
+
### C++ ###
|
5 |
+
# Prerequisites
|
6 |
+
*.d
|
7 |
+
|
8 |
+
# Compiled Object files
|
9 |
+
*.slo
|
10 |
+
*.lo
|
11 |
+
*.o
|
12 |
+
*.obj
|
13 |
+
|
14 |
+
# Precompiled Headers
|
15 |
+
*.gch
|
16 |
+
*.pch
|
17 |
+
|
18 |
+
# Compiled Dynamic libraries
|
19 |
+
*.so
|
20 |
+
*.dylib
|
21 |
+
*.dll
|
22 |
+
|
23 |
+
# Fortran module files
|
24 |
+
*.mod
|
25 |
+
*.smod
|
26 |
+
|
27 |
+
# Compiled Static libraries
|
28 |
+
*.lai
|
29 |
+
*.la
|
30 |
+
*.a
|
31 |
+
*.lib
|
32 |
+
|
33 |
+
# Executables
|
34 |
+
*.exe
|
35 |
+
*.out
|
36 |
+
*.app
|
37 |
+
|
38 |
+
### Java ###
|
39 |
+
# Compiled class file
|
40 |
+
*.class
|
41 |
+
|
42 |
+
# Log file
|
43 |
+
*.log
|
44 |
+
|
45 |
+
# BlueJ files
|
46 |
+
*.ctxt
|
47 |
+
|
48 |
+
# Mobile Tools for Java (J2ME)
|
49 |
+
.mtj.tmp/
|
50 |
+
|
51 |
+
# Package Files #
|
52 |
+
*.jar
|
53 |
+
*.war
|
54 |
+
*.nar
|
55 |
+
*.ear
|
56 |
+
*.zip
|
57 |
+
*.tar.gz
|
58 |
+
*.rar
|
59 |
+
|
60 |
+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
61 |
+
hs_err_pid*
|
62 |
+
replay_pid*
|
63 |
+
|
64 |
+
### Linux ###
|
65 |
+
*~
|
66 |
+
|
67 |
+
# temporary files which can be created if a process still has a handle open of a deleted file
|
68 |
+
.fuse_hidden*
|
69 |
+
|
70 |
+
# KDE directory preferences
|
71 |
+
.directory
|
72 |
+
|
73 |
+
# Linux trash folder which might appear on any partition or disk
|
74 |
+
.Trash-*
|
75 |
+
|
76 |
+
# .nfs files are created when an open file is removed but is still being accessed
|
77 |
+
.nfs*
|
78 |
+
|
79 |
+
### macOS ###
|
80 |
+
# General
|
81 |
+
.DS_Store
|
82 |
+
.AppleDouble
|
83 |
+
.LSOverride
|
84 |
+
|
85 |
+
# Icon must end with two \r
|
86 |
+
Icon
|
87 |
+
|
88 |
+
|
89 |
+
# Thumbnails
|
90 |
+
._*
|
91 |
+
|
92 |
+
# Files that might appear in the root of a volume
|
93 |
+
.DocumentRevisions-V100
|
94 |
+
.fseventsd
|
95 |
+
.Spotlight-V100
|
96 |
+
.TemporaryItems
|
97 |
+
.Trashes
|
98 |
+
.VolumeIcon.icns
|
99 |
+
.com.apple.timemachine.donotpresent
|
100 |
+
|
101 |
+
# Directories potentially created on remote AFP share
|
102 |
+
.AppleDB
|
103 |
+
.AppleDesktop
|
104 |
+
Network Trash Folder
|
105 |
+
Temporary Items
|
106 |
+
.apdisk
|
107 |
+
|
108 |
+
### macOS Patch ###
|
109 |
+
# iCloud generated files
|
110 |
+
*.icloud
|
111 |
+
|
112 |
+
### PyCharm ###
|
113 |
+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
114 |
+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
115 |
+
|
116 |
+
# User-specific stuff
|
117 |
+
.idea/**/workspace.xml
|
118 |
+
.idea/**/tasks.xml
|
119 |
+
.idea/**/usage.statistics.xml
|
120 |
+
.idea/**/dictionaries
|
121 |
+
.idea/**/shelf
|
122 |
+
|
123 |
+
# AWS User-specific
|
124 |
+
.idea/**/aws.xml
|
125 |
+
|
126 |
+
# Generated files
|
127 |
+
.idea/**/contentModel.xml
|
128 |
+
|
129 |
+
# Sensitive or high-churn files
|
130 |
+
.idea/**/dataSources/
|
131 |
+
.idea/**/dataSources.ids
|
132 |
+
.idea/**/dataSources.local.xml
|
133 |
+
.idea/**/sqlDataSources.xml
|
134 |
+
.idea/**/dynamic.xml
|
135 |
+
.idea/**/uiDesigner.xml
|
136 |
+
.idea/**/dbnavigator.xml
|
137 |
+
|
138 |
+
# Gradle
|
139 |
+
.idea/**/gradle.xml
|
140 |
+
.idea/**/libraries
|
141 |
+
|
142 |
+
# Gradle and Maven with auto-import
|
143 |
+
# When using Gradle or Maven with auto-import, you should exclude module files,
|
144 |
+
# since they will be recreated, and may cause churn. Uncomment if using
|
145 |
+
# auto-import.
|
146 |
+
# .idea/artifacts
|
147 |
+
# .idea/compiler.xml
|
148 |
+
# .idea/jarRepositories.xml
|
149 |
+
# .idea/modules.xml
|
150 |
+
# .idea/*.iml
|
151 |
+
# .idea/modules
|
152 |
+
# *.iml
|
153 |
+
# *.ipr
|
154 |
+
|
155 |
+
# CMake
|
156 |
+
cmake-build-*/
|
157 |
+
|
158 |
+
# Mongo Explorer plugin
|
159 |
+
.idea/**/mongoSettings.xml
|
160 |
+
|
161 |
+
# File-based project format
|
162 |
+
*.iws
|
163 |
+
|
164 |
+
# IntelliJ
|
165 |
+
out/
|
166 |
+
|
167 |
+
# mpeltonen/sbt-idea plugin
|
168 |
+
.idea_modules/
|
169 |
+
|
170 |
+
# JIRA plugin
|
171 |
+
atlassian-ide-plugin.xml
|
172 |
+
|
173 |
+
# Cursive Clojure plugin
|
174 |
+
.idea/replstate.xml
|
175 |
+
|
176 |
+
# SonarLint plugin
|
177 |
+
.idea/sonarlint/
|
178 |
+
|
179 |
+
# Crashlytics plugin (for Android Studio and IntelliJ)
|
180 |
+
com_crashlytics_export_strings.xml
|
181 |
+
crashlytics.properties
|
182 |
+
crashlytics-build.properties
|
183 |
+
fabric.properties
|
184 |
+
|
185 |
+
# Editor-based Rest Client
|
186 |
+
.idea/httpRequests
|
187 |
+
|
188 |
+
# Android studio 3.1+ serialized cache file
|
189 |
+
.idea/caches/build_file_checksums.ser
|
190 |
+
|
191 |
+
### PyCharm Patch ###
|
192 |
+
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
193 |
+
|
194 |
+
# *.iml
|
195 |
+
# modules.xml
|
196 |
+
# .idea/misc.xml
|
197 |
+
# *.ipr
|
198 |
+
|
199 |
+
# Sonarlint plugin
|
200 |
+
# https://plugins.jetbrains.com/plugin/7973-sonarlint
|
201 |
+
.idea/**/sonarlint/
|
202 |
+
|
203 |
+
# SonarQube Plugin
|
204 |
+
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
|
205 |
+
.idea/**/sonarIssues.xml
|
206 |
+
|
207 |
+
# Markdown Navigator plugin
|
208 |
+
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
|
209 |
+
.idea/**/markdown-navigator.xml
|
210 |
+
.idea/**/markdown-navigator-enh.xml
|
211 |
+
.idea/**/markdown-navigator/
|
212 |
+
|
213 |
+
# Cache file creation bug
|
214 |
+
# See https://youtrack.jetbrains.com/issue/JBR-2257
|
215 |
+
.idea/$CACHE_FILE$
|
216 |
+
|
217 |
+
# CodeStream plugin
|
218 |
+
# https://plugins.jetbrains.com/plugin/12206-codestream
|
219 |
+
.idea/codestream.xml
|
220 |
+
|
221 |
+
# Azure Toolkit for IntelliJ plugin
|
222 |
+
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
|
223 |
+
.idea/**/azureSettings.xml
|
224 |
+
|
225 |
+
### Python ###
|
226 |
+
# Byte-compiled / optimized / DLL files
|
227 |
+
__pycache__/
|
228 |
+
*.py[cod]
|
229 |
+
*$py.class
|
230 |
+
|
231 |
+
# C extensions
|
232 |
+
|
233 |
+
# Distribution / packaging
|
234 |
+
.Python
|
235 |
+
build/
|
236 |
+
develop-eggs/
|
237 |
+
dist/
|
238 |
+
downloads/
|
239 |
+
eggs/
|
240 |
+
.eggs/
|
241 |
+
lib/
|
242 |
+
lib64/
|
243 |
+
parts/
|
244 |
+
sdist/
|
245 |
+
var/
|
246 |
+
wheels/
|
247 |
+
share/python-wheels/
|
248 |
+
*.egg-info/
|
249 |
+
.installed.cfg
|
250 |
+
*.egg
|
251 |
+
MANIFEST
|
252 |
+
|
253 |
+
# PyInstaller
|
254 |
+
# Usually these files are written by a python script from a template
|
255 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
256 |
+
*.manifest
|
257 |
+
*.spec
|
258 |
+
|
259 |
+
# Installer logs
|
260 |
+
pip-log.txt
|
261 |
+
pip-delete-this-directory.txt
|
262 |
+
|
263 |
+
# Unit test / coverage reports
|
264 |
+
htmlcov/
|
265 |
+
.tox/
|
266 |
+
.nox/
|
267 |
+
.coverage
|
268 |
+
.coverage.*
|
269 |
+
.cache
|
270 |
+
nosetests.xml
|
271 |
+
coverage.xml
|
272 |
+
*.cover
|
273 |
+
*.py,cover
|
274 |
+
.hypothesis/
|
275 |
+
.pytest_cache/
|
276 |
+
cover/
|
277 |
+
|
278 |
+
# Translations
|
279 |
+
*.mo
|
280 |
+
*.pot
|
281 |
+
|
282 |
+
# Django stuff:
|
283 |
+
local_settings.py
|
284 |
+
db.sqlite3
|
285 |
+
db.sqlite3-journal
|
286 |
+
|
287 |
+
# Flask stuff:
|
288 |
+
instance/
|
289 |
+
.webassets-cache
|
290 |
+
|
291 |
+
# Scrapy stuff:
|
292 |
+
.scrapy
|
293 |
+
|
294 |
+
# Sphinx documentation
|
295 |
+
docs/_build/
|
296 |
+
|
297 |
+
# PyBuilder
|
298 |
+
.pybuilder/
|
299 |
+
target/
|
300 |
+
|
301 |
+
# Jupyter Notebook
|
302 |
+
.ipynb_checkpoints
|
303 |
+
|
304 |
+
# IPython
|
305 |
+
profile_default/
|
306 |
+
ipython_config.py
|
307 |
+
|
308 |
+
# pyenv
|
309 |
+
# For a library or package, you might want to ignore these files since the code is
|
310 |
+
# intended to run in multiple environments; otherwise, check them in:
|
311 |
+
# .python-version
|
312 |
+
|
313 |
+
# pipenv
|
314 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
315 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
316 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
317 |
+
# install all needed dependencies.
|
318 |
+
#Pipfile.lock
|
319 |
+
|
320 |
+
# poetry
|
321 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
322 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
323 |
+
# commonly ignored for libraries.
|
324 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
325 |
+
#poetry.lock
|
326 |
+
|
327 |
+
# pdm
|
328 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
329 |
+
#pdm.lock
|
330 |
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
331 |
+
# in version control.
|
332 |
+
# https://pdm.fming.dev/#use-with-ide
|
333 |
+
.pdm.toml
|
334 |
+
|
335 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
336 |
+
__pypackages__/
|
337 |
+
|
338 |
+
# Celery stuff
|
339 |
+
celerybeat-schedule
|
340 |
+
celerybeat.pid
|
341 |
+
|
342 |
+
# SageMath parsed files
|
343 |
+
*.sage.py
|
344 |
+
|
345 |
+
# Environments
|
346 |
+
.env
|
347 |
+
.venv
|
348 |
+
env/
|
349 |
+
venv/
|
350 |
+
ENV/
|
351 |
+
env.bak/
|
352 |
+
venv.bak/
|
353 |
+
|
354 |
+
# Spyder project settings
|
355 |
+
.spyderproject
|
356 |
+
.spyproject
|
357 |
+
|
358 |
+
# Rope project settings
|
359 |
+
.ropeproject
|
360 |
+
|
361 |
+
# mkdocs documentation
|
362 |
+
/site
|
363 |
+
|
364 |
+
# mypy
|
365 |
+
.mypy_cache/
|
366 |
+
.dmypy.json
|
367 |
+
dmypy.json
|
368 |
+
|
369 |
+
# Pyre type checker
|
370 |
+
.pyre/
|
371 |
+
|
372 |
+
# pytype static type analyzer
|
373 |
+
.pytype/
|
374 |
+
|
375 |
+
# Cython debug symbols
|
376 |
+
cython_debug/
|
377 |
+
|
378 |
+
# PyCharm
|
379 |
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
380 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
381 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
382 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
383 |
+
#.idea/
|
384 |
+
|
385 |
+
### Python Patch ###
|
386 |
+
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
|
387 |
+
poetry.toml
|
388 |
+
|
389 |
+
# ruff
|
390 |
+
.ruff_cache/
|
391 |
+
|
392 |
+
# LSP config files
|
393 |
+
pyrightconfig.json
|
394 |
+
|
395 |
+
### VisualStudioCode ###
|
396 |
+
.vscode/*
|
397 |
+
!.vscode/settings.json
|
398 |
+
!.vscode/tasks.json
|
399 |
+
!.vscode/launch.json
|
400 |
+
!.vscode/extensions.json
|
401 |
+
!.vscode/*.code-snippets
|
402 |
+
|
403 |
+
# Local History for Visual Studio Code
|
404 |
+
.history/
|
405 |
+
|
406 |
+
# Built Visual Studio Code Extensions
|
407 |
+
*.vsix
|
408 |
+
|
409 |
+
### VisualStudioCode Patch ###
|
410 |
+
# Ignore all local history of files
|
411 |
+
.history
|
412 |
+
.ionide
|
413 |
+
|
414 |
+
### Windows ###
|
415 |
+
# Windows thumbnail cache files
|
416 |
+
Thumbs.db
|
417 |
+
Thumbs.db:encryptable
|
418 |
+
ehthumbs.db
|
419 |
+
ehthumbs_vista.db
|
420 |
+
|
421 |
+
# Dump file
|
422 |
+
*.stackdump
|
423 |
+
|
424 |
+
# Folder config file
|
425 |
+
[Dd]esktop.ini
|
426 |
+
|
427 |
+
# Recycle Bin used on file shares
|
428 |
+
$RECYCLE.BIN/
|
429 |
+
|
430 |
+
# Windows Installer files
|
431 |
+
*.cab
|
432 |
+
*.msi
|
433 |
+
*.msix
|
434 |
+
*.msm
|
435 |
+
*.msp
|
436 |
+
|
437 |
+
# Windows shortcuts
|
438 |
+
*.lnk
|
439 |
+
|
440 |
+
# End of https://www.toptal.com/developers/gitignore/api/python,java,c++,pycharm,visualstudiocode,macos,linux,windows
|
441 |
+
|
442 |
+
.*
|
443 |
+
flow_modules/
|
AutoGPT.yaml
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
flow:
|
2 |
+
_target_: aiflows.AutoGPTFlowModule.AutoGPTFlow.instantiate_from_default_config
|
3 |
+
max_rounds: 30
|
4 |
+
|
5 |
+
### Subflows specification
|
6 |
+
subflows_config:
|
7 |
+
Controller:
|
8 |
+
_target_: aiflows.ControllerExecutorFlowModule.ControllerAtomicFlow.instantiate_from_default_config
|
9 |
+
commands:
|
10 |
+
wiki_search:
|
11 |
+
description: "Performs a search on Wikipedia."
|
12 |
+
input_args: [ "search_term" ]
|
13 |
+
ddg_search:
|
14 |
+
description: "Query the search engine DuckDuckGo."
|
15 |
+
input_args: [ "query" ]
|
16 |
+
finish:
|
17 |
+
description: "Signal that the objective has been satisfied, and returns the answer to the user."
|
18 |
+
input_args: [ "answer" ]
|
19 |
+
human_message_prompt_template:
|
20 |
+
template: |2-
|
21 |
+
Here is the response to your last action:
|
22 |
+
{{observation}}
|
23 |
+
Here is the feedback from the user:
|
24 |
+
{{human_feedback}}
|
25 |
+
input_variables:
|
26 |
+
- "observation"
|
27 |
+
- "human_feedback"
|
28 |
+
input_interface_initialized:
|
29 |
+
- "observation"
|
30 |
+
- "human_feedback"
|
31 |
+
|
32 |
+
Executor:
|
33 |
+
_target_: flows.base_flows.BranchingFlow.instantiate_from_default_config
|
34 |
+
subflows_config:
|
35 |
+
wiki_search:
|
36 |
+
_target_: aiflows.ControllerExecutorFlowModule.WikiSearchAtomicFlow.instantiate_from_default_config
|
37 |
+
ddg_search:
|
38 |
+
_target_: aiflows.LCToolFlowModule.LCToolFlow.instantiate_from_default_config
|
39 |
+
backend:
|
40 |
+
_target_: langchain.tools.DuckDuckGoSearchRun
|
AutoGPTFlow.py
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import sys
|
2 |
+
from typing import Dict, Any
|
3 |
+
|
4 |
+
from flows.base_flows import CircularFlow
|
5 |
+
from flows.utils import logging
|
6 |
+
|
7 |
+
logging.set_verbosity_debug()
|
8 |
+
|
9 |
+
log = logging.get_logger(__name__)
|
10 |
+
|
11 |
+
from flow_modules.aiflows.ControllerExecutorFlowModule import ControllerAtomicFlow
|
12 |
+
from flow_modules.aiflows.VectorStoreFlowModule import ChromaDBFlow
|
13 |
+
|
14 |
+
class AutoGPTFlow(CircularFlow):
|
15 |
+
def _on_reach_max_round(self):
|
16 |
+
self._state_update_dict({
|
17 |
+
"answer": "The maximum amount of rounds was reached before the model found an answer.",
|
18 |
+
"status": "unfinished"
|
19 |
+
})
|
20 |
+
|
21 |
+
@staticmethod
|
22 |
+
def _get_memory_key(flow_state):
|
23 |
+
goal = flow_state.get("goal")
|
24 |
+
last_command = flow_state.get("command")
|
25 |
+
last_command_args = flow_state.get("command_args")
|
26 |
+
last_observation = flow_state.get("observation")
|
27 |
+
last_human_feedback = flow_state.get("human_feedback")
|
28 |
+
|
29 |
+
if last_command is None:
|
30 |
+
return ""
|
31 |
+
|
32 |
+
assert goal is not None, goal
|
33 |
+
assert last_command_args is not None, last_command_args
|
34 |
+
assert last_observation is not None, last_observation
|
35 |
+
|
36 |
+
current_context = \
|
37 |
+
f"""
|
38 |
+
== Goal ==
|
39 |
+
{goal}
|
40 |
+
|
41 |
+
== Command ==
|
42 |
+
{last_command}
|
43 |
+
== Args
|
44 |
+
{last_command_args}
|
45 |
+
== Result
|
46 |
+
{last_observation}
|
47 |
+
|
48 |
+
== Human Feedback ==
|
49 |
+
{last_human_feedback}
|
50 |
+
"""
|
51 |
+
|
52 |
+
return current_context
|
53 |
+
|
54 |
+
@CircularFlow.input_msg_payload_builder
|
55 |
+
def prepare_memory_read_input(self, flow_state: Dict[str, Any], dst_flow: ChromaDBFlow) -> Dict[str, Any]:
|
56 |
+
"""A (very) basic example implementation of how the memory retrieval could be constructed."""
|
57 |
+
query = self._get_memory_key(flow_state)
|
58 |
+
|
59 |
+
return {
|
60 |
+
"operation": "read",
|
61 |
+
"content": query
|
62 |
+
}
|
63 |
+
|
64 |
+
@CircularFlow.output_msg_payload_processor
|
65 |
+
def prepare_memory_read_output(self, output_payload: Dict[str, Any], src_flow: ControllerAtomicFlow):
|
66 |
+
retrieved_memories = output_payload["retrieved"][0][1:]
|
67 |
+
return {"memory": "\n".join(retrieved_memories)}
|
68 |
+
|
69 |
+
@CircularFlow.input_msg_payload_builder
|
70 |
+
def prepare_memory_write_input(self, flow_state: Dict[str, Any], dst_flow: ChromaDBFlow) -> Dict[str, Any]:
|
71 |
+
"""An (very) example (not optimized) implementation of how the memory population could be implemented."""
|
72 |
+
query = self._get_memory_key(flow_state)
|
73 |
+
|
74 |
+
return {
|
75 |
+
"operation": "write",
|
76 |
+
"content": str(query)
|
77 |
+
}
|
78 |
+
|
79 |
+
@CircularFlow.output_msg_payload_processor
|
80 |
+
def detect_finish_or_continue(self, output_payload: Dict[str, Any], src_flow: ControllerAtomicFlow) -> Dict[
|
81 |
+
str, Any]:
|
82 |
+
command = output_payload["command"]
|
83 |
+
if command == "finish":
|
84 |
+
return {
|
85 |
+
"EARLY_EXIT": True,
|
86 |
+
"answer": output_payload["command_args"]["answer"],
|
87 |
+
"status": "finished"
|
88 |
+
}
|
89 |
+
else:
|
90 |
+
return output_payload
|
91 |
+
|
92 |
+
@CircularFlow.output_msg_payload_processor
|
93 |
+
def detect_finish_in_human_input(self, output_payload: Dict[str, Any], src_flow: ControllerAtomicFlow) -> Dict[
|
94 |
+
str, Any]:
|
95 |
+
human_feedback = output_payload["human_input"]
|
96 |
+
if human_feedback.strip().lower() == "q":
|
97 |
+
return {
|
98 |
+
"EARLY_EXIT": True,
|
99 |
+
"answer": "The user has chosen to exit before a final answer was generated.",
|
100 |
+
"status": "unfinished"
|
101 |
+
}
|
102 |
+
|
103 |
+
return {"human_feedback": human_feedback}
|
AutoGPTFlow.yaml
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: "AutoGPTFlow"
|
2 |
+
description: "An example implementation of AutoGPT with Flows."
|
3 |
+
max_rounds: 30
|
4 |
+
early_exit_key: "EARLY_EXIT"
|
5 |
+
|
6 |
+
### Information used by the default get_interface_description implementation
|
7 |
+
input_interface:
|
8 |
+
- "goal"
|
9 |
+
output_interface:
|
10 |
+
- "answer"
|
11 |
+
- "status"
|
12 |
+
|
13 |
+
### Subflows specification
|
14 |
+
subflows_config:
|
15 |
+
Controller:
|
16 |
+
_target_: aiflows.ControllerExecutorFlowModule.ControllerAtomicFlow.instantiate_from_default_config
|
17 |
+
finish:
|
18 |
+
description: "Signal that the objective has been satisfied, and returns the answer to the user."
|
19 |
+
input_args: ["answer"]
|
20 |
+
# E.g.,
|
21 |
+
# commands:
|
22 |
+
# wiki_search:
|
23 |
+
# description: "Performs a search on Wikipedia."
|
24 |
+
# input_args: ["search_term"]
|
25 |
+
# ddg_search:
|
26 |
+
# description: "Query the search engine DuckDuckGo."
|
27 |
+
# input_args: ["query"]
|
28 |
+
human_message_prompt_template:
|
29 |
+
template: |2
|
30 |
+
Potentially relevant information retrieved from your memory:
|
31 |
+
{{memory}}
|
32 |
+
=================
|
33 |
+
Here is the response to your last action:
|
34 |
+
{{observation}}
|
35 |
+
Here is the feedback from the user:
|
36 |
+
{{human_feedback}}
|
37 |
+
input_variables:
|
38 |
+
- "observation"
|
39 |
+
- "human_feedback"
|
40 |
+
- "memory"
|
41 |
+
input_interface_initialized:
|
42 |
+
- "observation"
|
43 |
+
- "human_feedback"
|
44 |
+
- "memory"
|
45 |
+
|
46 |
+
Executor:
|
47 |
+
_target_: flows.base_flows.BranchingFlow.instantiate_from_default_config
|
48 |
+
# E.g.,
|
49 |
+
# subflows_config:
|
50 |
+
# wiki_search:
|
51 |
+
# _target_: .WikiSearchAtomicFlow.instantiate_from_default_config
|
52 |
+
# ddg_search:
|
53 |
+
# _target_: flows.application_flows.LCToolFlowModule.LCToolFlow.instantiate_from_default_config
|
54 |
+
# backend:
|
55 |
+
# _target_: langchain.tools.DuckDuckGoSearchRun
|
56 |
+
|
57 |
+
HumanFeedback:
|
58 |
+
_target_: aiflows.HumanStandardInputFlowModule.HumanStandardInputFlow.instantiate_from_default_config
|
59 |
+
request_multi_line_input_flag: False
|
60 |
+
query_message_prompt_template:
|
61 |
+
template: |2-
|
62 |
+
Please provide feedback on the last step. To quit type: "q".
|
63 |
+
|
64 |
+
Relevant information:
|
65 |
+
== Goal ==
|
66 |
+
{{goal}}
|
67 |
+
|
68 |
+
== Last Command ==
|
69 |
+
{{command}}
|
70 |
+
|
71 |
+
== Args
|
72 |
+
{{command_args}}
|
73 |
+
|
74 |
+
== Result
|
75 |
+
{{observation}}
|
76 |
+
input_variables:
|
77 |
+
- "goal"
|
78 |
+
- "command"
|
79 |
+
- "command_args"
|
80 |
+
- "observation"
|
81 |
+
input_interface_initialized:
|
82 |
+
- "goal"
|
83 |
+
- "command"
|
84 |
+
- "command_args"
|
85 |
+
- "observation"
|
86 |
+
|
87 |
+
Memory:
|
88 |
+
_target_: aiflows.VectorStoreFlowModule.ChromaDBFlow.instantiate_from_default_config
|
89 |
+
n_results: 2
|
90 |
+
|
91 |
+
topology:
|
92 |
+
- goal: "Retrieve relevant information from memory."
|
93 |
+
input_interface:
|
94 |
+
_target_: AutoGPTFlow.prepare_memory_read_input # An interface defined as a function in the Flow class
|
95 |
+
flow: Memory
|
96 |
+
output_interface:
|
97 |
+
_target_: AutoGPTFlow.prepare_memory_read_output
|
98 |
+
reset: false
|
99 |
+
|
100 |
+
- goal: "Select the next action and prepare the input for the executor."
|
101 |
+
input_interface:
|
102 |
+
_target_: flows.interfaces.KeyInterface
|
103 |
+
additional_transformations:
|
104 |
+
- _target_: flows.data_transformations.KeyMatchInput
|
105 |
+
flow: Controller
|
106 |
+
output_interface:
|
107 |
+
_target_: AutoGPTFlow.detect_finish_or_continue # An interface defined as a function in the Flow class
|
108 |
+
reset: false
|
109 |
+
|
110 |
+
- goal: "Execute the action specified by the Controller."
|
111 |
+
input_interface:
|
112 |
+
_target_: flows.interfaces.KeyInterface
|
113 |
+
keys_to_rename:
|
114 |
+
command: branch
|
115 |
+
command_args: branch_input_data
|
116 |
+
keys_to_select: ["branch", "branch_input_data"]
|
117 |
+
flow: Executor
|
118 |
+
output_interface:
|
119 |
+
_target_: flows.interfaces.KeyInterface
|
120 |
+
keys_to_rename:
|
121 |
+
branch_output_data: observation
|
122 |
+
keys_to_select: ["observation"]
|
123 |
+
reset: false
|
124 |
+
|
125 |
+
- goal: "Ask the user for feedback."
|
126 |
+
input_interface:
|
127 |
+
_target_: flows.interfaces.KeyInterface
|
128 |
+
flow: HumanFeedback
|
129 |
+
output_interface:
|
130 |
+
_target_: AutoGPTFlow.detect_finish_in_human_input
|
131 |
+
reset: false
|
132 |
+
|
133 |
+
- goal: "Write relevant information to memory"
|
134 |
+
input_interface:
|
135 |
+
_target_: AutoGPTFlow.prepare_memory_write_input # An interface defined as a function in the Flow class
|
136 |
+
flow: Memory
|
137 |
+
reset: false
|
README.md
CHANGED
@@ -1,3 +1,26 @@
|
|
1 |
---
|
2 |
license: mit
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
---
|
4 |
+
ToDo:
|
5 |
+
|
6 |
+
## Description
|
7 |
+
|
8 |
+
< Flow description >
|
9 |
+
|
10 |
+
## Configuration parameters
|
11 |
+
|
12 |
+
< Name 1 > (< Type 1 >): < Description 1 >. Required parameter.
|
13 |
+
|
14 |
+
< Name 2 > (< Type 2 >): < Description 2 >. Default value is: < value 2 >
|
15 |
+
|
16 |
+
## Input interface
|
17 |
+
|
18 |
+
< Name 1 > (< Type 1 >): < Description 1 >.
|
19 |
+
|
20 |
+
(Note that the interface might depend on the state of the Flow.)
|
21 |
+
|
22 |
+
## Output interface
|
23 |
+
|
24 |
+
< Name 1 > (< Type 1 >): < Description 1 >.
|
25 |
+
|
26 |
+
(Note that the interface might depend on the state of the Flow.)
|
__init__.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ~~~ Specify the dependencies ~~~
|
2 |
+
dependencies = [
|
3 |
+
{"url": "aiflows/ControllerExecutorFlowModule",
|
4 |
+
"revision": "ba2c90bb9b0539af39ccad90c98a2ba1f9a22c91"},
|
5 |
+
{"url": "aiflows/HumanStandardInputFlowModule",
|
6 |
+
"revision": "890e92da1fefbae642fd84296e31bca7f61ea710"},
|
7 |
+
{"url": "aiflows/VectorStoreFlowModule",
|
8 |
+
"revision": "bfb6e70d581f81ad130af4554e824127aebf1497"},
|
9 |
+
]
|
10 |
+
from flows import flow_verse
|
11 |
+
|
12 |
+
flow_verse.sync_dependencies(dependencies)
|
13 |
+
# ~~~
|
14 |
+
|
15 |
+
from .AutoGPTFlow import AutoGPTFlow
|
pip_requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
duckduckgo-search==3.9.2
|
run.py
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
import hydra
|
4 |
+
|
5 |
+
import flows
|
6 |
+
from flows.flow_launchers import FlowLauncher, ApiInfo
|
7 |
+
from flows.utils.general_helpers import read_yaml_file
|
8 |
+
|
9 |
+
from flows import logging
|
10 |
+
from flows.flow_cache import CACHING_PARAMETERS, clear_cache
|
11 |
+
|
12 |
+
CACHING_PARAMETERS.do_caching = False # Set to True in order to disable caching
|
13 |
+
# clear_cache() # Uncomment this line to clear the cache
|
14 |
+
|
15 |
+
logging.set_verbosity_debug()
|
16 |
+
|
17 |
+
dependencies = [
|
18 |
+
{"url": "aiflows/AutoGPTFlowModule", "revision": os.getcwd()},
|
19 |
+
{"url": "aiflows/LCToolFlowModule", "revision": "46dd24ecc3dc4f4f0191e57c202cc7d20e8e7782"},
|
20 |
+
]
|
21 |
+
from flows import flow_verse
|
22 |
+
flow_verse.sync_dependencies(dependencies)
|
23 |
+
|
24 |
+
if __name__ == "__main__":
|
25 |
+
# ~~~ Set the API information ~~~
|
26 |
+
# OpenAI backend
|
27 |
+
# api_information = ApiInfo("openai", os.getenv("OPENAI_API_KEY"))
|
28 |
+
# Azure backend
|
29 |
+
api_information = ApiInfo("azure", os.getenv("AZURE_OPENAI_KEY"), os.getenv("AZURE_OPENAI_ENDPOINT"))
|
30 |
+
|
31 |
+
root_dir = "."
|
32 |
+
cfg_path = os.path.join(root_dir, "AutoGPT.yaml")
|
33 |
+
cfg = read_yaml_file(cfg_path)
|
34 |
+
|
35 |
+
# ~~~ Instantiate the Flow ~~~
|
36 |
+
flow_with_interfaces = {
|
37 |
+
"flow": hydra.utils.instantiate(cfg['flow'], _recursive_=False, _convert_="partial"),
|
38 |
+
"input_interface": (
|
39 |
+
None
|
40 |
+
if getattr(cfg, "input_interface", None) is None
|
41 |
+
else hydra.utils.instantiate(cfg['input_interface'], _recursive_=False)
|
42 |
+
),
|
43 |
+
"output_interface": (
|
44 |
+
None
|
45 |
+
if getattr(cfg, "output_interface", None) is None
|
46 |
+
else hydra.utils.instantiate(cfg['output_interface'], _recursive_=False)
|
47 |
+
),
|
48 |
+
}
|
49 |
+
|
50 |
+
# ~~~ Get the data ~~~
|
51 |
+
# data = {"id": 0, "goal": "Answer the following question: What is the population of Canada?"} # Uses wikipedia
|
52 |
+
# data = {"id": 0, "goal": "Answer the following question: Who was the NBA champion in 2023?"} # Uses duckduckgo
|
53 |
+
data = {"id": 0, "goal": "Answer the following question: What is the date of birth of Michael Jordan?"}
|
54 |
+
# At first, we retrieve information about Michael Jordan the basketball player
|
55 |
+
# If we provide feedback, only in the first round, that we are not interested in the basketball player,
|
56 |
+
# but the statistician, and skip the feedback in the next rounds, we get the correct answer
|
57 |
+
|
58 |
+
# ~~~ Run inference ~~~
|
59 |
+
path_to_output_file = None
|
60 |
+
# path_to_output_file = "output.jsonl" # Uncomment this line to save the output to disk
|
61 |
+
|
62 |
+
_, outputs = FlowLauncher.launch(
|
63 |
+
flow_with_interfaces=flow_with_interfaces,
|
64 |
+
data=data,
|
65 |
+
path_to_output_file=path_to_output_file,
|
66 |
+
api_information=api_information,
|
67 |
+
)
|
68 |
+
|
69 |
+
# ~~~ Print the output ~~~
|
70 |
+
flow_output_data = outputs[0]
|
71 |
+
print(flow_output_data)
|