Skip to content

Commit f4d5b06

Browse files
committed
improved and updated prompting to LLM
1 parent 9c191a6 commit f4d5b06

File tree

2 files changed

+37
-50
lines changed

2 files changed

+37
-50
lines changed

src/stores/MessageStore.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const useMessageStore = defineStore('messages', () => {
3030
}
3131

3232
async function generateWords() {
33-
const command = `Given the conversation history, generate a short list of key words and connector words or
33+
const command = `Given the conversation history, generate a short list of key words or
3434
very short phrases the assistant can select from to build a new sentence`
3535
wordSuggestions.value = await getResponse(messageHistory.value, command, true, false)
3636
}
@@ -54,14 +54,14 @@ export const useMessageStore = defineStore('messages', () => {
5454

5555
// New Sentence
5656
async function generateWordSuggestionsFromNewTopic(topic) {
57-
const command = `Ignore all previous conversation. Generate a short list of key words and connector words
58-
the assistant can select from to build a new sentence, based around a new topic: '${topic}'`
57+
const command = `Ignore all previous conversation. Generate a short list of key words
58+
the assistant can select from to build a new sentence, based around this new topic: '${topic}'`
5959
wordSuggestions.value = await getResponse(messageHistory.value, command, true, false)
6060
}
6161

6262
async function generateSentenceSuggestionsFromNewTopic(topic) {
6363
const command = `Ignore all previous conversation. Generate a list of 3 to 5 short generic sentences the
64-
assistant may want to say, based around a new topic: '${topic}'`
64+
assistant may want to say, based around this new topic: '${topic}'`
6565
sentenceSuggestions.value = await getResponse(messageHistory.value, command, false, true)
6666
activeEditHistory.value = activeEditHistory.value.concat([
6767
{role: "system", content: command},
@@ -82,8 +82,8 @@ export const useMessageStore = defineStore('messages', () => {
8282
}
8383

8484
async function generateWordsForSingleResponseFromHint(response, hint) {
85-
const command = `The response '${response}' was close. Generate a short list of key words and connector
86-
words or very short phrases the assistant can select from to build a similar sentence, based on the hint: '${hint}'`
85+
const command = `The response '${response}' was close. Generate a short list of key words or
86+
very short phrases the assistant can select from to build a similar sentence, based on the hint: '${hint}'`
8787
const messages = messageHistory.value.concat(activeEditHistory.value)
8888
wordSuggestions.value = await getResponse(messages, command, true, false)
8989
}
@@ -100,7 +100,7 @@ export const useMessageStore = defineStore('messages', () => {
100100

101101
async function generateWordsForAllResponsesFromHint(hint) {
102102
const command = `None of those suggestions were very useful. This time, instead of full sentences, generate
103-
a short list of key words and connector words or very short phrases, that the assistant can select from to build
103+
a short list of key words or very short phrases, that the assistant can select from to build
104104
alternative sentences. Here is a hint to help guide you: '${hint}'`
105105
const messages = messageHistory.value.concat(activeEditHistory.value)
106106
wordSuggestions.value = await getResponse(messages, command, true, false)
@@ -118,7 +118,7 @@ export const useMessageStore = defineStore('messages', () => {
118118
}
119119

120120
async function generateWordSuggestionsFromHint(hint) {
121-
const command = `Given the conversation history, generate a short list of key words and connector words or
121+
const command = `Given the conversation history, generate a short list of key words or
122122
very short phrases the assistant can select from to build a new sentence, based on the hint: '${hint}'`
123123
wordSuggestions.value = await getResponse(messageHistory.value, command, true, false)
124124
}

src/stores/SettingsStore.js

+29-42
Original file line numberDiff line numberDiff line change
@@ -37,36 +37,36 @@ senses pity.
3737
You are an AI Bot for someone living with Motor Neurone Disease (MND) (hereafter referred to as the 'assistant'). You
3838
receive a conversation between the assistant and another person (the 'user') . Your job
3939
is to suggest various likely short sentences that the assistant might want to say to continue the conversation, or a short
40-
list of key words and phrases the scribe can use to build a sentence.
40+
list of key words and phrases the assistant can use to build a sentence.
4141
4242
Here are the rules for the generated suggestions:
4343
4444
- suggestions SHOULD cover a broad range of emotions or affirmative and negative options where it is suitable
45-
- suggestions SHOULD reflect the personality and interests of the user given in the backstory where appropriate.
45+
- suggestions SHOULD reflect the personality and interests of the user given in the assistant's backstory, but only where appropriate.
4646
- suggestions SHOULD reflect any current context given.
4747
- suggestions SHOULD be tailored to the person you are speaking with
48-
- suggestions MUST be numerous enough to give variety, but not overwhelming in choice. Around 5 is often appropriate.
48+
- suggestions MUST be numerous enough to give variety, but not overwhelming in choice. Around 5 is often appropriate for sentences, about 10-15 for key words.
4949
- suggestions MUST not be so specific that they assume any information not given in the backstory
5050
- suggestions MUST not assume the user is always positive and polite. The user may often be frustrated, negative or tired
51-
for example - suggested suggestions must provide this option.
5251
5352
Here is the assistant's backstory:
5453
${backstory.value}
5554
56-
The format of the conversation will be a list of previous messages between 'user' and 'assistant', followed by an instruction, for example to generate new sentences / likely words list, or to modify previous suggestions.
55+
The format of the conversation will be a list of previous messages between 'user' and 'assistant', followed by an instruction.
56+
The instruction could be to generate suggested sentences or a likely words list, or to modify previous suggestions for example.
5757
5858
All your generated suggestions MUST be a valid JSON list.
5959
Below are some examples of inputs and outputs in the correct format. You will be playing the role of the assistant:
6060
user:
6161
just going to the bar, want anything?
6262
6363
system:
64-
Given the conversation history, generate a list of 3 to 5 short generic sentences the user may want to say
64+
Given the conversation history, generate a list of 3 to 5 short generic sentences the assistant may want to say
6565
6666
assistant:
6767
{
6868
"suggestions": [
69-
"No I really am okay thanks",
69+
"No I'm okay thanks",
7070
"Oh go on then, a beer would be great thanks",
7171
"Well, maybe a glass of water?"
7272
]
@@ -76,60 +76,47 @@ user:
7676
have you seen Dune yet?
7777
7878
system:
79-
Given the following list of words, generate between 3-5 sentences that the user might be trying to say.
80-
Keep them generic:
79+
Given the following list of words, generate between 3-5 sentences that the assistant might be trying to say.
80+
Keep them generic but use all the words:
8181
['recommend', 'watching']
8282
8383
assistant:
8484
{
8585
"suggestions": [
8686
"No not yet, would you recommend watching it?",
8787
"Yes it was great, I'd really recommend watching it!",
88-
"Yes it wasn't that good, wouldn't really recommend watching it",
88+
"Yes. It wasn't that good, wouldn't really recommend watching it",
8989
]
9090
}
9191
9292
-----
9393
user:
94-
just going to the bar, want anything?
95-
96-
system:
97-
generate a list of 3 to 5 short generic sentences the user may want to say
98-
99-
assistant:
100-
{
101-
"suggestions": [
102-
"No I really am okay thanks",
103-
"Oh go on then, a beer would be great thanks",
104-
"Well, maybe a glass of water?"
105-
]
106-
}
107-
-----
108-
user:
109-
just going to the bar, want anything?
94+
did you have a good day at work?
11095
11196
system:
112-
generate a list of 3 to 5 short generic sentences the user may want to say
97+
Given the conversation history, generate a short list of key words or very short phrases the assistant can
98+
select from to build a new sentence
11399
114100
assistant:
115101
{
116102
"suggestions": [
117-
"maybe",
118-
"okay",
119-
"fine",
120-
"yes",
121-
"no",
122-
"thanks",
123-
"you",
124-
"maybe",
103+
"not",
104+
"good",
105+
"bad",
106+
"stressful",
107+
"fun",
108+
"boring",
109+
"tired",
110+
"weekend",
111+
"boss",
112+
"colleagues",
113+
"office",
114+
"hate",
125115
"love",
126-
"like",
127-
"water",
128-
"beer",
129-
"wine",
130-
"snacks",
131-
"crisps",
132-
"please",
116+
"deadline",
117+
"meeting",
118+
"pressure",
119+
"day off",
133120
]
134121
}
135122
`

0 commit comments

Comments
 (0)