Add categories skill tree (#5295)

Signed-off-by: Merwane Hamadi <merwanehamadi@gmail.com>
This commit is contained in:
merwanehamadi
2023-09-21 17:39:16 -07:00
committed by GitHub
parent f4e7b1c61c
commit f67a352937
16 changed files with 588 additions and 82 deletions

View File

@@ -23,6 +23,6 @@
"difficulty": "basic", "difficulty": "basic",
"side_effects": [] "side_effects": []
}, },
"name": "PasswordGenerator_Easy", "name": "PasswordGenerator",
"task": "Create a random password generator. The password should have between 8 and 16 characters and should contain letters, numbers and symbols. The password should be printed to the console. The entry point will be a python file that can be run this way: python password_generator.py [--len x] where x is the length of the password. If no length is specified, the password should be 8 characters long. The password_generator can also be imported as a module and called as password = password_generator.generate_password(len=x). Any invalid input should raise a ValueError." "task": "Create a random password generator. The password should have between 8 and 16 characters and should contain letters, numbers and symbols. The password should be printed to the console. The entry point will be a python file that can be run this way: python password_generator.py [--len x] where x is the length of the password. If no length is specified, the password should be 8 characters long. The password_generator can also be imported as a module and called as password = password_generator.generate_password(len=x). Any invalid input should raise a ValueError."
} }

View File

@@ -5,7 +5,7 @@
], ],
"cutoff": 60, "cutoff": 60,
"dependencies": [ "dependencies": [
"TestFunctionCodeGeneration" "TestWriteFile"
], ],
"eval_id": "29a10990-2584-4602-8b9d-c217f6edbc4f", "eval_id": "29a10990-2584-4602-8b9d-c217f6edbc4f",
"ground": { "ground": {

View File

@@ -4,7 +4,7 @@
], ],
"cutoff": 90, "cutoff": 90,
"dependencies": [ "dependencies": [
"TestWriteFile" "TestThreeSum"
], ],
"eval_id": "0823b577-64f2-477b-856d-16726fe464b0", "eval_id": "0823b577-64f2-477b-856d-16726fe464b0",
"ground": { "ground": {
@@ -23,6 +23,6 @@
"difficulty": "basic", "difficulty": "basic",
"side_effects": [] "side_effects": []
}, },
"name": "PasswordGenerator_Easy", "name": "PasswordGenerator",
"task": "Create a random password generator. The password should have between 8 and 16 characters and should contain letters, numbers and symbols. The password should be printed to the console. The entry point will be a python file that can be run this way: python password_generator.py [--len x] where x is the length of the password. If no length is specified, the password should be 8 characters long. The password_generator can also be imported as a module and called as password = password_generator.generate_password(len=x). Any invalid input should raise a ValueError." "task": "Create a random password generator. The password should have between 8 and 16 characters and should contain letters, numbers and symbols. The password should be printed to the console. The entry point will be a python file that can be run this way: python password_generator.py [--len x] where x is the length of the password. If no length is specified, the password should be 8 characters long. The password_generator can also be imported as a module and called as password = password_generator.generate_password(len=x). Any invalid input should raise a ValueError."
} }

View File

@@ -4,7 +4,7 @@
], ],
"cutoff": 90, "cutoff": 90,
"dependencies": [ "dependencies": [
"TestPasswordGenerator_Easy" "TestPasswordGenerator"
], ],
"eval_id": "6ace62be-6c18-431a-947f-72fb20984b58", "eval_id": "6ace62be-6c18-431a-947f-72fb20984b58",
"ground": { "ground": {
@@ -23,6 +23,6 @@
"difficulty": "basic", "difficulty": "basic",
"side_effects": [] "side_effects": []
}, },
"name": "WritingCLI_FileOrganizer", "name": "FileOrganizer",
"task": "Create a file organizer CLI tool in Python that sorts files in a directory based on their file types (e.g., images, documents, audio) and moves them into these corresponding folders: 'images', 'documents', 'audio'. The entry point will be a python file that can be run this way: python organize_files.py --directory_path=YOUR_DIRECTORY_PATH" "task": "Create a file organizer CLI tool in Python that sorts files in a directory based on their file types (e.g., images, documents, audio) and moves them into these corresponding folders: 'images', 'documents', 'audio'. The entry point will be a python file that can be run this way: python organize_files.py --directory_path=YOUR_DIRECTORY_PATH"
} }

View File

@@ -3,7 +3,9 @@
"coding" "coding"
], ],
"cutoff": 150, "cutoff": 150,
"dependencies": [], "dependencies": [
"TestFileOrganizer"
],
"eval_id": "41ca1035-ceca-4e0c-91ab-66ed0b350273", "eval_id": "41ca1035-ceca-4e0c-91ab-66ed0b350273",
"ground": { "ground": {
"answer": "The correct python file for a basic url shortener CLI", "answer": "The correct python file for a basic url shortener CLI",

View File

@@ -0,0 +1,28 @@
{
"category": [
"coding"
],
"cutoff": 150,
"dependencies": [
"TestUrlShortener"
],
"eval_id": "54c3d7e9-71d6-476b-b045-cf0aaf118f95",
"ground": {
"answer": "The correct python file for a TicTacToe game is written",
"eval": {
"type": "python"
},
"files": [
"test.py"
],
"should_contain": [],
"should_not_contain": []
},
"info": {
"description": "s ability for the agent to create Tic-Tac-Toe game",
"difficulty": "basic",
"side_effects": []
},
"name": "TicTacToe",
"task": "Build a Tic-Tac-Toe game using a python CLI. Here are the specifications.\n\nThe Grid: The game board is a 3x3 grid, consisting of 3 rows and 3 columns, creating a total of 9 squares.\n\nPlayers: There are two players. One player uses the number \"1\", and the other player uses the number \"2\".\n\nTaking Turns: Players take turns to put their respective numbers (\"1\" or \"2\") in an empty square of the grid. Once a player has placed their number in a square, it cannot be changed or removed.\n\nObjective: The goal is to get three of your numbers in a row, either horizontally, vertically, or diagonally.\n\nEnd of the Game: The game concludes in one of two ways: One player gets three of their numbers in a row (horizontally, vertically, or diagonally) and is declared the winner.\nAll squares on the grid are filled, and no player has three in a row. This situation is a \"draw\" or a \"tie\".\n\nTechnical specifications:\nBuild a file called tic_tac_toe.py. This file will be called through command lines. You will have to prompt users for their move. Player 1 will always start.\nPlayers will input their move in the following format: \"x,y\" where x and y represent the location in the grid (0,0 is top left, 2,2 is bottom right).\n\nYour primary requirement is to halt the game when appropriate and to print only one of these three exact sentences:\n\n\"Player 1 won!\"\n\"Player 2 won!\"\n\"Draw\"\n\nEdge cases: A player can send an incorrect location. Either the location is incorrect or the square is already filled. In this case, this counts as doing nothing, and the player gets prompted for new locations again.\n\n\nYou will be expected to create a python file called tic_tac_toe.py that will run through command lines by using ```python tic_tac_toe.py```.\n\nHere is an example of how your tic_tac_toe.py game will be tested.\n```\nprocess = subprocess.Popen(\n ['python', 'tic_tac_toe.py'],\n stdout=subprocess.PIPE,\n text=True\n)\n\noutput, _ = process.communicate('\\n'.join([\"0,0\", \"1,0\", \"0,1\", \"1,1\", \"0,2\"]))\n\nassert \"Player 1 won!\" in output\n```"
}

View File

@@ -1,21 +0,0 @@
{
"name": "TicTacToe",
"category": ["coding"],
"task": "Build a Tic-Tac-Toe game using a python CLI. Here are the specifications.\n\nThe Grid: The game board is a 3x3 grid, consisting of 3 rows and 3 columns, creating a total of 9 squares.\n\nPlayers: There are two players. One player uses the number \"1\", and the other player uses the number \"2\".\n\nTaking Turns: Players take turns to put their respective numbers (\"1\" or \"2\") in an empty square of the grid. Once a player has placed their number in a square, it cannot be changed or removed.\n\nObjective: The goal is to get three of your numbers in a row, either horizontally, vertically, or diagonally.\n\nEnd of the Game: The game concludes in one of two ways: One player gets three of their numbers in a row (horizontally, vertically, or diagonally) and is declared the winner.\nAll squares on the grid are filled, and no player has three in a row. This situation is a \"draw\" or a \"tie\".\n\nTechnical specifications:\nBuild a file called tic_tac_toe.py. This file will be called through command lines. You will have to prompt users for their move. Player 1 will always start.\nPlayers will input their move in the following format: \"x,y\" where x and y represent the location in the grid (0,0 is top left, 2,2 is bottom right).\n\nYour primary requirement is to halt the game when appropriate and to print only one of these three exact sentences:\n\n\"Player 1 won!\"\n\"Player 2 won!\"\n\"Draw\"\n\nEdge cases: A player can send an incorrect location. Either the location is incorrect or the square is already filled. In this case, this counts as doing nothing, and the player gets prompted for new locations again.\n\n\nYou will be expected to create a python file called tic_tac_toe.py that will run through command lines by using ```python tic_tac_toe.py```.\n\nHere is an example of how your tic_tac_toe.py game will be tested.\n```\nprocess = subprocess.Popen(\n ['python', 'tic_tac_toe.py'],\n stdout=subprocess.PIPE,\n text=True\n)\n\noutput, _ = process.communicate('\\n'.join([\"0,0\", \"1,0\", \"0,1\", \"1,1\", \"0,2\"]))\n\nassert \"Player 1 won!\" in output\n```",
"dependencies": ["WriteFile"],
"cutoff": 150,
"ground": {
"answer": "The correct python file for a TicTacToe game is written",
"should_contain": [],
"should_not_contain": [],
"files": ["test.py"],
"eval": {
"type": "python"
}
},
"info": {
"difficulty": "basic",
"description": "s ability for the agent to create Tic-Tac-Toe game",
"side_effects": []
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -275,17 +275,64 @@ def graph_interactive_network(
graph_data = {"nodes": nt.nodes, "edges": nt.edges} graph_data = {"nodes": nt.nodes, "edges": nt.edges}
home_path = Path.cwd() home_path = Path.cwd()
write_pretty_json(graph_data, home_path / "frontend" / "public" / "graph.json") write_pretty_json(graph_data, home_path / "frontend" / "public" / "graph.json")
flutter_app_path = home_path.parent / "frontend" / "assets"
# Optionally, save to a file # Optionally, save to a file
# Sync with the flutter UI # Sync with the flutter UI
# this literally only works in the AutoGPT repo, but this part of the code is not reached if BUILD_SKILL_TREE is false # this literally only works in the AutoGPT repo, but this part of the code is not reached if BUILD_SKILL_TREE is false
write_pretty_json(graph_data, flutter_app_path / "tree_structure.json")
import json
# Extract node IDs with category "coding"
coding_tree = filter_tree_by_category(graph_data, "coding")
write_pretty_json( write_pretty_json(
graph_data, coding_tree,
str(home_path.parent / "frontend" / "assets" / "tree_structure.json"), flutter_app_path / "coding_tree_structure.json",
) )
data_tree = filter_tree_by_category(graph_data, "data")
write_pretty_json(
data_tree,
flutter_app_path / "data_tree_structure.json",
)
general_tree = filter_tree_by_category(graph_data, "general")
write_pretty_json(
coding_tree,
flutter_app_path / "general_tree_structure.json",
)
scrape_synthesize_tree = filter_tree_by_category(graph_data, "scrape_synthesize")
write_pretty_json(
scrape_synthesize_tree,
flutter_app_path / "scrape_synthesize_tree_structure.json",
)
# If you want to convert back to JSON
filtered_json = json.dumps(graph_data, indent=4)
print(filtered_json)
if html_graph_path: if html_graph_path:
file_path = str(Path(html_graph_path).resolve()) file_path = str(Path(html_graph_path).resolve())
nt.write_html(file_path) nt.write_html(file_path)
def filter_tree_by_category(graph_data, category):
category_node_ids = set()
for node in graph_data["nodes"]:
if category in node["data"]["category"]:
category_node_ids.add(node["id"])
# Filter nodes
graph_data["nodes"] = [
node for node in graph_data["nodes"] if node["id"] in category_node_ids
]
# Filter edges
graph_data["edges"] = [
edge
for edge in graph_data["edges"]
if edge["from"] in category_node_ids or edge["to"] in category_node_ids
]
return graph_data

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
{
"edges": [],
"nodes": []
}

View File

@@ -0,0 +1,4 @@
{
"edges": [],
"nodes": []
}

View File

@@ -0,0 +1,4 @@
{
"edges": [],
"nodes": []
}

File diff suppressed because one or more lines are too long