dynamically load commands from registry

This commit is contained in:
Peter
2023-04-06 14:13:23 -07:00
parent 3f106963a8
commit a24ab0e879
8 changed files with 160 additions and 67 deletions

View File

@@ -3,10 +3,12 @@ import json
from config import Config
from call_ai_function import call_ai_function
from json_parser import fix_and_parse_json
from auto_gpt.commands import command
cfg = Config()
# Evaluating code
@command("evaluate_code", "Evaluate Code", '"code": "<full _code_string>"')
def evaluate_code(code: str) -> List[str]:
function_string = "def analyze_code(code: str) -> List[str]:"
args = [code]
@@ -18,7 +20,7 @@ def evaluate_code(code: str) -> List[str]:
# Improving code
@command("improve_code", "Get Improved Code", '"suggestions": "<list_of_suggestions>", "code": "<full_code_string>"')
def improve_code(suggestions: List[str], code: str) -> str:
function_string = (
"def generate_improved_code(suggestions: List[str], code: str) -> str:"
@@ -32,7 +34,7 @@ def improve_code(suggestions: List[str], code: str) -> str:
# Writing tests
@command("write_tests", "Write Tests", '"code": "<full_code_string>", "focus": "<list_of_focus_areas>"')
def write_tests(code: str, focus: List[str]) -> str:
function_string = (
"def create_test_cases(code: str, focus: Optional[str] = None) -> str:"