Add autopack (#4)

This commit is contained in:
merwanehamadi
2023-07-22 10:41:52 -07:00
committed by GitHub
parent d19c4391d4
commit 9094137d25
4 changed files with 1372 additions and 0 deletions

52
autogpt/__main__.py Normal file
View File

@@ -0,0 +1,52 @@
#!/usr/bin/env python
from autopack.errors import AutoPackError
from autopack.get_pack import try_get_packs
from autopack.installation import install_pack
from autopack.pack import Pack
from autopack.selection import select_packs
from dotenv import load_dotenv
from langchain.agents import initialize_agent, AgentType
from langchain.chat_models import ChatOpenAI
load_dotenv()
def install_packs(pack_ids: list[str]) -> list[Pack]:
packs = []
for pack_id in pack_ids:
try:
packs.append(install_pack(pack_id, force_dependencies=True))
except AutoPackError as e:
print(f"Pack {pack_id} could not be installed, leaving it out of the toolset. {e}")
continue
return packs
def main():
print("What would you like me to do?")
print("> ", end="")
user_input = input()
llm = ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo-16k-0613")
pack_ids = select_packs(user_input, llm)
packs = try_get_packs(pack_ids)
for pack in packs:
# TODO: Automatically determine how to pass init args. e.g. map env variables to API key args
pack.init_tool()
agent_executor = initialize_agent(
packs,
llm,
agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
verbose=True,
)
agent_executor.run(user_input)
if __name__ == "__main__":
main()

1297
poetry.lock generated Normal file

File diff suppressed because it is too large Load Diff

23
pyproject.toml Normal file
View File

@@ -0,0 +1,23 @@
[tool.poetry]
name = "Auto-GPT-Forge"
version = "0.1.0"
description = ""
authors = []
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.10"
langchain = "^0.0.215"
python-dotenv = "^1.0.0"
openai = "^0.27.8"
autopack-tools = "^0.2.0"
psutil = "^5.9.5"
[tool.poetry.group.dev.dependencies]
black = "^23.3.0"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

View File