ape-linux 0.1.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ape-linux
3
- Version: 0.1.0
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, you should get "Please rephrase." printed:
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
- Output:
85
+ you should get:
86
86
 
87
87
  ```text
88
- Please rephrase.
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, you should get "Please rephrase." printed:
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
- Output:
59
+ you should get:
60
60
 
61
61
  ```text
62
- Please rephrase.
62
+ echo "Please try again."
63
63
  ```
64
64
 
65
65
  You can change the model using `--model`. The default is `gpt-4o`.
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "ape-linux"
3
- version = "0.1.0"
3
+ version = "0.1.2"
4
4
  description = "AI for Linux commands"
5
5
  license = "MIT"
6
6
  authors = ["Seto Balian <seto.balian@gmail.com>"]
@@ -51,10 +51,6 @@ def run(
51
51
  typer.echo(f"Generic OpenAI error: {e}", err=True)
52
52
  raise typer.Exit(1)
53
53
 
54
- if llm.no_answer(answer):
55
- typer.echo(answer, err=True)
56
- raise typer.Exit(1)
57
-
58
54
  typer.echo(answer)
59
55
 
60
56
  if execute:
@@ -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 rephrase.".
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 rephrase.
18
+ Answer: echo "Please try again."
19
19
 
20
20
  Question: Tell me a story
21
- Answer: Please rephrase.""" # noqa: E501
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 rephrase."
70
+ return 'echo "Please try again."'
71
71
  else:
72
- return answer # this can also be "Please rephrase."
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