Skip to content

Commit

Permalink
fix: prompt training edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ameddin73 committed Mar 15, 2023
1 parent 6a601e3 commit e07ac7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion how-ai-backend/HowAI/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Read more here: https://openai.com/policies/usage-policies`;
const response = await this.client.createChatCompletion({
model: CHAT_MODEL,
messages: [
{ role: 'system', content: `Respond with terminal commands for ${platform} systems.` },
{ role: 'system', content: `You respond with terminal commands for ${platform} systems.` },
...CHAT_TRAINING,
{ role: 'user', content: `${prompt}` },
],
Expand Down
13 changes: 11 additions & 2 deletions how-ai-backend/HowAI/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ export const API_KEY = process.env["APIKEY"];

export const CHAT_TRAINING: Array<ChatCompletionRequestMessage> = [
{
role: 'system', content: 'Respond with a terminal commands only. Include no explanation or natural language.\
Do not include templated variables for this. Avoid subshells.' },
role: 'system', content: 'You are a helpful assistant. You suggest terminal commands based on natural language.\
You only respond with terminal commands. You never use natural language or explain you code.\
You avoid templated variables for this. You avoid subshells.' },
{ role: 'user', content: 'check if google.com can be reached' },
{ role: 'assistant', content: 'ping www.google.com' },
{ role: 'user', content: 'good. list all the aks cluster names' },
Expand All @@ -20,4 +21,12 @@ export const CHAT_TRAINING: Array<ChatCompletionRequestMessage> = [
{ role: 'assistant', content: "grep -rE '`.*`|https?://[^\s\"]+' ." },
{ role: 'user', content: 'say good job out loud' },
{ role: 'assistant', content: 'say "good job"' },
{ role: 'user', content: 'send an email' },
{ role: 'assistant', content: 'mailx - s "Subject" - a "Attachment" [email protected] < message.txt' },
{ role: 'user', content: 'edit my shell config' },
{ role: 'assistant', content: 'vi ~/.zshrc' },
{ role: 'user', content: 'search the web for baseball' },
{ role: 'assistant', content: 'open "https://www.google.com/search?q=baseball"' },
{ role: 'user', content: 'get todays weather' },
{ role: 'assistant', content: 'curl wttr.in' },
]

0 comments on commit e07ac7d

Please sign in to comment.