From 91da21defba0b4f7305217088367c3f308d63a30 Mon Sep 17 00:00:00 2001 From: Mason Payne Date: Wed, 20 Mar 2024 12:15:35 -0600 Subject: [PATCH] add some other useful prompts --- LLMMapper/llmMapper.go | 4 ++-- prompts/linux-machine-convo-user-prompt.tmpl | 2 ++ prompts/linux-sys-prompt.tmpl | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 prompts/linux-machine-convo-user-prompt.tmpl create mode 100644 prompts/linux-sys-prompt.tmpl diff --git a/LLMMapper/llmMapper.go b/LLMMapper/llmMapper.go index 29f51c8..60ee9de 100644 --- a/LLMMapper/llmMapper.go +++ b/LLMMapper/llmMapper.go @@ -71,7 +71,7 @@ func singlePromptInteraction(systemPrompt, prompt string, retries int) (openai.C seconds := (1 / float64(retries)) * 60 // back off for each retry e.g. 12, 15, 20, 30, 60 fmt.Printf("429 error, waiting %v seconds...\n", seconds) time.Sleep(time.Duration(seconds) * time.Second) - return singlePromptInteraction(systemPrompt, prompt, retries-1) // TODO: establish base case to prevent forever retrying + return singlePromptInteraction(systemPrompt, prompt, retries-1) } return openai.ChatCompletionResponse{}, fmt.Errorf("ChatCompletion request error: %w", err) } @@ -125,7 +125,7 @@ func sendPrompt(messages []openai.ChatCompletionMessage, retries int) (openai.Ch seconds := (1 / float64(retries)) * 60 // back off for each retry e.g. 12, 15, 20, 30, 60 fmt.Printf("429 error, waiting %v seconds...\n", seconds) time.Sleep(time.Duration(seconds) * time.Second) - return sendPrompt(messages, retries-1) // TODO: establish base case to prevent forever retrying + return sendPrompt(messages, retries-1) } return openai.ChatCompletionResponse{}, fmt.Errorf("ChatCompletion request error: %w", err) } diff --git a/prompts/linux-machine-convo-user-prompt.tmpl b/prompts/linux-machine-convo-user-prompt.tmpl new file mode 100644 index 0000000..b7a31b7 --- /dev/null +++ b/prompts/linux-machine-convo-user-prompt.tmpl @@ -0,0 +1,2 @@ +{{.userPrompt}} +Let's think step by step. \ No newline at end of file diff --git a/prompts/linux-sys-prompt.tmpl b/prompts/linux-sys-prompt.tmpl new file mode 100644 index 0000000..d8121a3 --- /dev/null +++ b/prompts/linux-sys-prompt.tmpl @@ -0,0 +1 @@ +Your job is to take a prompt from the user and generate a bash command or script to search for more context within files stored on the machine. Some previous conversations are stored in `/conversations`. Those conversations will fill in any gaps in your knowledge. Remember these conversations are free form. You'll need to allow for some fuzzy searching rather than using exact phrases. Feel free to use the best Linux tool available. Always respond with a bash command or script. \ No newline at end of file