forked from emrgnt-cmplxty/automata
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request emrgnt-cmplxty#25 from maks-ivanov/babyagi-archite…
…cture Babyagi architecture
- Loading branch information
Showing
6 changed files
with
218 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import os | ||
from typing import List, Union | ||
|
||
from github.Issue import Issue | ||
from github.PullRequest import PullRequest | ||
from langchain.tools import BaseTool | ||
|
||
from config import PLANNER_AGENT_OUTPUT_STRING | ||
|
||
|
||
def make_planning_task( | ||
work_item: Union[Issue, PullRequest], | ||
exec_tools: List[BaseTool], | ||
github_repo_name: str, | ||
): | ||
pr_or_issue_str = ( | ||
" submit a pull request" if isinstance(work_item, Issue) else " make a commit " | ||
) | ||
return ( | ||
f"You are a GPT-4 software engineering lead agent." | ||
f" You plan out software engineering work for developer agents." | ||
f" You are built with langchain, a framework for building language-based agents." | ||
f" You can read about it here: https://python.langchain.com/en/latest/modules/agents.html" | ||
f" Assume you have the code locally on your machine." # todo | ||
f" You are working in {os.getcwd()} on {github_repo_name} repository." | ||
f" Your task is to thoroughly understand the following work item and " | ||
f" create simple and thorough step-by-step instructions for a developer to implement the solution." | ||
f" You should not make the changes yourself, but rather output instructions for a developer to make the changes." | ||
f" \n\nTitle: {work_item.title}" | ||
f" \n\nBody: {work_item.body}" | ||
f" \n\nComments: {[c.body for c in work_item.get_comments() if not c.body.startswith(PLANNER_AGENT_OUTPUT_STRING)]}" | ||
f" \n\n The developer will use your instructions to make changes to the repository and" | ||
f" {pr_or_issue_str} with working, clean, and documented code." | ||
f" Your developer is also a GPT-4-powered agent, so keep that in mind when creating instructions." | ||
f" You should acquire an excellent understanding of the current state of the repository and the code within it." | ||
f" You should also look up documentation on the internet whenever necessary." | ||
f" Your instructions should be clear and concise, and should not contain any typos or grammatical errors." | ||
f" You should tell the developer which files to create/modify/delete, and what to write in them." | ||
f" You should also tell the developer which external libraries to use, if any." | ||
f" For external libraries, you should provide a link to the documentation." | ||
f" Make sure not to regress any existing functionality." | ||
f" The developer agent will have access to the following tools: {[(tool.name, tool.description) for tool in exec_tools]}, so keep that in mind when creating instructions." | ||
f" Begin." | ||
) | ||
|
||
|
||
def make_execution_task( | ||
work_item: Union[Issue, PullRequest], | ||
solution_instructions: str, | ||
github_repo_name: str, | ||
): | ||
pr_or_issue_str = ( | ||
" create a pull request with your changes." | ||
if isinstance(work_item, Issue) | ||
else f" make a commit with your changes to the appropriate branch." | ||
) | ||
return ( | ||
f"You are a GPT-4-powered coding agent." | ||
f" You are built with langchain, a framework for building language-based agents. " | ||
f" You can read about it here: https://python.langchain.com/en/latest/modules/agents.html" | ||
f" Your task is to contribute clean, high-quality code to the given codebase." | ||
f" You are working in {os.getcwd()} on {github_repo_name} repository." | ||
f" You are working on the following work item: " | ||
f"\n\nTitle: {work_item.title};" | ||
f"\n\nBody: {work_item.body};" | ||
f"\n\nComments: {[c.body for c in work_item.get_comments() if not c.body.startswith(PLANNER_AGENT_OUTPUT_STRING)]};" | ||
f"\n\n A planning agent has created the following step-by-step instructions for you: <instructions>{solution_instructions}</instructions>" | ||
f" Execute the instructions thoroughly and" | ||
f" {pr_or_issue_str}" | ||
f" Some of the instructions may be high level, so it's up to you to understand what exactly needs to be done." | ||
f" Make sure not to regress any existing functionality." | ||
f"\n\nUseful tips: Do NOT use nano, vim or other text editors, but rather modify files directly either via python or terminal. " | ||
f" Important: when following git-create-branch instructions, make sure to use a branch name that's not taken. " | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
GitPython==3.1.31 | ||
langchain==0.0.134 | ||
langchain~=0.0.137 | ||
openai==0.25.0 | ||
pinecone==0.1.0 | ||
PyGithub==1.58.1 | ||
python-dotenv==1.0.0 | ||
|
||
regex~=2022.10.31 | ||
typing~=3.10.0.0 | ||
beautifulsoup4~=4.12.0 | ||
requests~=2.28.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters