Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions ape_linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def call_llm(
{"role": "system", "content": system_prompt},
{"role": "user", "content": user_prompt},
],
temperature=0.2,
)
.choices[0]
.message.content
Expand Down Expand Up @@ -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

Expand All @@ -96,19 +111,7 @@ def main(
Answer: echo "Please try again."

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
Answer: echo "Please try again.\"""" # noqa: E501

user_prompt = f"""\
Question: {query.strip()}
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"}
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.