From c38f45dc064f53893c4bbc49afd5139c498ccd28 Mon Sep 17 00:00:00 2001 From: Seto Balian Date: Sun, 27 Apr 2025 13:39:09 +0100 Subject: [PATCH 1/3] Temperature and system prompt --- ape_linux.py | 24 +++++++++++++++--------- uv.lock | 2 +- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/ape_linux.py b/ape_linux.py index fc0adcf..cb5fac1 100644 --- a/ape_linux.py +++ b/ape_linux.py @@ -31,6 +31,7 @@ def call_llm( {"role": "system", "content": system_prompt}, {"role": "user", "content": user_prompt}, ], + temperature=0.2, ) .choices[0] .message.content @@ -81,11 +82,25 @@ def main( system_prompt = """\ You are a Linux command assistant. You will be asked a question about how to perform a task in Linux or Unix-like operating systems. You should only include in your answer the command or commands to perform the task. If you do not know how to perform the task, output "echo "Please try again."". + It is important that you do not output commands enclosed in ``` ``` Markdown blocks. For example, do not output: + + ```sh + cd projects + ls + ``` + + Instead, your output should be a command that is to be entered directly into the command line. For the example above this is: cd projects && ls + + You are also allowed to use \\ for command continuation. + Here are a few examples. Question: List all the files and directories in projects in my home directory Answer: ls ~/projects + Question: Navigate to projects and list its contents + Answer: cd projects && ls + Question: What is my username? Answer: whoami @@ -98,16 +113,7 @@ def main( Question: Tell me a story Answer: echo "Please try again. - It is important that you do not output commands enclosed in ``` ``` Markdown blocks. For example, - - ```sh - cd projects - ls - ``` - - is not allowed. Instead, your output should be a command that is to be entered directly into the command line. For the example above: cd projects && ls - You are also allowed to use \\ for command continuation. \"""" # noqa: E501 user_prompt = f"""\ diff --git a/uv.lock b/uv.lock index 29730db..eb131dd 100644 --- a/uv.lock +++ b/uv.lock @@ -28,7 +28,7 @@ wheels = [ [[package]] name = "ape-linux" -version = "0.3.1" +version = "0.3.3" source = { editable = "." } dependencies = [ { name = "openai" }, From 0a4bfdeae9f33b35bef6b1c3eb0e93e19d39d2f1 Mon Sep 17 00:00:00 2001 From: Seto Balian Date: Sun, 27 Apr 2025 13:39:57 +0100 Subject: [PATCH 2/3] Update version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6259238..cc0a154 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ape-linux" -version = "0.3.3" +version = "0.3.4" description = "AI for Linux commands" readme = "README.md" license = {text = "MIT License"} From 46cdfd2c44f1c59c9b028774e951e3732e6337cd Mon Sep 17 00:00:00 2001 From: Seto Balian Date: Sun, 27 Apr 2025 13:41:14 +0100 Subject: [PATCH 3/3] Update system prompt --- ape_linux.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ape_linux.py b/ape_linux.py index cb5fac1..57848d2 100644 --- a/ape_linux.py +++ b/ape_linux.py @@ -111,10 +111,7 @@ def main( Answer: echo "Please try again." Question: Tell me a story - Answer: echo "Please try again. - - - \"""" # noqa: E501 + Answer: echo "Please try again.\"""" # noqa: E501 user_prompt = f"""\ Question: {query.strip()}