Skip to content

Commit

Permalink
Rename evaluate_code to analyze_code (Significant-Gravitas#1371)
Browse files Browse the repository at this point in the history
ChatGPT is less confused by this phrasing

From my own observations and others (ie  Significant-Gravitas#101 and Significant-Gravitas#286) ChatGPT seems to think that `evaluate_code` will actually run code, rather than just provide feedback. Since changing the phrasing to `analyze_code` I haven't seen the AI make this mistake.

---------

Co-authored-by: Reinier van der Leer <[email protected]>
  • Loading branch information
willcallender and Pwuts authored Apr 19, 2023
1 parent 9514919 commit 8532307
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions autogpt/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from typing import Dict, List, NoReturn, Union

from autogpt.agent.agent_manager import AgentManager
from autogpt.commands.analyze_code import analyze_code
from autogpt.commands.audio_text import read_audio_from_file
from autogpt.commands.evaluate_code import evaluate_code
from autogpt.commands.execute_code import (
execute_python_file,
execute_shell,
Expand Down Expand Up @@ -181,8 +181,8 @@ def execute_command(command_name: str, arguments):
# TODO: Change these to take in a file rather than pasted code, if
# non-file is given, return instructions "Input should be a python
# filepath, write your code to file and try again"
elif command_name == "evaluate_code":
return evaluate_code(arguments["code"])
elif command_name == "analyze_code":
return analyze_code(arguments["code"])
elif command_name == "improve_code":
return improve_code(arguments["suggestions"], arguments["code"])
elif command_name == "write_tests":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from autogpt.llm_utils import call_ai_function


def evaluate_code(code: str) -> list[str]:
def analyze_code(code: str) -> list[str]:
"""
A function that takes in a string and returns a response from create chat
completion api call.
Expand Down
2 changes: 1 addition & 1 deletion autogpt/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def get_prompt() -> str:
("Append to file", "append_to_file", {"file": "<file>", "text": "<text>"}),
("Delete file", "delete_file", {"file": "<file>"}),
("Search Files", "search_files", {"directory": "<directory>"}),
("Evaluate Code", "evaluate_code", {"code": "<full_code_string>"}),
("Analyze Code", "analyze_code", {"code": "<full_code_string>"}),
(
"Get Improved Code",
"improve_code",
Expand Down

0 comments on commit 8532307

Please sign in to comment.