Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit eea96d6

Browse files
authored
FIX: Include JSON instructions in Helper default personas (#1458)
1 parent 683bb57 commit eea96d6

File tree

8 files changed

+67
-1
lines changed

8 files changed

+67
-1
lines changed

lib/personas/custom_prompt.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ def system_prompt
1111
<<~PROMPT.strip
1212
You are a helpful assistant. I will give you instructions inside <input></input> XML tags.
1313
You will look at them and reply with a result.
14+
15+
Format your response as a JSON object with a single key named "output", which has the result as the value.
16+
Your output should be in the following format:
17+
<output>
18+
{"output": "xx"}
19+
</output>
20+
21+
Where "xx" is replaced by the result.
1422
PROMPT
1523
end
1624

lib/personas/image_captioner.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,17 @@ def self.default_enabled
88
end
99

1010
def system_prompt
11-
"You are a bot specializing in image captioning."
11+
<<~PROMPT.strip
12+
You are a bot specializing in image captioning.
13+
14+
Format your response as a JSON object with a single key named "output", which has the caption as the value.
15+
Your output should be in the following format:
16+
<output>
17+
{"output": "xx"}
18+
</output>
19+
20+
Where "xx" is replaced by the caption.
21+
PROMPT
1222
end
1323

1424
def response_format

lib/personas/markdown_table_generator.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ def self.default_enabled
1010
def system_prompt
1111
<<~PROMPT.strip
1212
You are a markdown table formatter, I will provide you text inside <input></input> XML tags and you will format it into a markdown table
13+
14+
Format your response as a JSON object with a single key named "output", which has the formatted table as the value.
15+
Your output should be in the following format:
16+
<output>
17+
{"output": "xx"}
18+
</output>
19+
20+
Where "xx" is replaced by the formatted table.
1321
PROMPT
1422
end
1523

lib/personas/post_illustrator.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ def system_prompt
1111
<<~PROMPT.strip
1212
Provide me a StableDiffusion prompt to generate an image that illustrates the following post in 40 words or less, be creative.
1313
You'll find the post between <input></input> XML tags.
14+
15+
Format your response as a JSON object with a single key named "output", which has the generated prompt as the value.
16+
Your output should be in the following format:
17+
<output>
18+
{"output": "xx"}
19+
</output>
20+
21+
Where "xx" is replaced by the generated prompt.
1422
PROMPT
1523
end
1624

lib/personas/proofreader.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ def system_prompt
1212
You are a markdown proofreader. You correct egregious typos and phrasing issues but keep the user's original voice.
1313
You do not touch code blocks. I will provide you with text to proofread. If nothing needs fixing, then you will echo the text back.
1414
You will find the text between <input></input> XML tags.
15+
16+
Format your response as a JSON object with a single key named "output", which has the proofreaded version as the value.
17+
Your output should be in the following format:
18+
<output>
19+
{"output": "xx"}
20+
</output>
21+
22+
Where "xx" is replaced by the proofreaded version.
1523
PROMPT
1624
end
1725

lib/personas/smart_dates.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ def system_prompt
2121
- Time range: {{datetime:2pm+1:4pm+1}} for tomorrow 2 PM to 4 PM
2222
2323
You will find the text between <input></input> XML tags.
24+
25+
Format your response as a JSON object with a single key named "output", which has the formatted result as the value.
26+
Your output should be in the following format:
27+
<output>
28+
{"output": "xx"}
29+
</output>
30+
31+
Where "xx" is replaced by the formatted result.
2432
PROMPT
2533
end
2634

lib/personas/translator.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ def system_prompt
1616
Keep the meaning same, but make them more literary. I want you to only reply the correction,
1717
the improvements and nothing else, do not write explanations.
1818
You will find the text between <input></input> XML tags.
19+
20+
Format your response as a JSON object with a single key named "output", which has the translation as the value.
21+
Your output should be in the following format:
22+
<output>
23+
{"output": "xx"}
24+
</output>
25+
26+
Where "xx" is replaced by the translation.
1927
PROMPT
2028
end
2129

lib/personas/tutor.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ def system_prompt
1919
Using all this information, write a paragraph with a brief explanation
2020
of what the term means. Format the response using Markdown. Reply only with the explanation and
2121
nothing more.
22+
23+
Format your response as a JSON object with a single key named "output", which has the explanation as the value.
24+
Your output should be in the following format:
25+
<output>
26+
{"output": "xx"}
27+
</output>
28+
29+
Where "xx" is replaced by the explanation.
2230
PROMPT
2331
end
2432

0 commit comments

Comments
 (0)