🐝 The First Self-Improving agents with RL / Prompting Optimization
Python agentaigptmulti-agentpythonreinforcement-learningself-improvementsociety-of-mindswarm-intelligence
Move to poetry (#12)
Dmitrii Khizbullinc080cb08a937
diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.ymlindex 4e65025..0726862 100644--- a/.github/workflows/pytest.yml+++ b/.github/workflows/pytest.yml@@ -34,7 +34,7 @@ jobs:- uses: actions/cache@v2with:path: ~/.cache/pip- key: ${{ hashFiles('requirements_py310_linux.txt') }}+ key: ${{ hashFiles('pyproject.toml') }}- name: Add conda to system pathrun: |@@ -44,11 +44,12 @@ jobs:- name: Install dependenciesrun: |python -m pip install --upgrade pip- pip install -r requirements_py310_linux.txt+ pip install poetry+ poetry install --with=dev- name: Test with pytestenv:GOOGLE_API_KEY: "${{ secrets.GOOGLE_API_KEY }}"GOOGLE_CSE_ID: "${{ secrets.GOOGLE_CSE_ID }}"run: |- pytest -s -m mock_llm test/\ No newline at end of file+ poetry run pytest -s -m mock_llm test/diff --git a/DEVELOPMENT.md b/DEVELOPMENT.mdindex df08dfb..b3ca34c 100644--- a/DEVELOPMENT.md+++ b/DEVELOPMENT.md@@ -59,3 +59,17 @@ open htmlcov/index.html## Packaging instructionshttps://packaging.python.org/en/latest/tutorials/packaging-projects/++### Poetry++```bash+poetry config pypi-token.pypi "<your-token>"+poetry config repositories.test-pypi https://test.pypi.org/legacy/+poetry config pypi-token.test-pypi "<your-token>"+poetry publish -r test-pypi+poetry publish++pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple gptswarm==0.1.3a1+```++More see [here](https://stackoverflow.com/a/72524326/23308099).diff --git a/README.md b/README.mdindex e0bde01..e719129 100644--- a/README.md+++ b/README.md@@ -53,7 +53,8 @@ cd GPTSwarm/```conda create -n swarm python=3.10conda activate swarm-pip install -r requirements_py310_<linux|macos>.txt+pip install poetry+poetry install```**You should add API keys in `.env.template` and change its name to `.env`**diff --git a/pyproject.toml b/pyproject.tomlindex fbed478..5eb0ea7 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -1,37 +1,77 @@-[project]+[build-system]+requires = ["poetry-core>=1.0.0"]+build-backend = "poetry.core.masonry.api"++[tool.poetry]name = "gptswarm"-version = "0.1"+version = "0.1.0"+description = "GPTSwarm: Language Agents as Optimizable Graphs"authors = [- { name="Mingchen Zhuge", email="[email protected]"},- { name="Wenyi Wang", email="[email protected]"},- { name="Louis Kirsch"},- { name="Francesco Faccio", email="[email protected]"},- { name="Dmitrii Khizbullin", email="[email protected]"},- { name="Jürgen Schmidhuber"},+ "Mingchen Zhuge <[email protected]>",+ "Wenyi Wang <[email protected]>",+ "Louis Kirsch",+ "Francesco Faccio <[email protected]>",+ "Dmitrii Khizbullin <[email protected]>",+ "Jürgen Schmidhuber",]-description = "GPTSwarm: Language Agents as Optimizable Graphs"readme = "README.md"-requires-python = ">=3.9"-classifiers = [- "Programming Language :: Python :: 3",- "License :: OSI Approved :: MIT License",- "Operating System :: OS Independent",+packages = [+ { include = "swarm" },]-dynamic = ["dependencies"]-[tool.setuptools.dynamic]-dependencies = {file = ["requirements_py310_macos.txt"]}--[project.optional-dependencies]-dev = ["black", "bumpver", "isort", "pip-tools", "pytest"]--[project.urls]-Homepage = "https://github.com/metauto-ai/GPTSwarm"-Issues = "https://github.com/metauto-ai/GPTSwarm/issues"--[build-system]-requires = ["setuptools>=61.0.0", "wheel"]-build-backend = "setuptools.build_meta"+[tool.poetry.dependencies]+python = "^3.10"+aiohttp = "^3.9.0"+apscheduler = "^3.10.4"+arxiv = "^2.0.0"+beautifulsoup4 = "^4.12.2"+charset-normalizer = "^3.3.2"+class-registry = "^2.1.2"+docx = "^0.2.4"+fastapi = "0.109.2"+func-timeout = "^4.3.5"+google-api-python-client = "^2.111.0"+gradio = "^4.11.0"+httpx = "^0.25.2"+jsonlines = "^4.0.0"+loguru = "0.7.2"+markdown = "^3.5.1"+networkx = "3.2.1"+openai = "^1.6.0"+opencv-python = "^4.8.1.78"+openpyxl = "^3.1.2"+pandas = "^1.5.3"+pydantic = "^2.5.3"+pylatexenc = "^2.10"+pypdf2 = "^3.0.1"+python-dotenv = "1.0.0"+python-docx = "^1.1.0"+python-pptx = "0.6.23"+pytube = "15.0.0"+pyvis = "0.3.2"+pyyaml = "6.0.1"+regex = "2023.10.3"+requests = "^2.31.0"+scipy = "^1.12.0"+seaborn = "^0.13.1"+sentence-transformers = "2.2.2"+shortuuid = "1.0.11"+tenacity = "^8.2.3"+termcolor = "^2.4.0"+tqdm = "^4.66.1"+transformers = "^4.36.2"+wikipedia = "^1.4.0"+astunparse = "^1.6.3"+torch = "^2.1.0"+async-timeout = "^4.0.3"-[tool.setuptools.packages.find]-where = ["swarm"]+[tool.poetry.group.dev.dependencies]+pytest = "^8.0.2"+setuptools = "^69.1.1"+pytest-asyncio = "^0.23.5"+build = "^1.1.1"+coverage = "^7.4.3"+tensorboard = "^2.16.2"+twine = "^5.0.0"+poetry-core = "^1.9.0"+poetry = "^1.8.2"diff --git a/requirements_colab.txt b/requirements_colab.txtdeleted file mode 100644index ec69fa2..0000000--- a/requirements_colab.txt+++ /dev/null@@ -1,41 +0,0 @@-aiohttp==3.9.0-APScheduler==3.10.4-arxiv==2.0.0-beautifulsoup4==4.12.3-charset_normalizer==3.3.2-class_registry==2.1.2-docx==0.2.4-fastapi==0.109.2-func_timeout==4.3.5-google_api_python_client==2.111.0-gradio==4.18.0-httpx==0.26.0-jsonlines==4.0.0-loguru==0.7.2-Markdown==3.5.1-networkx==3.2.1-openai==1.12.0-opencv_python==4.8.1.78-openpyxl==3.1.2-pandas==1.5.3-pydantic==2.6.1-pylatexenc==2.10-PyPDF2==3.0.1-python-dotenv==1.0.1-python_docx==1.1.0-python_pptx==0.6.23-pytube==15.0.0-pyvis==0.3.2-PyYAML==6.0.1-PyYAML==6.0.1-regex==2023.10.3-Requests==2.31.0-scipy==1.12.0-seaborn==0.13.2-sentence_transformers==2.2.2-shortuuid==1.0.11-tenacity==8.2.3-termcolor==2.4.0-tqdm==4.66.1-transformers==4.36.2-wikipedia==1.4.0diff --git a/requirements_py310_linux.txt b/requirements_py310_linux.txtdeleted file mode 100644index a64b460..0000000--- a/requirements_py310_linux.txt+++ /dev/null@@ -1,164 +0,0 @@---extra-index-url https://download.pytorch.org/whl/cpu-absl-py==2.0.0-aiofiles==23.2.1-aiohttp==3.9.0-aiosignal==1.3.1-altair==5.2.0-annotated-types==0.6.0-anyio==3.7.1-APScheduler==3.10.4-arxiv==2.0.0-asttokens==2.4.1-async-timeout==4.0.3-attrs==23.1.0-beautifulsoup4==4.12.2-cachetools==5.3.2-certifi==2023.11.17-charset-normalizer==3.3.2-class-registry==2.1.2-click==8.1.7-colorama==0.4.6-contourpy==1.2.0-coverage==7.4.0-cycler==0.12.1-dataclasses-json==0.6.3-decorator==5.1.1-distro==1.9.0-docx==0.2.4-et-xmlfile==1.1.0-exceptiongroup==1.2.0-executing==2.0.1-fastapi==0.105.0-feedparser==6.0.10-ffmpy==0.3.1-filelock==3.13.1-fonttools==4.47.0-frozenlist==1.4.1-fsspec==2023.12.2-func_timeout==4.3.5-google-api-core==2.15.0-google-api-python-client==2.111.0-google-auth==2.25.2-google-auth-httplib2==0.2.0-google-auth-oauthlib==1.2.0-googleapis-common-protos==1.62.0-gradio==4.11.0-gradio_client==0.7.3-greenlet==3.0.3-grpcio==1.60.0-h11==0.14.0-httpcore==1.0.2-httplib2==0.22.0-httpx==0.25.2-huggingface-hub==0.19.4-idna==3.6-importlib-resources==6.1.1-iniconfig==2.0.0-ipython==8.19.0-jedi==0.19.1-Jinja2==3.1.2-jsonlines==4.0.0-jsonpatch==1.33-jsonpickle==3.0.2-jsonpointer==2.4-jsonschema==4.20.0-jsonschema-specifications==2023.11.2-kiwisolver==1.4.5-langchain==0.0.351-langchain-community==0.0.6-langchain-core==0.1.3-langsmith==0.0.75-line-profiler==4.1.2-loguru==0.7.2-lxml==4.9.4-Markdown==3.5.1-markdown-it-py==3.0.0-MarkupSafe==2.1.3-marshmallow==3.20.1-matplotlib==3.8.2-matplotlib-inline==0.1.6-mdurl==0.1.2-mpmath==1.3.0-multidict==6.0.4-mypy-extensions==1.0.0-networkx==3.2.1-numpy==1.26.2-oauthlib==3.2.2-openai==1.6.0-opencv-python==4.8.1.78-openpyxl==3.1.2-orjson==3.9.10-packaging==23.2-pandas==2.1.4-parso==0.8.3-pexpect==4.9.0-Pillow==10.1.0-pluggy==1.3.0-prompt-toolkit==3.0.43-protobuf==4.23.4-ptyprocess==0.7.0-pure-eval==0.2.2-pyasn1==0.5.1-pyasn1-modules==0.3.0-pydantic==2.5.3-pydantic_core==2.14.6-pydub==0.25.1-Pygments==2.17.2-pylatexenc==2.10-pyparsing==3.1.1-PyPDF2==3.0.1-pytest==7.4.3-pytest-asyncio==0.23.2-python-dateutil==2.8.2-python-docx==1.1.0-python-dotenv==1.0.0-python-multipart==0.0.6-python-pptx==0.6.23-pytube==15.0.0-pytz==2023.3.post1-pyvis==0.3.2-PyYAML==6.0.1-referencing==0.32.0-regex==2023.10.3-requests==2.31.0-requests-oauthlib==1.3.1-rich==13.7.0-rpds-py==0.15.2-rsa==4.9-seaborn==0.13.1-semantic-version==2.10.0-sgmllib3k==1.0.0-shellingham==1.5.4-shortuuid==1.0.11-six==1.16.0-sniffio==1.3.0-soupsieve==2.5-SQLAlchemy==2.0.23-stack-data==0.6.3-starlette==0.27.0-sympy==1.12-tenacity==8.2.3-tensorboard==2.15.1-tensorboard-data-server==0.7.2-tomli==2.0.1-tomlkit==0.12.0-toolz==0.12.0-torch==2.1.2+cpu-tqdm==4.66.1-traitlets==5.14.0-typer==0.9.0-typing-inspect==0.9.0-typing_extensions==4.9.0-tzdata==2023.3-tzlocal==5.2-uritemplate==4.1.1-urllib3==2.1.0-uvicorn==0.25.0-wcwidth==0.2.12-websockets==11.0.3-Werkzeug==3.0.1-wikipedia==1.4.0-XlsxWriter==3.1.9-yarl==1.9.4-sentence_transformers==2.2.2-astunparse==1.6.3\ No newline at end of filediff --git a/requirements_py310_macos.txt b/requirements_py310_macos.txtdeleted file mode 100644index 23af46c..0000000--- a/requirements_py310_macos.txt+++ /dev/null@@ -1,162 +0,0 @@-absl-py==2.0.0-aiofiles==23.2.1-aiohttp==3.9.0-aiosignal==1.3.1-altair==5.2.0-annotated-types==0.6.0-anyio==3.7.1-APScheduler==3.10.4-arxiv==2.0.0-asttokens==2.4.1-async-timeout==4.0.3-attrs==23.1.0-beautifulsoup4==4.12.2-cachetools==5.3.2-certifi==2023.11.17-charset-normalizer==3.3.2-class-registry==2.1.2-click==8.1.7-colorama==0.4.6-contourpy==1.2.0-coverage==7.4.0-cycler==0.12.1-dataclasses-json==0.6.3-decorator==5.1.1-distro==1.9.0-docx==0.2.4-et-xmlfile==1.1.0-exceptiongroup==1.2.0-executing==2.0.1-fastapi==0.105.0-feedparser==6.0.10-ffmpy==0.3.1-filelock==3.13.1-fonttools==4.47.0-frozenlist==1.4.1-fsspec==2023.12.2-func-timeout==4.3.5-google-api-core==2.15.0-google-api-python-client==2.111.0-google-auth==2.25.2-google-auth-httplib2==0.2.0-google-auth-oauthlib==1.2.0-googleapis-common-protos==1.62.0-gradio==4.11.0-gradio_client==0.7.3-greenlet==3.0.3-grpcio==1.60.0-h11==0.14.0-httpcore==1.0.2-httplib2==0.22.0-httpx==0.25.2-huggingface-hub==0.19.4-idna==3.6-importlib-resources==6.1.1-iniconfig==2.0.0-ipython==8.19.0-jedi==0.19.1-Jinja2==3.1.2-jsonlines==4.0.0-jsonpatch==1.33-jsonpickle==3.0.2-jsonpointer==2.4-jsonschema==4.20.0-jsonschema-specifications==2023.11.2-kiwisolver==1.4.5-langchain==0.0.351-langchain-community==0.0.6-langchain-core==0.1.3-langsmith==0.0.75-loguru==0.7.2-lxml==4.9.4-Markdown==3.5.1-markdown-it-py==3.0.0-MarkupSafe==2.1.3-marshmallow==3.20.1-matplotlib==3.8.2-matplotlib-inline==0.1.6-mdurl==0.1.2-mpmath==1.3.0-multidict==6.0.4-mypy-extensions==1.0.0-networkx==3.2.1-numpy==1.26.2-oauthlib==3.2.2-openai==1.6.0-opencv-python==4.8.1.78-openpyxl==3.1.2-orjson==3.9.10-packaging==23.2-pandas==2.1.4-parso==0.8.3-pexpect==4.9.0-Pillow==10.1.0-pluggy==1.3.0-prompt-toolkit==3.0.43-protobuf==4.23.4-ptyprocess==0.7.0-pure-eval==0.2.2-pyasn1==0.5.1-pyasn1-modules==0.3.0-pydantic==2.5.3-pydantic_core==2.14.6-pydub==0.25.1-Pygments==2.17.2-pylatexenc==2.10-pyparsing==3.1.1-PyPDF2==3.0.1-pytest==7.4.3-pytest-asyncio==0.23.2-python-dateutil==2.8.2-python-docx==1.1.0-python-dotenv==1.0.0-python-multipart==0.0.6-python-pptx==0.6.23-pytube==15.0.0-pytz==2023.3.post1-pyvis==0.3.2-PyYAML==6.0.1-referencing==0.32.0-regex==2023.10.3-requests==2.31.0-requests-oauthlib==1.3.1-rich==13.7.0-rpds-py==0.15.2-rsa==4.9-seaborn==0.13.1-semantic-version==2.10.0-sgmllib3k==1.0.0-shellingham==1.5.4-shortuuid==1.0.11-six==1.16.0-sniffio==1.3.0-soupsieve==2.5-SQLAlchemy==2.0.23-stack-data==0.6.3-starlette==0.27.0-sympy==1.12-tenacity==8.2.3-tensorboard==2.15.1-tensorboard-data-server==0.7.2-tomli==2.0.1-tomlkit==0.12.0-toolz==0.12.0-torch==2.1.2-tqdm==4.66.1-traitlets==5.14.0-typer==0.9.0-typing-inspect==0.9.0-typing_extensions==4.9.0-tzdata==2023.3-tzlocal==5.2-uritemplate==4.1.1-urllib3==2.1.0-uvicorn==0.25.0-wcwidth==0.2.12-websockets==11.0.3-Werkzeug==3.0.1-wikipedia==1.4.0-XlsxWriter==3.1.9-yarl==1.9.4-sentence_transformers==2.2.2-astunparse==1.6.3\ No newline at end of filediff --git a/swarm/utils/const.py b/swarm/utils/const.pyindex be65803..31da5c8 100644--- a/swarm/utils/const.py+++ b/swarm/utils/const.py@@ -4,25 +4,5 @@import osfrom pathlib import Path-def find_project_root():- """- Search upwards from the current working directory to find the project root.-- The project root is identified by the presence of either a '.git' folder or a- 'requirements.txt' file. This function traverses up the directory tree until- it finds one of these markers or reaches the root directory.-- Returns:- pathlib.Path: The path object representing the project root directory.- """- current_directory = Path.cwd()- while current_directory != current_directory.parent:- if (current_directory / ".git").exists() or (current_directory / "requirements.txt").exists():- return current_directory- current_directory = current_directory.parent-- raise FileNotFoundError("Project root not found.")--GPTSWARM_ROOT = find_project_root()-+GPTSWARM_ROOT = Path(os.path.realpath(os.path.join(os.path.split(__file__)[0], "../..")))