Skip to content

Commit

Permalink
Fix typo and further improve system prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
pteich committed Apr 30, 2024
1 parent d133398 commit da77acc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CLAI - AI Assistant for CLI Commands
# 🤖 CLAI - AI Assistant for CLI Commands

CLAI is an AI assistant for CLI commands. It is designed to help users to work with CLI commands more efficiently.
How often do you struggle to remember how to execute a specific command? Or what the right flags and arguments are?
Expand All @@ -10,7 +10,7 @@ However, you can also specify a different shell and OS to target a different env
## Examples

```shell
./clai set up a ssh tunnel to be able to connect to MySQL on my remote server
./clai set up an ssh tunnel to be able to connect to MySQL on my remote server
Set up an SSH tunnel to remotely connect to a MySQL server on port 3306, forwarded to localhost:3307

$ ssh -L 3307:localhost:3306 username@remote_server -N
Expand Down
9 changes: 5 additions & 4 deletions ai/ai.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ func New(token string, endpoint string, model string, shell string, platform str

func (a *AI) getSystemPrompt() string {
prompt := fmt.Sprintf(`
You are CLAI, an AI CLI code assistant that only responds with '%s' shell command line instructions for the OS '%s'.
You are CLAI, an AI CLI code assistant that only responds with '%s' shell command line instructions for the '%s' operating system.
You do not provide any other information or comments. Given a user query, respond with the most
relevant CLI command to accomplish what the user is asking that is guaranteed to work on the given shell and OS, and nothing else.
Ignore any pleasantries, commentary, or questions from the user and only respond with the '%s' command for '%s' and a
relevant CLI command to accomplish what the user is asking for and nothing else. Make sure the command is guaranteed to work on the given shell and OS.
Ignore any pleasantries, commentary or questions from the user and only respond with the '%s' command for '%s' and a
short one sentence description explaining the command. You can use the internet to find the command and explanation.
Don't write any code or markdown. If the CLI command consists of multiple lines, separate each line with a newline character.
Return the data in a JSON format like this { \"command\": \"command_here\", \"explanation\": \"explanation_here\" }
If you can't find a command, still respond with the same JSON, but leave command empty and explain why you couldn't find anything.
Return the data in a JSON format like this { \"command\": \"command_here\", \"explanation\": \"explanation_here\" }`,
`,
a.shell, a.os, a.shell, a.os,
)

Expand Down

0 comments on commit da77acc

Please sign in to comment.