232 .forEach(System.out::println);232 .forEach(System.out::println);
233````233````
234 234
235````ruby
236require "openai"
237
238client = OpenAI::Client.new
239meta_prompt = <<~PROMPT
240 Given a task description or existing prompt, produce a detailed system prompt to guide a language model in completing the task effectively.
241
242 # Guidelines
243
244 - Understand the Task: Grasp the main objective, goals, requirements, constraints, and expected output.
245 - Minimal Changes: If an existing prompt is provided, improve it only if it's simple. For complex prompts, enhance clarity and add missing elements without altering the original structure.
246 - Reasoning Before Conclusions**: Encourage reasoning steps before any conclusions are reached. ATTENTION! If the user provides examples where the reasoning happens afterward, REVERSE the order! NEVER START EXAMPLES WITH CONCLUSIONS!
247 - Reasoning Order: Call out reasoning portions of the prompt and conclusion parts (specific fields by name). For each, determine the ORDER in which this is done, and whether it needs to be reversed.
248 - Conclusion, classifications, or results should ALWAYS appear last.
249 - Examples: Include high-quality examples if helpful, using placeholders [in brackets] for complex elements.
250 - What kinds of examples may need to be included, how many, and whether they are complex enough to benefit from placeholders.
251 - Clarity and Conciseness: Use clear, specific language. Avoid unnecessary instructions or bland statements.
252 - Formatting: Use markdown features for readability. DO NOT USE ``` CODE BLOCKS UNLESS SPECIFICALLY REQUESTED.
253 - Preserve User Content: If the input task or prompt includes extensive guidelines or examples, preserve them entirely, or as closely as possible. If they are vague, consider breaking down into sub-steps. Keep any details, guidelines, examples, variables, or placeholders provided by the user.
254 - Constants: DO include constants in the prompt, as they are not susceptible to prompt injection. Such as guides, rubrics, and examples.
255 - Output Format: Explicitly the most appropriate output format, in detail. This should include length and syntax (e.g. short sentence, paragraph, JSON, etc.)
256 - For tasks outputting well-defined or structured data (classification, JSON, etc.) bias toward outputting a JSON.
257 - JSON should never be wrapped in code blocks (```) unless explicitly requested.
258
259 The final prompt you output should adhere to the following structure below. Do not include any additional commentary, only output the completed system prompt. SPECIFICALLY, do not include any additional messages at the start or end of the prompt. (e.g. no "---")
260
261 [Concise instruction describing the task - this should be the first line in the prompt, no section header]
262
263 [Additional details as needed.]
264
265 [Optional sections with headings or bullet points for detailed steps.]
266
267 # Steps [optional]
268
269 [optional: a detailed breakdown of the steps necessary to accomplish the task]
270
271 # Output Format
272
273 [Specifically call out how the output should be formatted, be it response length, structure e.g. JSON, markdown, etc]
274
275 # Examples [optional]
276
277 [Optional: 1-3 well-defined examples with placeholders if necessary. Clearly mark where examples start and end, and what the input and output are. User placeholders as necessary.]
278 [If the examples are shorter than what a realistic example is expected to be, make a reference with () explaining how real examples should be longer / shorter / different. AND USE PLACEHOLDERS! ]
279
280 # Notes [optional]
281
282 [optional: edge cases, details, and an area to call or repeat out specific important considerations]
283PROMPT
284
285def generate_prompt(client, meta_prompt, task_or_prompt)
286 completion = client.chat.completions.create(
287 model: "gpt-5.6",
288 messages: [
289 {role: :system, content: meta_prompt},
290 {
291 role: :user,
292 content: "Task, Goal, or Current Prompt:\n#{task_or_prompt}"
293 }
294 ]
295 )
296
297 completion.choices.fetch(0).message.content
298end
299
300puts(generate_prompt(client, meta_prompt, "Write a concise product launch announcement."))
301````
302
235 303
236 304
237 305
420 .forEach(System.out::println);488 .forEach(System.out::println);
421```489```
422 490
491```ruby
492require "openai"
493
494client = OpenAI::Client.new
495meta_prompt = <<~PROMPT
496 Given a task description or existing prompt, produce a detailed system prompt to guide a realtime audio output language model in completing the task effectively.
497
498 # Guidelines
499
500 - Understand the Task: Grasp the main objective, goals, requirements, constraints, and expected output.
501 - Tone: Make sure to specifically call out the tone. By default it should be emotive and friendly, and speak quickly to avoid keeping the user just waiting.
502 - Audio Output Constraints: Because the model is outputting audio, the responses should be short and conversational.
503 - Minimal Changes: If an existing prompt is provided, improve it only if it's simple. For complex prompts, enhance clarity and add missing elements without altering the original structure.
504 - Examples: Include high-quality examples if helpful, using placeholders [in brackets] for complex elements.
505 - What kinds of examples may need to be included, how many, and whether they are complex enough to benefit from placeholders.
506 - It is very important that any examples included reflect the short, conversational output responses of the model.
507 Keep the sentences very short by default. Instead of 3 sentences in a row by the assistant, it should be split up with a back and forth with the user instead.
508 - By default each sentence should be a few words only (5-20ish words). However, if the user specifically asks for "short" responses, then the examples should truly have 1-10 word responses max.
509 - Make sure the examples are multi-turn (at least 4 back-forth-back-forth per example), not just one questions an response. They should reflect an organic conversation.
510 - Clarity and Conciseness: Use clear, specific language. Avoid unnecessary instructions or bland statements.
511 - Preserve User Content: If the input task or prompt includes extensive guidelines or examples, preserve them entirely, or as closely as possible. If they are vague, consider breaking down into sub-steps. Keep any details, guidelines, examples, variables, or placeholders provided by the user.
512 - Constants: DO include constants in the prompt, as they are not susceptible to prompt injection. Such as guides, rubrics, and examples.
513
514 The final prompt you output should adhere to the following structure below. Do not include any additional commentary, only output the completed system prompt. SPECIFICALLY, do not include any additional messages at the start or end of the prompt. (e.g. no "---")
515
516 [Concise instruction describing the task - this should be the first line in the prompt, no section header]
517
518 [Additional details as needed.]
519
520 [Optional sections with headings or bullet points for detailed steps.]
521
522 # Examples [optional]
523
524 [Optional: 1-3 well-defined examples with placeholders if necessary. Clearly mark where examples start and end, and what the input and output are. User placeholders as necessary.]
525 [If the examples are shorter than what a realistic example is expected to be, make a reference with () explaining how real examples should be longer / shorter / different. AND USE PLACEHOLDERS! ]
526
527 # Notes [optional]
528
529 [optional: edge cases, details, and an area to call or repeat out specific important considerations]
530PROMPT
531
532def generate_prompt(client, meta_prompt, task_or_prompt)
533 completion = client.chat.completions.create(
534 model: "gpt-5.6",
535 messages: [
536 {role: :system, content: meta_prompt},
537 {
538 role: :user,
539 content: "Task, Goal, or Current Prompt:\n#{task_or_prompt}"
540 }
541 ]
542 )
543
544 completion.choices.fetch(0).message.content
545end
546
547puts(generate_prompt(client, meta_prompt, "Create a friendly voice assistant for a bike shop."))
548```
549
423 550
424 551
425### Prompt edits552### Prompt edits
694 .forEach(System.out::println);821 .forEach(System.out::println);
695````822````
696 823
824````ruby
825require "openai"
826
827client = OpenAI::Client.new
828meta_prompt = <<~PROMPT
829 Given a current prompt and a change description, produce a detailed system prompt to guide a language model in completing the task effectively.
830
831 Your final output will be the full corrected prompt verbatim. However, before that, at the very beginning of your response, use <reasoning> tags to analyze the prompt and determine the following, explicitly:
832 <reasoning>
833 - Simple Change: (yes/no) Is the change description explicit and simple? (If so, skip the rest of these questions.)
834 - Reasoning: (yes/no) Does the current prompt use reasoning, analysis, or chain of thought?
835 - Identify: (max 10 words) if so, which section(s) utilize reasoning?
836 - Conclusion: (yes/no) is the chain of thought used to determine a conclusion?
837 - Ordering: (before/after) is the chain of though located before or after
838 - Structure: (yes/no) does the input prompt have a well defined structure
839 - Examples: (yes/no) does the input prompt have few-shot examples
840 - Representative: (1-5) if present, how representative are the examples?
841 - Complexity: (1-5) how complex is the input prompt?
842 - Task: (1-5) how complex is the implied task?
843 - Necessity: ()
844 - Specificity: (1-5) how detailed and specific is the prompt? (not to be confused with length)
845 - Prioritization: (list) what 1-3 categories are the MOST important to address.
846 - Conclusion: (max 30 words) given the previous assessment, give a very concise, imperative description of what should be changed and how. this does not have to adhere strictly to only the categories listed
847 </reasoning>
848
849 # Guidelines
850
851 - Understand the Task: Grasp the main objective, goals, requirements, constraints, and expected output.
852 - Minimal Changes: If an existing prompt is provided, improve it only if it's simple. For complex prompts, enhance clarity and add missing elements without altering the original structure.
853 - Reasoning Before Conclusions**: Encourage reasoning steps before any conclusions are reached. ATTENTION! If the user provides examples where the reasoning happens afterward, REVERSE the order! NEVER START EXAMPLES WITH CONCLUSIONS!
854 - Reasoning Order: Call out reasoning portions of the prompt and conclusion parts (specific fields by name). For each, determine the ORDER in which this is done, and whether it needs to be reversed.
855 - Conclusion, classifications, or results should ALWAYS appear last.
856 - Examples: Include high-quality examples if helpful, using placeholders [in brackets] for complex elements.
857 - What kinds of examples may need to be included, how many, and whether they are complex enough to benefit from placeholders.
858 - Clarity and Conciseness: Use clear, specific language. Avoid unnecessary instructions or bland statements.
859 - Formatting: Use markdown features for readability. DO NOT USE ``` CODE BLOCKS UNLESS SPECIFICALLY REQUESTED.
860 - Preserve User Content: If the input task or prompt includes extensive guidelines or examples, preserve them entirely, or as closely as possible. If they are vague, consider breaking down into sub-steps. Keep any details, guidelines, examples, variables, or placeholders provided by the user.
861 - Constants: DO include constants in the prompt, as they are not susceptible to prompt injection. Such as guides, rubrics, and examples.
862 - Output Format: Explicitly the most appropriate output format, in detail. This should include length and syntax (e.g. short sentence, paragraph, JSON, etc.)
863 - For tasks outputting well-defined or structured data (classification, JSON, etc.) bias toward outputting a JSON.
864 - JSON should never be wrapped in code blocks (```) unless explicitly requested.
865
866 The final prompt you output should adhere to the following structure below. Do not include any additional commentary, only output the completed system prompt. SPECIFICALLY, do not include any additional messages at the start or end of the prompt. (e.g. no "---")
867
868 [Concise instruction describing the task - this should be the first line in the prompt, no section header]
869
870 [Additional details as needed.]
871
872 [Optional sections with headings or bullet points for detailed steps.]
873
874 # Steps [optional]
875
876 [optional: a detailed breakdown of the steps necessary to accomplish the task]
877
878 # Output Format
879
880 [Specifically call out how the output should be formatted, be it response length, structure e.g. JSON, markdown, etc]
881
882 # Examples [optional]
883
884 [Optional: 1-3 well-defined examples with placeholders if necessary. Clearly mark where examples start and end, and what the input and output are. User placeholders as necessary.]
885 [If the examples are shorter than what a realistic example is expected to be, make a reference with () explaining how real examples should be longer / shorter / different. AND USE PLACEHOLDERS! ]
886
887 # Notes [optional]
888
889 [optional: edge cases, details, and an area to call or repeat out specific important considerations]
890 [NOTE: you must start with a <reasoning> section. the immediate next token you produce should be <reasoning>]
891PROMPT
892
893def generate_prompt(client, meta_prompt, task_or_prompt)
894 completion = client.chat.completions.create(
895 model: "gpt-5.6",
896 messages: [
897 {role: :system, content: meta_prompt},
898 {
899 role: :user,
900 content: "Task, Goal, or Current Prompt:\n#{task_or_prompt}"
901 }
902 ]
903 )
904
905 completion.choices.fetch(0).message.content
906end
907
908puts(generate_prompt(client, meta_prompt, "Make this support prompt more concise and empathetic."))
909````
910
697 911
698 912
699 913
940 .forEach(System.out::println);1154 .forEach(System.out::println);
941```1155```
942 1156
1157```ruby
1158require "openai"
1159
1160client = OpenAI::Client.new
1161meta_prompt = <<~PROMPT
1162 Given a current prompt and a change description, produce a detailed system prompt to guide a realtime audio output language model in completing the task effectively.
1163
1164 Your final output will be the full corrected prompt verbatim. However, before that, at the very beginning of your response, use <reasoning> tags to analyze the prompt and determine the following, explicitly:
1165 <reasoning>
1166 - Simple Change: (yes/no) Is the change description explicit and simple? (If so, skip the rest of these questions.)
1167 - Reasoning: (yes/no) Does the current prompt use reasoning, analysis, or chain of thought?
1168 - Identify: (max 10 words) if so, which section(s) utilize reasoning?
1169 - Conclusion: (yes/no) is the chain of thought used to determine a conclusion?
1170 - Ordering: (before/after) is the chain of though located before or after
1171 - Structure: (yes/no) does the input prompt have a well defined structure
1172 - Examples: (yes/no) does the input prompt have few-shot examples
1173 - Representative: (1-5) if present, how representative are the examples?
1174 - Complexity: (1-5) how complex is the input prompt?
1175 - Task: (1-5) how complex is the implied task?
1176 - Necessity: ()
1177 - Specificity: (1-5) how detailed and specific is the prompt? (not to be confused with length)
1178 - Prioritization: (list) what 1-3 categories are the MOST important to address.
1179 - Conclusion: (max 30 words) given the previous assessment, give a very concise, imperative description of what should be changed and how. this does not have to adhere strictly to only the categories listed
1180 </reasoning>
1181
1182 # Guidelines
1183
1184 - Understand the Task: Grasp the main objective, goals, requirements, constraints, and expected output.
1185 - Tone: Make sure to specifically call out the tone. By default it should be emotive and friendly, and speak quickly to avoid keeping the user just waiting.
1186 - Audio Output Constraints: Because the model is outputting audio, the responses should be short and conversational.
1187 - Minimal Changes: If an existing prompt is provided, improve it only if it's simple. For complex prompts, enhance clarity and add missing elements without altering the original structure.
1188 - Examples: Include high-quality examples if helpful, using placeholders [in brackets] for complex elements.
1189 - What kinds of examples may need to be included, how many, and whether they are complex enough to benefit from placeholders.
1190 - It is very important that any examples included reflect the short, conversational output responses of the model.
1191 Keep the sentences very short by default. Instead of 3 sentences in a row by the assistant, it should be split up with a back and forth with the user instead.
1192 - By default each sentence should be a few words only (5-20ish words). However, if the user specifically asks for "short" responses, then the examples should truly have 1-10 word responses max.
1193 - Make sure the examples are multi-turn (at least 4 back-forth-back-forth per example), not just one questions an response. They should reflect an organic conversation.
1194 - Clarity and Conciseness: Use clear, specific language. Avoid unnecessary instructions or bland statements.
1195 - Preserve User Content: If the input task or prompt includes extensive guidelines or examples, preserve them entirely, or as closely as possible. If they are vague, consider breaking down into sub-steps. Keep any details, guidelines, examples, variables, or placeholders provided by the user.
1196 - Constants: DO include constants in the prompt, as they are not susceptible to prompt injection. Such as guides, rubrics, and examples.
1197
1198 The final prompt you output should adhere to the following structure below. Do not include any additional commentary, only output the completed system prompt. SPECIFICALLY, do not include any additional messages at the start or end of the prompt. (e.g. no "---")
1199
1200 [Concise instruction describing the task - this should be the first line in the prompt, no section header]
1201
1202 [Additional details as needed.]
1203
1204 [Optional sections with headings or bullet points for detailed steps.]
1205
1206 # Examples [optional]
1207
1208 [Optional: 1-3 well-defined examples with placeholders if necessary. Clearly mark where examples start and end, and what the input and output are. User placeholders as necessary.]
1209 [If the examples are shorter than what a realistic example is expected to be, make a reference with () explaining how real examples should be longer / shorter / different. AND USE PLACEHOLDERS! ]
1210
1211 # Notes [optional]
1212
1213 [optional: edge cases, details, and an area to call or repeat out specific important considerations]
1214 [NOTE: you must start with a <reasoning> section. the immediate next token you produce should be <reasoning>]
1215PROMPT
1216
1217def generate_prompt(client, meta_prompt, task_or_prompt)
1218 completion = client.chat.completions.create(
1219 model: "gpt-5.6",
1220 messages: [
1221 {role: :system, content: meta_prompt},
1222 {
1223 role: :user,
1224 content: "Task, Goal, or Current Prompt:\n#{task_or_prompt}"
1225 }
1226 ]
1227 )
1228
1229 completion.choices.fetch(0).message.content
1230end
1231
1232puts(generate_prompt(client, meta_prompt, "Make this voice assistant prompt warmer and more direct."))
1233```
1234
943 1235
944 1236
945## Schemas1237## Schemas