ape-linux 0.1.1__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ape_linux-0.1.1 → ape_linux-0.1.2}/PKG-INFO +4 -4
- {ape_linux-0.1.1 → ape_linux-0.1.2}/README.md +3 -3
- {ape_linux-0.1.1 → ape_linux-0.1.2}/pyproject.toml +1 -1
- {ape_linux-0.1.1 → ape_linux-0.1.2}/src/ape/cli.py +0 -4
- {ape_linux-0.1.1 → ape_linux-0.1.2}/src/ape/llm.py +5 -9
- {ape_linux-0.1.1 → ape_linux-0.1.2}/LICENSE +0 -0
- {ape_linux-0.1.1 → ape_linux-0.1.2}/src/ape/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ape-linux
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: AI for Linux commands
|
|
5
5
|
Home-page: https://github.com/sbalian/ape
|
|
6
6
|
License: MIT
|
|
@@ -76,16 +76,16 @@ Output:
|
|
|
76
76
|
find projects/ -type d -name ".venv" -exec rm -rf {} +
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
If you try to ask something unrelated to Linux commands
|
|
79
|
+
If you try to ask something unrelated to Linux commands:
|
|
80
80
|
|
|
81
81
|
```bash
|
|
82
82
|
ape "Tell me about monkeys"
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
you should get:
|
|
86
86
|
|
|
87
87
|
```text
|
|
88
|
-
Please
|
|
88
|
+
echo "Please try again."
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
You can change the model using `--model`. The default is `gpt-4o`.
|
|
@@ -50,16 +50,16 @@ Output:
|
|
|
50
50
|
find projects/ -type d -name ".venv" -exec rm -rf {} +
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
If you try to ask something unrelated to Linux commands
|
|
53
|
+
If you try to ask something unrelated to Linux commands:
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
56
|
ape "Tell me about monkeys"
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
you should get:
|
|
60
60
|
|
|
61
61
|
```text
|
|
62
|
-
Please
|
|
62
|
+
echo "Please try again."
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
You can change the model using `--model`. The default is `gpt-4o`.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import openai
|
|
2
2
|
|
|
3
3
|
SYSTEM_PROMPT = """\
|
|
4
|
-
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 "Please
|
|
4
|
+
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."".
|
|
5
5
|
|
|
6
6
|
Here are a few examples.
|
|
7
7
|
|
|
@@ -15,10 +15,10 @@ Question: Find all files with the extension .txt under the current working direc
|
|
|
15
15
|
Answer: find . -name "*.txt"
|
|
16
16
|
|
|
17
17
|
Question: What is the captial of France?
|
|
18
|
-
Answer: Please
|
|
18
|
+
Answer: echo "Please try again."
|
|
19
19
|
|
|
20
20
|
Question: Tell me a story
|
|
21
|
-
Answer: Please
|
|
21
|
+
Answer: echo "Please try again.\"""" # noqa: E501
|
|
22
22
|
|
|
23
23
|
USER_PROMPT_TEMPLATE = """\
|
|
24
24
|
Question: {query}
|
|
@@ -67,10 +67,6 @@ def find_answer(query: str, model: str) -> str:
|
|
|
67
67
|
answer = call_llm(user_prompt, model, SYSTEM_PROMPT)
|
|
68
68
|
|
|
69
69
|
if answer is None:
|
|
70
|
-
return "Please
|
|
70
|
+
return 'echo "Please try again."'
|
|
71
71
|
else:
|
|
72
|
-
return answer
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
def no_answer(answer: str) -> bool:
|
|
76
|
-
return answer.strip().lower().rstrip(".") == "please rephrase"
|
|
72
|
+
return answer
|
|
File without changes
|
|
File without changes
|