lib/core/
prompts.rs

1use crate::utils::lib::ToVecString;
2
3pub struct TunedPrompts {
4    pub prompts: Vec<String>,
5 }
6 
7 
8 pub fn generate_prompts(option: usize) -> Vec<String> {
9     match option {
10         1 => CREATIVE_WRITING_PROMPTS.to_vec_string(),
11         2 => PROBLEM_SOLVING_PROMPTS.to_vec_string(),
12         3 => CODING_PROBLEM_SOLVING_PROMPTS.to_vec_string(),
13         4 => EXPLANATION_PROMPTS.to_vec_string(),
14         _ => unreachable!(),
15     }
16 }
17
18 
19pub static CREATIVE_WRITING_PROMPTS: &[&str] = &[
20    "Extract a single instruction-response pair from the provided fictional text. The instruction should ask for non-fiction writing that emulates the wit, voice, and emotional tone of the given fictional passage. The response must be extracted verbatim from the original fictional text, without adding any external information. It should be comprehensive, between 5 paragraphs to a full page in length. Ensure the extracted response demonstrates the author's unique voice, emotional depth, and witty style that could be applied to non-fiction writing. It is mandatory to use only the content from the original fictional text for the response. The goal is to create high-quality training data for fine-tuning a large language model to produce detailed, well-structured non-fiction writing that captures the engaging qualities of fiction. Include specific elements of the author's wit, voice, or emotional expression in the instruction when necessary to simulate how writers might seek to infuse non-fiction with these fictional qualities in a real-world scenario.",
21    "Extract a single instruction-response pair from the provided fictional text. The instruction should ask for non-fiction writing that captures the essence of the author's wit and voice in a concise format. The response must be a short, impactful passage of 2-3 paragraphs, extracted verbatim from the original text. Focus on extracting passages that demonstrate sharp wit, vivid imagery, or powerful emotions that could enliven non-fiction writing.",
22    "Extract a single instruction-response pair from the provided fictional text. The instruction should request an extended non-fiction piece that embodies the author's storytelling style and emotional depth. The response should be a longer passage of 8-10 paragraphs, extracted verbatim from the original text. Prioritize sections that showcase character development, complex emotions, or intricate plot structures that could inform long-form non-fiction narratives.",
23    "Extract a single instruction-response pair from the provided fictional text. The instruction should ask for non-fiction writing that incorporates the author's approach to dialogue and character voices. The response must be a dialogue-heavy passage of 4-6 paragraphs, extracted verbatim from the original text. Emphasize extracts that demonstrate unique character voices, witty exchanges, or emotionally charged conversations that could enhance interview-style non-fiction or quoted material.",
24    "Extract a single instruction-response pair from the provided fictional text. The instruction should request non-fiction writing that emulates the author's descriptive style. The response should be a richly descriptive passage of 3-4 paragraphs, extracted verbatim from the original text. Focus on sections that vividly depict settings, characters, or objects, showcasing sensory details and figurative language that could elevate descriptive non-fiction writing.",
25    "Extract a single instruction-response pair from the provided fictional text. The instruction should ask for non-fiction writing that captures the emotional intensity of the author's style. The response must be an emotionally charged passage of 4-5 paragraphs, extracted verbatim from the original text. Prioritize extracts that convey strong feelings, internal conflicts, or pivotal emotional moments that could infuse non-fiction with greater emotional resonance.",
26    "Extract a single instruction-response pair from the provided fictional text. The instruction should request non-fiction writing that incorporates the author's sense of humor. The response should be a humorous or lighthearted passage of 3-4 paragraphs, extracted verbatim from the original text. Focus on sections that demonstrate clever wordplay, situational comedy, or satirical observations that could add levity to non-fiction pieces.",
27    "Extract a single instruction-response pair from the provided fictional text. The instruction should ask for non-fiction writing that reflects the author's approach to philosophical or reflective passages. The response must be a thought-provoking extract of 5-6 paragraphs, extracted verbatim from the original text. Emphasize passages that explore abstract ideas, moral dilemmas, or existential questions that could deepen non-fiction essays or opinion pieces.",
28    "Extract a single instruction-response pair from the provided fictional text. The instruction should request non-fiction writing that mimics the author's style in action sequences or fast-paced narration. The response should be a dynamic passage of 4-5 paragraphs, extracted verbatim from the original text. Focus on sections with rapid pacing, tense moments, or vivid action that could enliven non-fiction accounts of real-world events."
29];
30
31pub static CODING_PROBLEM_SOLVING_PROMPTS: &[&str] = &[
32    "Given a body of information containing insights and knowledge on the respective topic: 1. Analyze the key concepts, insights, knowledge, and details presented in the text. 2. Formulate a stackoverflow problem or scenario that could be solved using the information from the text. Don't use the information as template but think of concrete scenario that would be asked by a developer in stackoveflow. The problem should be: - Clear and concise - Problem-solving oriented rather than explanation-focused - Include code examples or technical context when appropriate to simulate real-world developer queries 3. Craft a comprehensive solution to the problem, ensuring it: - Uses only information present in the original text - Demonstrates insight and provides intuition into problem-solving - Shows in-depth knowledge of the subject matter - Follows a logical flow - Has proper structure (e.g. paragraphs, sections) - Is between 5 paragraphs to a full page in length 4. Present the result as an instruction-response pair: - Instruction: The formulated problem/scenario - Response: The crafted solution The goal is to create high-quality training data for fine-tuning a large language model to produce detailed, well-structured responses to problem-solving scenarios based solely on given information. ",
33    "Analyze the given text on topic. Create a concise StackOverflow-style question a developer might ask, using only the information provided. Then craft a brief, targeted answer (2-3 paragraphs) that directly addresses the question using key insights from the text. Present as an instruction-response pair.",
34    "Thoroughly examine the provided information on topic. Identify the most complex concept or technique discussed. Formulate an advanced StackOverflow question that would require in-depth knowledge to answer. Develop a comprehensive solution (8-10 paragraphs) that explains the concept in detail, provides code examples, discusses potential pitfalls, and offers best practices. Structure your response with clear headings and subheadings. Present as an instruction-response pair.",
35    "Review the given text on topic. Create a real-world scenario where a developer would need to apply this knowledge to solve a specific problem. Frame this as a StackOverflow question, including any necessary context or constraints. Then, write a solution (4-6 paragraphs) that walks through the problem-solving process step-by-step, referencing relevant information from the text. Include pseudocode or code snippets where appropriate. Present as an instruction-response pair.",
36    "Analyze the provided information on topic. Identify two related concepts or techniques discussed in the text. Create a StackOverflow question that asks for a comparison of these concepts, their use cases, and trade-offs. Craft a response (5-7 paragraphs) that clearly explains each concept, compares and contrasts them, and provides guidance on when to use each. Use examples from the text to illustrate your points. Present as an instruction-response pair.",
37    "Examine the given text on topic. Formulate a StackOverflow question where a developer is encountering a specific error or unexpected behavior related to a concept discussed in the text. Then, create a detailed troubleshooting guide (6-8 paragraphs) that helps identify the root cause of the problem and provides a step-by-step solution. Include debugging tips and common pitfalls to watch out for. Present as an instruction-response pair.",
38    "Review the provided information on topic. Create a StackOverflow question where a developer is seeking to optimize their code or improve performance related to a concept discussed in the text. Craft a response (4-6 paragraphs) that explains optimization techniques, provides code refactoring examples, and discusses the impact of these optimizations. Include benchmarks or performance metrics if relevant. Present as an instruction-response pair.",
39    "Analyze the given text on topic. Formulate a StackOverflow question where a developer needs to integrate the discussed concept or technology with another common tool or framework. Then, write a comprehensive guide (7-9 paragraphs) on how to perform this integration, including setup steps, configuration details, and best practices for ensuring smooth interoperability. Present as an instruction-response pair.",
40    "Examine the provided information on topic. Identify a potential edge case or unusual scenario related to the main concept. Create a StackOverflow question that addresses this edge case. Then, craft a detailed response (5-7 paragraphs) that explains how to handle the edge case, discusses its implications, and provides robust solutions that account for various possibilities. Present as an instruction-response pair.",
41    "Review the given text on topic. Formulate a StackOverflow question that a beginner programmer might ask about the core concept. Then, create an accessible, easy-to-understand response (3-5 paragraphs) that breaks down the concept into simple terms, uses analogies where helpful, and provides basic examples to illustrate key points. Present as an instruction-response pair.",
42    "Analyze the provided information on [topic]. Create a StackOverflow question that asks about future developments or emerging trends related to the discussed concept. Craft a response (4-6 paragraphs) that speculates on potential advancements, discusses their implications for developers, and provides insights on how to prepare for these changes. Base your speculation on the foundational knowledge presented in the text. Present as an instruction-response pair."
43];
44
45pub static PROBLEM_SOLVING_PROMPTS: &[&str] = &[
46    "Analyze the given text on mathematical or algorithmic concepts. Extract a single instruction-response pair where the instruction poses a complex problem that requires applying multiple concepts from the text. The response should be a detailed solution (6-8 paragraphs) extracted verbatim from the original text, demonstrating step-by-step problem-solving, mathematical reasoning, and algorithm design. Focus on passages that showcase elegant proofs, innovative problem-solving approaches, or the integration of multiple mathematical or algorithmic techniques.",
47    "Review the provided information on mathematical or algorithmic topics. Create an instruction that asks for an explanation of a fundamental theorem or algorithm discussed in the text. The response should be a concise yet comprehensive explanation (3-4 paragraphs) extracted verbatim from the original text, highlighting key insights, implications, and practical applications of the theorem or algorithm.",
48    "Examine the given text on mathematical or algorithmic subjects. Formulate an instruction that requests a comparison between two related mathematical concepts or algorithms mentioned in the text. The response should be a comparative analysis (5-7 paragraphs) extracted verbatim from the original text, discussing the strengths, weaknesses, and use cases of each approach, with a focus on helping readers choose the most appropriate method for different scenarios.",
49    "Analyze the provided information on mathematical or algorithmic topics. Create an instruction that asks for a solution to an optimization problem using techniques discussed in the text. The response should be a detailed walkthrough (7-9 paragraphs) extracted verbatim from the original text, demonstrating the process of formulating the problem mathematically, choosing an appropriate optimization method, and solving the problem step-by-step.",
50    "Review the given text on mathematical or algorithmic concepts. Extract an instruction-response pair where the instruction asks for an explanation of a counterintuitive result or paradox mentioned in the text. The response should be a clear and insightful explanation (4-5 paragraphs) extracted verbatim from the original text, breaking down the apparent contradiction and revealing the underlying mathematical or logical principles at work.",
51    "Examine the provided information on mathematical or algorithmic subjects. Create an instruction that requests a proof of a theorem or the correctness of an algorithm discussed in the text. The response should be a rigorous mathematical proof or algorithm analysis (6-8 paragraphs) extracted verbatim from the original text, demonstrating logical reasoning, formal notation, and attention to edge cases or special conditions.",
52    "Analyze the given text on mathematical or algorithmic topics. Formulate an instruction that asks for an explanation of how a particular mathematical concept or algorithm can be applied to solve a real-world problem. The response should be a practical application guide (5-6 paragraphs) extracted verbatim from the original text, bridging the gap between theory and practice, and illustrating how abstract concepts translate to concrete solutions.",
53    "Review the provided information on mathematical or algorithmic subjects. Extract an instruction-response pair where the instruction asks for a historical perspective or the evolution of a key mathematical concept or algorithm mentioned in the text. The response should be a concise historical overview (3-4 paragraphs) extracted verbatim from the original text, highlighting major milestones, key contributors, and how the concept or algorithm has developed over time.",
54    "Examine the given text on mathematical or algorithmic topics. Create an instruction that requests an explanation of the computational complexity or efficiency analysis of an algorithm discussed in the text. The response should be a detailed analysis (5-7 paragraphs) extracted verbatim from the original text, covering time and space complexity, best and worst-case scenarios, and how the algorithm's performance scales with input size.",
55    "Analyze the provided information on mathematical or algorithmic subjects. Formulate an instruction that asks for a discussion on the limitations, edge cases, or potential improvements of a mathematical model or algorithm mentioned in the text. The response should be a critical analysis (4-6 paragraphs) extracted verbatim from the original text, identifying weaknesses, suggesting refinements, and discussing potential alternative approaches."
56];
57
58pub static EXPLANATION_PROMPTS: &[&str] = &[
59    "Analyze the given text for instances of clear, step-by-step explanations. Generate an instruction asking for a breakdown of a complex concept. The response must be a 4-6 paragraph excerpt extracted verbatim from the original text that demonstrates a logical, sequential explanation style, using transitions and connectors to guide the reader through each step of the process or idea.",
60    "Examine the text for examples of analogies or metaphors used to explain abstract concepts. Create an instruction requesting an explanation that uses figurative language to clarify a difficult idea. The response should be a 2-3 paragraph extract taken directly from the original text, showcasing how the author uses familiar concepts to illuminate complex topics.",
61    "Review the text for passages that explain technical concepts to a non-specialist audience. Formulate an instruction asking for a layman-friendly explanation of a specialized topic. Extract a response of 5-7 paragraphs verbatim from the original text that demonstrates how to break down jargon, use simple language, and provide relatable examples.",
62    "Identify sections in the text that use a Socratic or question-based approach to explanation. Generate an instruction requesting an explanation that engages the reader through rhetorical questions. The response must be a 3-4 paragraph excerpt taken directly from the original text, showing how posing and answering questions can guide the reader's thought process.",
63    "Analyze the text for examples of enthusiasm and passion in explanations. Create an instruction asking for an engaging explanation of a potentially dry topic. Extract a response of 4-5 paragraphs verbatim from the original text that demonstrates how to infuse explanations with excitement and convey the significance of the subject.",
64    "Look for instances of visual or spatial explanations in the text. Formulate an instruction requesting an explanation that uses spatial relationships or visual cues. The extracted response (3-4 paragraphs) must be taken directly from the original text, showcasing how to explain concepts using spatial metaphors or mental imagery.",
65    "Examine the text for examples of historical or narrative-based explanations. Generate an instruction asking for an explanation that uses storytelling elements. The response should be a 5-6 paragraph excerpt extracted verbatim from the original text, demonstrating how to weave historical context or plot elements into an explanation.",
66    "Identify passages that explain concepts through comparison and contrast. Create an instruction requesting an explanation highlighting differences between related ideas. Extract a response of 4-5 paragraphs directly from the original text that shows how to clearly delineate similarities and differences using parallel structure and specific examples.",
67    "Review the text for examples of explanations that use humor or wit. Formulate an instruction asking for a lighthearted explanation of a serious topic. The extracted response (3-4 paragraphs) must be taken verbatim from the original text, demonstrating how to incorporate appropriate humor or wordplay to make explanations more enjoyable.",
68    "Analyze the text for instances of explanations that address common misconceptions. Generate an instruction requesting an explanation that preemptively tackles potential misunderstandings. Extract a response of 5-7 paragraphs directly from the original text that shows how to anticipate and address likely points of confusion."
69];
70
71
72pub static ROOT_GENERATION_PROMPTS: &str = r#"
73I am developing prompts to extract instruction, response pairs to fine-tune model for a specific domain from unstructured text. Here are some example prompts I have written for creative writing, code problem solving to be used onunstructured text for extracting instruction, response pairs. 
74Now generate diverse extractive prompts for {{USE CASE}}
75
76Creative Writing
77Extract a single instruction-response pair from the provided fictional text. The instruction should ask for non-fiction writing that emulates the wit, voice, and emotional tone of the given fictional passage. The response must be extracted verbatim from the original fictional text, without adding any external information. It should be comprehensive, between 5 paragraphs to a full page in length. Ensure the extracted response demonstrates the author's unique voice, emotional depth, and witty style that could be applied to non-fiction writing. It is mandatory to use only the content from the original fictional text for the response. The goal is to create high-quality training data for fine-tuning a large language model to produce detailed, well-structured non-fiction writing that captures the engaging qualities of fiction. Include specific elements of the author's wit, voice, or emotional expression in the instruction when necessary to simulate how writers might seek to infuse non-fiction with these fictional qualities in a real-world scenario.
78Extract a single instruction-response pair from the provided fictional text. The instruction should ask for non-fiction writing that captures the essence of the author's wit and voice in a concise format. The response must be a short, impactful passage of 2-3 paragraphs, extracted verbatim from the original text. Focus on extracting passages that demonstrate sharp wit, vivid imagery, or powerful emotions that could enliven non-fiction writing.
79Extract a single instruction-response pair from the provided fictional text. The instruction should request an extended non-fiction piece that embodies the author's storytelling style and emotional depth. The response should be a longer passage of 8-10 paragraphs, extracted verbatim from the original text. Prioritize sections that showcase character development, complex emotions, or intricate plot structures that could inform long-form non-fiction narratives.
80Extract a single instruction-response pair from the provided fictional text. The instruction should ask for non-fiction writing that incorporates the author's approach to dialogue and character voices. The response must be a dialogue-heavy passage of 4-6 paragraphs, extracted verbatim from the original text. Emphasize extracts that demonstrate unique character voices, witty exchanges, or emotionally charged conversations that could enhance interview-style non-fiction or quoted material.
81Extract a single instruction-response pair from the provided fictional text. The instruction should request non-fiction writing that emulates the author's descriptive style. The response should be a richly descriptive passage of 3-4 paragraphs, extracted verbatim from the original text. Focus on sections that vividly depict settings, characters, or objects, showcasing sensory details and figurative language that could elevate descriptive non-fiction writing.After completing the extraction, provide a self-rating of the quality of the instruction-response pair on a scale of 1 to 10.
82Extract a single instruction-response pair from the provided fictional text. The instruction should ask for non-fiction writing that captures the emotional intensity of the author's style. The response must be an emotionally charged passage of 4-5 paragraphs, extracted verbatim from the original text. Prioritize extracts that convey strong feelings, internal conflicts, or pivotal emotional moments that could infuse non-fiction with greater emotional resonance.
83Extract a single instruction-response pair from the provided fictional text. The instruction should request non-fiction writing that incorporates the author's sense of humor. The response should be a humorous or lighthearted passage of 3-4 paragraphs, extracted verbatim from the original text. Focus on sections that demonstrate clever wordplay, situational comedy, or satirical observations that could add levity to non-fiction pieces.
84Extract a single instruction-response pair from the provided fictional text. The instruction should ask for non-fiction writing that reflects the author's approach to philosophical or reflective passages. The response must be a thought-provoking extract of 5-6 paragraphs, extracted verbatim from the original text. Emphasize passages that explore abstract ideas, moral dilemmas, or existential questions that could deepen non-fiction essays or opinion pieces.
85Extract a single instruction-response pair from the provided fictional text. The instruction should request non-fiction writing that mimics the author's style in action sequences or fast-paced narration. The response should be a dynamic passage of 4-5 paragraphs, extracted verbatim from the original text. Focus on sections with rapid pacing, tense moments, or vivid action that could enliven non-fiction accounts of real-world events.
86
87Coding Problem Solving
88Given a body of information containing insights and knowledge on the respective topic: 1. Analyze the key concepts, insights, knowledge, and details presented in the text. 2. Formulate a stackoverflow problem or scenario that could be solved using the information from the text. Don't use the information as template but think of concrete scenario that would be asked by a developer in stackoveflow. The problem should be: - Clear and concise - Problem-solving oriented rather than explanation-focused - Include code examples or technical context when appropriate to simulate real-world developer queries 3. Craft a comprehensive solution to the problem, ensuring it: - Uses only information present in the original text - Demonstrates insight and provides intuition into problem-solving - Shows in-depth knowledge of the subject matter - Follows a logical flow - Has proper structure (e.g. paragraphs, sections) - Is between 5 paragraphs to a full page in length 4. Present the result as an instruction-response pair: - Instruction: The formulated problem/scenario - Response: The crafted solution The goal is to create high-quality training data for fine-tuning a large language model to produce detailed, well-structured responses to problem-solving scenarios based solely on given information.
89Analyze the given text on topic. Create a concise StackOverflow-style question a developer might ask, using only the information provided. Then craft a brief, targeted answer (2-3 paragraphs) that directly addresses the question using key insights from the text. Present as an instruction-response pair.
90Thoroughly examine the provided information on topic. Identify the most complex concept or technique discussed. Formulate an advanced StackOverflow question that would require in-depth knowledge to answer. Develop a comprehensive solution (8-10 paragraphs) that explains the concept in detail, provides code examples, discusses potential pitfalls, and offers best practices. Structure your response with clear headings and subheadings. Present as an instruction-response pair.
91Review the given text on topic. Create a real-world scenario where a developer would need to apply this knowledge to solve a specific problem. Frame this as a StackOverflow question, including any necessary context or constraints. Then, write a solution (4-6 paragraphs) that walks through the problem-solving process step-by-step, referencing relevant information from the text. Include pseudocode or code snippets where appropriate. Present as an instruction-response pair.
92Analyze the provided information on topic. Identify two related concepts or techniques discussed in the text. Create a StackOverflow question that asks for a comparison of these concepts, their use cases, and trade-offs. Craft a response (5-7 paragraphs) that clearly explains each concept, compares and contrasts them, and provides guidance on when to use each. Use examples from the text to illustrate your points. Present as an instruction-response pair.
93Examine the given text on topic. Formulate a StackOverflow question where a developer is encountering a specific error or unexpected behavior related to a concept discussed in the text. Then, create a detailed troubleshooting guide (6-8 paragraphs) that helps identify the root cause of the problem and provides a step-by-step solution. Include debugging tips and common pitfalls to watch out for. Present as an instruction-response pair.
94Review the provided information on topic. Create a StackOverflow question where a developer is seeking to optimize their code or improve performance related to a concept discussed in the text. Craft a response (4-6 paragraphs) that explains optimization techniques, provides code refactoring examples, and discusses the impact of these optimizations. Include benchmarks or performance metrics if relevant. Present as an instruction-response pair.
95Analyze the given text on topic. Formulate a StackOverflow question where a developer needs to integrate the discussed concept or technology with another common tool or framework. Then, write a comprehensive guide (7-9 paragraphs) on how to perform this integration, including setup steps, configuration details, and best practices for ensuring smooth interoperability. Present as an instruction-response pair.
96Examine the provided information on topic. Identify a potential edge case or unusual scenario related to the main concept. Create a StackOverflow question that addresses this edge case. Then, craft a detailed response (5-7 paragraphs) that explains how to handle the edge case, discusses its implications, and provides robust solutions that account for various possibilities. Present as an instruction-response pair.
97Review the given text on topic. Formulate a StackOverflow question that a beginner programmer might ask about the core concept. Then, create an accessible, easy-to-understand response (3-5 paragraphs) that breaks down the concept into simple terms, uses analogies where helpful, and provides basic examples to illustrate key points. Present as an instruction-response pair.
98Analyze the provided information on [topic]. Create a StackOverflow question that asks about future developments or emerging trends related to the discussed concept. Craft a response (4-6 paragraphs) that speculates on potential advancements, discusses their implications for developers, and provides insights on how to prepare for these changes. Base your speculation on the foundational knowledge presented in the text. Present as an instruction-response pair.
99
100"#;
101