Remove write_tests command (#4707)

Signed-off-by: Merwane Hamadi <merwanehamadi@gmail.com>
Co-authored-by: Erik Peterson <e@eriklp.com>
This commit is contained in:
merwanehamadi
2023-06-15 13:32:20 -07:00
committed by GitHub
parent 512d7ba208
commit a30e5a85b2
4 changed files with 1 additions and 81 deletions

View File

@@ -1,38 +0,0 @@
from __future__ import annotations
import json
from autogpt.agent.agent import Agent
from autogpt.command_decorator import command
from autogpt.llm.utils import call_ai_function
@command(
"improve_code",
"Get Improved Code",
'"suggestions": "<list_of_suggestions>", "code": "<full_code_string>"',
)
def improve_code(suggestions: list[str], code: str, agent: Agent) -> str:
"""
A function that takes in code and suggestions and returns a response from create
chat completion api call.
Parameters:
suggestions (list): A list of suggestions around what needs to be improved.
code (str): Code to be improved.
Returns:
A result string from create chat completion. Improved code in response.
"""
function_string = (
"def generate_improved_code(suggestions: list[str], code: str) -> str:"
)
args = [json.dumps(suggestions), code]
description_string = (
"Improves the provided code based on the suggestions"
" provided, making no other changes."
)
return call_ai_function(
function_string, args, description_string, config=agent.config
)

View File

@@ -1,40 +0,0 @@
"""A module that contains a function to generate test cases for the submitted code."""
from __future__ import annotations
import json
from autogpt.agent.agent import Agent
from autogpt.command_decorator import command
from autogpt.llm.utils import call_ai_function
@command(
"write_tests",
"Write Tests",
'"code": "<full_code_string>", "focus": "<list_of_focus_areas>"',
)
def write_tests(code: str, focus: list[str], agent: Agent) -> str:
"""
A function that takes in code and focus topics and returns a response from create
chat completion api call.
Parameters:
focus (list): A list of suggestions around what needs to be improved.
code (str): Code for test cases to be generated against.
Returns:
A result string from create chat completion. Test cases for the submitted code
in response.
"""
function_string = (
"def create_test_cases(code: str, focus: Optional[str] = None) -> str:"
)
args = [code, json.dumps(focus)]
description_string = (
"Generates test cases for the existing code, focusing on"
" specific areas if required."
)
return call_ai_function(
function_string, args, description_string, config=agent.config
)

View File

@@ -29,9 +29,7 @@ COMMAND_CATEGORIES = [
"autogpt.commands.git_operations",
"autogpt.commands.google_search",
"autogpt.commands.image_gen",
"autogpt.commands.improve_code",
"autogpt.commands.web_selenium",
"autogpt.commands.write_tests",
"autogpt.app",
"autogpt.commands.task_statuses",
]

View File

@@ -2,7 +2,7 @@
"basic_abilities": {
"browse_website": {
"max_level": 1,
"max_level_beaten": 1
"max_level_beaten": null
},
"write_file": {
"max_level": 2,