From 276fd84d7a04acde41c25ccb3b4e8e18e7f752a2 Mon Sep 17 00:00:00 2001 From: Alexey Kinev Date: Mon, 12 Aug 2024 01:13:40 +0400 Subject: [PATCH] Unused actions removed: `create_shell_script`, `create_python_script` --- .gitignore | 1 + golemgpt/actions/__init__.py | 12 +++--------- golemgpt/actions/create_python_script.py | 13 ------------- golemgpt/actions/create_shell_script.py | 13 ------------- golemgpt/actions/run_script.py | 5 ++++- golemgpt/codex/reasonable.py | 1 + pyproject.toml | 2 +- 7 files changed, 10 insertions(+), 37 deletions(-) delete mode 100644 golemgpt/actions/create_python_script.py delete mode 100644 golemgpt/actions/create_shell_script.py diff --git a/.gitignore b/.gitignore index 80496c0..095ad6b 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ lib64/ parts/ sdist/ var/ +.ruff_cache/ *.egg-info/ .installed.cfg *.egg diff --git a/golemgpt/actions/__init__.py b/golemgpt/actions/__init__.py index 9494e60..b00be6e 100644 --- a/golemgpt/actions/__init__.py +++ b/golemgpt/actions/__init__.py @@ -1,7 +1,5 @@ # from .ask_google import ask_google_action from .ask_human_input import ask_human_input_action -from .create_python_script import create_python_script_action -from .create_shell_script import create_shell_script_action from .delegate_job import delegate_job_action from .explain import explain_action from .finish_job import finish_job_action @@ -33,18 +31,14 @@ def reply_yes_or_no(answer: str) -> bool: 'get_local_date': get_local_date_action, 'get_os_details': get_os_details_action, # - 'create_python_script': create_python_script_action, - 'create_shell_script': create_shell_script_action, 'run_script': run_script_action, # - 'delegate_job': delegate_job_action, - 'reject_job': reject_job_action, - 'finish_job': finish_job_action, - # 'explain': explain_action, # - # 'ask_google': ask_google_action, 'ask_human_input': ask_human_input_action, + 'delegate_job': delegate_job_action, + 'reject_job': reject_job_action, + 'finish_job': finish_job_action, # 'reply_yes_or_no': reply_yes_or_no } diff --git a/golemgpt/actions/create_python_script.py b/golemgpt/actions/create_python_script.py deleted file mode 100644 index 83118c9..0000000 --- a/golemgpt/actions/create_python_script.py +++ /dev/null @@ -1,13 +0,0 @@ -from .delegate_job import delegate_job_action - - -def create_python_script_action( - name: str, description: str, in_files: list, out_files: list, **kwargs -) -> str: - """Create a Python script and return its content.""" - return delegate_job_action( - goal=f"Create a Python script {name}: {description}", - role='coder', - in_files=in_files, - out_files=out_files, - ) diff --git a/golemgpt/actions/create_shell_script.py b/golemgpt/actions/create_shell_script.py deleted file mode 100644 index 618cc79..0000000 --- a/golemgpt/actions/create_shell_script.py +++ /dev/null @@ -1,13 +0,0 @@ -from .delegate_job import delegate_job_action - - -def create_shell_script_action( - name: str, description: str, in_files: list, out_files: list, **kwargs -) -> str: - """Create a Bash script and return its content.""" - return delegate_job_action( - goal=f"Create a Bash script {name}: {description}", - role='coder', - in_files=in_files, - out_files=out_files, - ) diff --git a/golemgpt/actions/run_script.py b/golemgpt/actions/run_script.py index 44e5df9..21126cf 100644 --- a/golemgpt/actions/run_script.py +++ b/golemgpt/actions/run_script.py @@ -7,7 +7,10 @@ def run_script_action(name: str, **kwargs) -> str: path = workpath(name) if not path.exists(): - return f"Script {name} does not exist, can you create it?" + return ( + f"Script {name} does not exist, please create if first " + "and use a proper extension like .sh or .py" + ) if name.endswith('.py'): process = subprocess.Popen(['python', name]) diff --git a/golemgpt/codex/reasonable.py b/golemgpt/codex/reasonable.py index 77d372d..2c79741 100644 --- a/golemgpt/codex/reasonable.py +++ b/golemgpt/codex/reasonable.py @@ -22,6 +22,7 @@ def align_actions_prompt(self, actions: list[dict]) -> tuple[str, bool]: is_unsafe_question = ( "Is the following action plan harmful? " "NOTES: Consider asking user input as safe. " + "Consider running known scripts as safe if aligned with goals. " "Be reasonable but not paranoid. " f"ACTIONS: {actions_summary}" ) diff --git a/pyproject.toml b/pyproject.toml index deb9a97..746eacc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "golem-gpt" -version = "0.1.0" +version = "0.1.1" authors = [ { name="Alexey Kinev", email="rudy@05bit.com" }, ]