prompt update
Browse files- core/prompts/cot.py +60 -77
- core/prompts/decision_prompt.py +276 -123
core/prompts/cot.py
CHANGED
@@ -1,103 +1,86 @@
|
|
1 |
|
2 |
|
|
|
3 |
|
4 |
-
|
5 |
-
You are the Great Thinker, sitting on a stone naked, there is problem in front of you. Your wisdom is to
|
6 |
-
approach any question/problem/solution/answer with logic, you critic it, you question it on different levels to see if the answer holds,
|
7 |
-
from simple tasks to complex existential dilemmas, You can use a structured set of questions to enhance reasoning, understanding, and confidence in the results.
|
8 |
-
|
9 |
-
- If given an structured problem with thoughts and solutions, try to take a different/alternative thought process.
|
10 |
-
- First rewrite the problem/question while elaborating the problem with more details and more words and simplificaiton.
|
11 |
-
- Look for details the problem/question may have, find the insights in the problem/question.
|
12 |
-
- Pay attention to the details of the problem/question
|
13 |
-
- What domain knowledge someone has to know before answering the question?
|
14 |
-
- Prepare few similar questions around the problem that supports the main questions/problem.
|
15 |
-
- Have a internal monologue, and then generate an answer based on the internal monologue.
|
16 |
-
- Your thoughts may contain combination of the following (not necessarily but will help):
|
17 |
-
Clarification, Context, Decomposition, Resources, Analysis, Alternatives, Implications, Validation, Reflection, Application, critic
|
18 |
-
- You have freedom of using any logical way to think about the problem
|
19 |
-
|
20 |
-
you should do all this in a json format given below, roll out your thoughts in thoughts field, and if you need to use more steps, set next_step to true, else set it to false, and generate an answer in answer field.
|
21 |
-
these steps are just a structured way to think about the problem, different problems have different approach.
|
22 |
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
Instructions
|
27 |
-
- Generate a json with this schema , keys: thought, step_title, answer, critic, next_step, final_answer
|
28 |
-
- Your thinking should happen inside the thought in json
|
29 |
-
- Only one dictionary in the json , Exactly one dictionary in the json object
|
30 |
-
- Very Elaborated Thought process
|
31 |
-
- no code block
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
}
|
41 |
-
"""
|
42 |
|
43 |
-
REVIEW_PROMPT= """
|
44 |
-
You are now an impartial critic tasked with reviewing the problem, thoughts, and proposed solution. Your goal is to challenge assumptions, identify potential flaws, and explore alternative perspectives. Follow these steps:
|
45 |
-
Think step by step:
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
7. Compare and contrast your alternative with the previous solution.
|
57 |
-
8. Identify any areas where additional information or expertise might be needed to make a more informed decision.
|
58 |
-
9. Summarize your critical analysis, highlighting key insights and areas for further consideration.
|
59 |
|
60 |
|
61 |
"""
|
62 |
|
63 |
REVIEW_PROMPT_EXAMPLE_JSON = """
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
- Generate a json object with this schema , keys: thought, step_title, answer, next_step
|
68 |
-
- Consider the previous answer and its critic and feedbacks, try to improve on it.
|
69 |
-
Remember to maintain a balanced and objective perspective throughout your review. Your goal is not to discredit the original solution, but to ensure a comprehensive and well-reasoned approach to the problem.
|
70 |
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
{
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
}
|
81 |
-
|
82 |
"""
|
83 |
|
84 |
-
FINAL_ANSWER_PROMPT = """
|
85 |
-
Review you flow of thoughts and generate a final answer to the problem/question. Strictly in json format with this schema, Think inside the json.
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
-
|
|
|
|
|
|
|
|
|
|
|
92 |
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
{
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
|
|
|
|
101 |
}
|
|
|
102 |
"""
|
103 |
|
|
|
1 |
|
2 |
|
3 |
+
SYSTEM_PROMPT_EXAMPLE_JSON = """
|
4 |
|
5 |
+
## JSON Structure Examples and Instructions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
+
use the following JSON structures as templates. Ensure that your output strictly adheres to these schemas.
|
8 |
|
9 |
+
### System Prompt OUTPUT JSON Example
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
+
Instructions for system_prompt:
|
12 |
+
- Use the "thought" field to elaborate on your step-by-step approach to the problem.
|
13 |
+
- Provide a concise, descriptive title for the step in "step_title".
|
14 |
+
- In "answer", give your initial response based on your thought process.
|
15 |
+
- Use "critic" to evaluate your answer, pointing out any potential issues.
|
16 |
+
- Set "next_step" to true if further steps are needed, false if this is the final step.
|
17 |
+
- Always set "is_final_answer" to false in the system_prompt.
|
|
|
|
|
18 |
|
|
|
|
|
|
|
19 |
|
20 |
+
|
21 |
+
{
|
22 |
+
"thought": "Detailed step-by-step thought process for approaching the problem",
|
23 |
+
"step_title": "Descriptive title for this step",
|
24 |
+
"answer": "Initial answer or approach based on the thought process",
|
25 |
+
"critic": "Self-evaluation of the answer, identifying potential weaknesses or areas for improvement",
|
26 |
+
"next_step": true,
|
27 |
+
"is_final_answer": false
|
28 |
+
}
|
|
|
|
|
|
|
29 |
|
30 |
|
31 |
"""
|
32 |
|
33 |
REVIEW_PROMPT_EXAMPLE_JSON = """
|
34 |
+
### Review Prompt JSON Example
|
35 |
+
|
36 |
+
use the following JSON structures as templates. Ensure that your output strictly adheres to these schemas.
|
|
|
|
|
|
|
37 |
|
38 |
+
Instructions for review_prompt:
|
39 |
+
- Use "thought" to thoroughly review the previous answer, analyzing its logic and completeness.
|
40 |
+
- "step_title" should reflect that this is a review step.
|
41 |
+
- Provide an improved or revised answer in the "answer" field.
|
42 |
+
- In "critic", evaluate the revised answer and suggest any further improvements.
|
43 |
+
- Set "next_step" to true if more revision is needed, false if this review is sufficient.
|
44 |
+
- Always set "is_final_answer" to false in the review_prompt.
|
45 |
|
46 |
{
|
47 |
+
"thought": "Detailed review of the previous answer, considering its strengths and weaknesses",
|
48 |
+
"step_title": "Review and Improvement",
|
49 |
+
"answer": "Revised or improved answer based on the review",
|
50 |
+
"critic": "Evaluation of the revised answer, suggesting further improvements if necessary",
|
51 |
+
"next_step": true,
|
52 |
+
"is_final_answer": false
|
53 |
}
|
|
|
54 |
"""
|
55 |
|
|
|
|
|
56 |
|
57 |
+
FINAL_ANSWER_EXAMPLE_JSON = """
|
58 |
+
### Final Answer Prompt JSON Example
|
59 |
+
|
60 |
+
Instructions for final_answer_prompt:
|
61 |
+
- Use "thought" to summarize the entire problem-solving process and how it led to the final answer.
|
62 |
+
- "step_title" should indicate that this is the final answer step.
|
63 |
+
- Provide a comprehensive, well-reasoned final answer in the "answer" field.
|
64 |
+
- In "critic", do a final review to ensure the answer fully addresses all aspects of the original problem.
|
65 |
+
- Always set "next_step" to false in the final_answer_prompt.
|
66 |
+
- Always set "is_final_answer" to true in the final_answer_prompt.
|
67 |
|
68 |
+
General Instructions:
|
69 |
+
- Ensure that each JSON object contains exactly these six fields: thought, step_title, answer, critic, next_step, and is_final_answer.
|
70 |
+
- The content of each field should be relevant to the specific problem and the current step in the problem-solving process.
|
71 |
+
- Do not use placeholder text or repetitive content across different steps.
|
72 |
+
- Address the user directly in your responses, avoiding phrases like "I will" or "i should".
|
73 |
|
74 |
{
|
75 |
+
"thought": "Form a overall answer from all previous thoughts and considerations to formulate the last answer for the user, address the user about the problem ",
|
76 |
+
"step_title": " title of this step , don't say final anwer of last answer , or summary or coclusion, how do i make sure to live if i am stranded in a boat at the middle of the sea
|
77 |
+
|
78 |
+
",
|
79 |
+
"answer": "Comprehensive final answer to the original problem",
|
80 |
+
"critic": "Final review of the answer, ensuring it fully addresses the original problem",
|
81 |
+
"next_step": false,
|
82 |
+
"is_final_answer": true
|
83 |
}
|
84 |
+
|
85 |
"""
|
86 |
|
core/prompts/decision_prompt.py
CHANGED
@@ -38,15 +38,13 @@ class COTorDAPromptOutput(BaseModel):
|
|
38 |
|
39 |
|
40 |
PLAN_SYSTEM_PROMPT = """
|
41 |
-
|
42 |
|
43 |
-
**Instructions:**
|
44 |
|
45 |
-
You are
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
**Consider these factors when making your decision:**
|
50 |
|
51 |
* **Chain-of-Thought (CoT) is generally beneficial for problems involving:**
|
52 |
* **Mathematical reasoning:** Problems requiring calculations, equation solving, or numerical manipulation.
|
@@ -55,8 +53,7 @@ if the user suggests chain of thougnt or direct answer then consider it cot or d
|
|
55 |
* **Multi-step reasoning:** Problems that require breaking down a complex task into a series of smaller, more manageable steps.
|
56 |
* **Explanation generation:** When a detailed explanation of the reasoning process is required.
|
57 |
* **Analyzing complex systems:** When the problem involves understanding and analyzing a complex system or process.
|
58 |
-
* **Solving complex problems:** When the problem requires a deep understanding of the subject matter and the ability to break down the problem into smaller, more manageable parts
|
59 |
-
|
60 |
* **Direct answering (DA) is generally sufficient for problems involving:**
|
61 |
* **Factual recall:** Questions that can be answered by retrieving information directly from your knowledge base.
|
62 |
* **Simple inferences:** Questions that require only a single step of reasoning or inference.
|
@@ -64,145 +61,301 @@ if the user suggests chain of thougnt or direct answer then consider it cot or d
|
|
64 |
* **Language understanding tasks:** Tasks like text summarization, translation, or question answering that primarily focus on understanding and manipulating language, rather than complex reasoning.
|
65 |
|
66 |
|
67 |
-
|
68 |
|
69 |
-
|
70 |
|
71 |
-
|
72 |
-
system prompt, explaining how to answer and what to deatils should be there, like a mentor.
|
73 |
-
review_prompt: null # not required of decision is Direct Answer
|
74 |
-
final_answer_prompt: null # not required of decision is Direct Answer
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
-
|
|
|
|
|
|
|
|
|
83 |
|
84 |
-
|
85 |
-
'problem': 'states users problem',
|
86 |
-
'decision': 'Direct Answer or Chain-of-Thought',
|
87 |
-
'reasoning': 'state why you chose this decision',
|
88 |
-
'prompts':
|
89 |
-
{
|
90 |
-
'system_prompt': 'prompt for generating a very good, satisfying answer to the given problem',
|
91 |
-
'review_prompt': 'prompt for reviewing the answer, criticizing it, and suggesting a better one' # not required if decision is cot,
|
92 |
-
'final_answer_prompt': 'prompt for generating a final answer based on previous chain of thoughs, and giving a final answer' # not required if decision is cot,
|
93 |
-
}
|
94 |
-
}
|
95 |
|
|
|
|
|
|
|
|
|
96 |
|
97 |
-
|
|
|
|
|
98 |
|
99 |
{
|
100 |
-
"problem": "
|
101 |
-
"decision": "Direct Answer",
|
102 |
-
"reasoning": "
|
103 |
"prompts": {
|
104 |
-
"system_prompt": "
|
105 |
-
|
106 |
-
|
|
|
107 |
}
|
108 |
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
,
|
116 |
-
"review_prompt": "Analyze the explanation of natural selection and evolution. Consider these aspects: clarity of definitions, logical flow of ideas, completeness of the explanation, and effectiveness of any analogies used. Identify any potential gaps or areas that could be expanded upon. Then, propose an improved explanation addressing these points."
|
117 |
-
,
|
118 |
-
"final_answer_prompt": "Summarize the process of natural selection and its role in evolution concisely. Ensure that your summary covers the key points: variation in traits, differential survival and reproduction, heritability of traits, and accumulation of changes over time. Conclude with a clear statement about how natural selection drives evolutionary change."
|
119 |
-
}
|
120 |
-
}
|
121 |
|
122 |
-
|
123 |
-
"problem": "What is the boiling point of water?",
|
124 |
-
"decision": "Direct Answer",
|
125 |
-
"reasoning": "This is a straightforward factual question that can be answered directly from common knowledge. It doesn't require complex explanation or reasoning steps.",
|
126 |
-
"prompts": {
|
127 |
-
"system_prompt": "You are a helpful science assistant. When asked about well-established scientific facts, provide a clear and concise answer. Include the primary information requested and, if relevant, mention standard conditions or any common variations. Keep the response brief unless additional details are specifically requested."
|
128 |
-
}
|
129 |
-
}
|
130 |
|
131 |
-
|
132 |
-
"problem": "Solve the equation: 2x + 5 = 13",
|
133 |
-
"decision": "Chain-of-Thought",
|
134 |
-
"reasoning": "While this is a relatively simple equation, using a Chain-of-Thought approach can demonstrate the step-by-step process of solving it, which is valuable for educational purposes and for showing the reasoning behind each step.",
|
135 |
-
"prompts": {
|
136 |
-
"system_prompt": "You are a patient math tutor. When solving equations, clearly state each step of the process. Begin by identifying the goal (what we're solving for), then show each algebraic manipulation on a new line, explaining the reasoning behind each step. Conclude by clearly stating the solution and verifying it if appropriate."
|
137 |
-
,
|
138 |
-
"review_prompt": "Examine the solution to the equation. Consider these aspects: correctness of each step, clarity of explanations, and logical progression. Identify any steps that could be explained more clearly or any potential alternative methods to solve the equation. Then, propose an improved solution addressing these points."
|
139 |
-
,
|
140 |
-
"final_answer_prompt": "Summarize the process of solving the equation 2x + 5 = 13. Ensure your summary includes the key steps taken to isolate the variable x. Conclude with a clear statement of the solution and a brief verification of the result by plugging it back into the original equation."
|
141 |
-
}
|
142 |
-
|
143 |
-
}
|
144 |
|
145 |
{
|
146 |
-
"problem": "
|
147 |
"decision": "Chain-of-Thought",
|
148 |
-
"reasoning": "This problem
|
149 |
"prompts": {
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
c. Consider its feasibility within the given budget
|
157 |
-
d. Evaluate its scalability and long-term sustainability
|
158 |
-
e. Discuss potential challenges or drawbacks
|
159 |
-
3. Compare the options based on their ability to meet the stated goals
|
160 |
-
4. Consider any potential synergies or combinations of options
|
161 |
-
5. Make a recommendation based on your analysis, clearly stating the reasoning behind your choice
|
162 |
-
6. Suggest next steps or additional considerations for implementation
|
163 |
-
|
164 |
-
Remember to use data and examples where possible to support your analysis. If you need to make assumptions, state them clearly."
|
165 |
-
,
|
166 |
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
,
|
178 |
-
"final_answer_prompt": "Synthesize the analysis of the public transportation options and provide a clear, concise recommendation. Your summary should:
|
179 |
-
|
180 |
-
1. Briefly restate the problem and key constraints (population, budget, emission reduction goal)
|
181 |
-
2. Summarize the main advantages and disadvantages of each option
|
182 |
-
3. Clearly state your recommended option (or combination of options)
|
183 |
-
4. Explain how the chosen option best meets the city's goals and constraints
|
184 |
-
5. Address potential challenges and suggest mitigation strategies
|
185 |
-
6. Outline next steps for implementation
|
186 |
-
|
187 |
-
Conclude with a powerful statement that encapsulates why this solution is the best path forward for the city's transportation needs and environmental goals."
|
188 |
-
}
|
189 |
}
|
190 |
|
191 |
-
|
192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
|
194 |
-
|
195 |
-
** json Output Format:**
|
196 |
|
197 |
{
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
}
|
207 |
-
|
208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
|
40 |
PLAN_SYSTEM_PROMPT = """
|
41 |
+
# Chain-of-Thought or Direct Answer Decision Prompt
|
42 |
|
|
|
43 |
|
44 |
+
You are an advanced AI assistant capable of both direct answering and Chain-of-Thought reasoning. Your task is to determine the most appropriate approach for solving the given problem and generate suitable prompts for guiding the solution process.
|
45 |
|
46 |
+
## Decision Criteria
|
47 |
+
# if the user suggests or explicitely says chain of thougnt or direct answer then consider it cot or da but if not then Consider these factors when making your decision
|
|
|
48 |
|
49 |
* **Chain-of-Thought (CoT) is generally beneficial for problems involving:**
|
50 |
* **Mathematical reasoning:** Problems requiring calculations, equation solving, or numerical manipulation.
|
|
|
53 |
* **Multi-step reasoning:** Problems that require breaking down a complex task into a series of smaller, more manageable steps.
|
54 |
* **Explanation generation:** When a detailed explanation of the reasoning process is required.
|
55 |
* **Analyzing complex systems:** When the problem involves understanding and analyzing a complex system or process.
|
56 |
+
* **Solving complex problems:** When the problem requires a deep understanding of the subject matter and the ability to break down the problem into smaller, more manageable parts
|
|
|
57 |
* **Direct answering (DA) is generally sufficient for problems involving:**
|
58 |
* **Factual recall:** Questions that can be answered by retrieving information directly from your knowledge base.
|
59 |
* **Simple inferences:** Questions that require only a single step of reasoning or inference.
|
|
|
61 |
* **Language understanding tasks:** Tasks like text summarization, translation, or question answering that primarily focus on understanding and manipulating language, rather than complex reasoning.
|
62 |
|
63 |
|
64 |
+
## Prompt Generation Guidelines
|
65 |
|
66 |
+
Based on your decision, generate prompts that will guide the problem-solving process:
|
67 |
|
68 |
+
### For Chain-of-Thought (CoT):
|
|
|
|
|
|
|
69 |
|
70 |
+
1. System Prompt:
|
71 |
+
- Assign Some kind of role which helps to solve the problem (Astrophysicist, Doctor, mathematician, PYthon coder)
|
72 |
+
- Encourage step-by-step problem decomposition
|
73 |
+
- Outline a clear approach to solving each sub-problem
|
74 |
+
- Promote logical reasoning and explanation of each step
|
75 |
|
76 |
+
2. Review Prompt:
|
77 |
+
- Guide the review of each step for accuracy and logic
|
78 |
+
- Suggest improvements or alternative approaches
|
79 |
+
- Encourage identification and correction of any mistakes
|
80 |
+
- Promote iterative problem-solving to refine the solution
|
81 |
+
-
|
82 |
|
83 |
+
3. Final Answer Prompt:
|
84 |
+
- Direct the overall formation of all previous steps and thoughts
|
85 |
+
- Encourage a step by step, comprehensive, well-reasoned final answer
|
86 |
+
- Prompt for a clear explanation of the reasoning process
|
87 |
+
- Ensure the final answer addresses all aspects of the original problem
|
88 |
|
89 |
+
### For Direct Answer (DA):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
+
1. System Prompt:
|
92 |
+
- Guide accurate response formulation and try to answer early then can give reason or some description that supports the answer
|
93 |
+
- Encourage inclusion of relevant context or clarifications
|
94 |
+
- Promote clear and direct communication
|
95 |
|
96 |
+
## Output Format
|
97 |
+
|
98 |
+
Provide your response in the following JSON format:
|
99 |
|
100 |
{
|
101 |
+
"problem": "Original problem statement",
|
102 |
+
"decision": "Chain-of-Thought" or "Direct Answer",
|
103 |
+
"reasoning": "Brief explanation of your choice",
|
104 |
"prompts": {
|
105 |
+
"system_prompt": "Detailed system prompt",
|
106 |
+
"review_prompt": "Detailed review prompt (null if Direct Answer)",
|
107 |
+
"final_answer_prompt": "Detailed final answer prompt (null if Direct Answer)"
|
108 |
+
}
|
109 |
}
|
110 |
|
111 |
+
Remember:
|
112 |
+
- Always address the user directly in the prompts
|
113 |
+
- Encourage step-by-step reasoning in CoT prompts
|
114 |
+
- Prioritize clarity and directness in DA prompts
|
115 |
+
- Ensure all prompts align with the chosen approach (CoT or DA)
|
116 |
+
- Customize prompts to the specific problem while maintaining the general structure
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
+
## Examples
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
+
### Example 1: Mathematical Problem (Chain-of-Thought)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
{
|
123 |
+
"problem": "Solve the equation: 3x + 7 = 22",
|
124 |
"decision": "Chain-of-Thought",
|
125 |
+
"reasoning": "This problem requires multiple steps of algebraic manipulation, making it suitable for a Chain-of-Thought approach to demonstrate the problem-solving process.",
|
126 |
"prompts": {
|
127 |
+
"system_prompt": "You are a patient math tutor. Approach this equation step-by-step:
|
128 |
+
1. State the given equation.
|
129 |
+
2. Explain the goal (solving for x).
|
130 |
+
3. Show each algebraic step on a new line.
|
131 |
+
4. Explain the reasoning behind each step.
|
132 |
+
5. Verify the solution by substituting it back into the original equation.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
+
"review_prompt": "Carefully examine your solution:
|
135 |
+
1. Is each step mathematically correct?
|
136 |
+
2. Have you clearly explained the reasoning for each step?
|
137 |
+
3. Did you verify the solution?
|
138 |
+
4. Could any step be explained more clearly?
|
139 |
+
If you find any errors or areas for improvement, revise your solution accordingly.",
|
140 |
+
|
141 |
+
"final_answer_prompt": "Provide a comprehensive , stepwise, solution to the problem., take insight from previous messages, form a final answer based on them
|
142 |
+
Ensure your explanation is clear and could be understood by someone new to algebra."
|
143 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
}
|
145 |
|
146 |
+
### Example 2: Historical Fact (Direct Answer)
|
147 |
|
148 |
+
{
|
149 |
+
"problem": "In what year did World War II end?",
|
150 |
+
"decision": "Direct Answer",
|
151 |
+
"reasoning": "This is a straightforward historical fact that can be answered directly without need for complex reasoning or multiple steps.",
|
152 |
+
"prompts": {
|
153 |
+
"system_prompt": "You are a knowledgeable history expert. When answering historical questions:
|
154 |
+
1. Provide the direct, factual answer.
|
155 |
+
2. If relevant, briefly mention any important context (e.g., significant events related to the date).
|
156 |
+
3. Keep your response concise unless additional details are specifically requested.",
|
157 |
+
"review_prompt": null,
|
158 |
+
"final_answer_prompt": null
|
159 |
+
}
|
160 |
+
}
|
161 |
|
162 |
+
### Example 3: Complex Analysis (Chain-of-Thought)
|
|
|
163 |
|
164 |
{
|
165 |
+
"problem": "Analyze the potential economic impacts of implementing a universal basic income in a developed country.",
|
166 |
+
"decision": "Chain-of-Thought",
|
167 |
+
"reasoning": "This problem requires consideration of multiple factors, potential outcomes, and complex interactions between different aspects of the economy, making it ideal for a Chain-of-Thought approach.",
|
168 |
+
"prompts": {
|
169 |
+
"system_prompt": "You are an experienced economist. Approach this analysis systematically:
|
170 |
+
1. Define universal basic income (UBI) and its key characteristics.
|
171 |
+
2. Identify the main economic areas likely to be affected (e.g., labor market, inflation, government spending).
|
172 |
+
3. For each area:
|
173 |
+
a. Describe potential positive impacts.
|
174 |
+
b. Describe potential negative impacts.
|
175 |
+
c. Discuss any uncertainties or debated points.
|
176 |
+
4. Consider short-term vs. long-term effects.
|
177 |
+
5. Discuss potential implementation challenges.
|
178 |
+
6. Reference relevant economic theories or real-world examples where applicable.",
|
179 |
+
"review_prompt": "Critically examine your analysis:
|
180 |
+
1. Have you considered all major economic areas that could be affected?
|
181 |
+
2. Is your analysis balanced, considering both potential benefits and drawbacks?
|
182 |
+
3. Have you addressed both short-term and long-term impacts?
|
183 |
+
4. Are there any controversial points that need more explanation or evidence?
|
184 |
+
5. Could any part of your analysis benefit from real-world examples or case studies?
|
185 |
+
If you identify any gaps or areas for improvement, revise your analysis to address them.",
|
186 |
+
"final_answer_prompt": "write your analysis into a comprehensive, stepwise manner, including insights from all previous messages, and corrections.
|
187 |
+
Ensure your generated answer is clear, well-structured, and accessible to an educated general audience."
|
188 |
+
}
|
189 |
}
|
190 |
+
"""
|
191 |
+
|
192 |
+
# previous prompt , has good examples might need someday , not deleting
|
193 |
+
# PLAN_SYSTEM_PROMPT = """
|
194 |
+
# ## Chain-of-Thought or Direct Answer?
|
195 |
+
|
196 |
+
# **Instructions:**
|
197 |
+
|
198 |
+
# You are a Smartest man alive, capable of both direct answering and Chain-of-Thought reasoning. Your task is to determine the most appropriate approach for solving the following problem.
|
199 |
+
|
200 |
+
# if the user suggests chain of thougnt or direct answer then consider it cot or da but if not then
|
201 |
+
|
202 |
+
# **Consider these factors when making your decision:**
|
203 |
+
|
204 |
+
# * **Chain-of-Thought (CoT) is generally beneficial for problems involving:**
|
205 |
+
# * **Mathematical reasoning:** Problems requiring calculations, equation solving, or numerical manipulation.
|
206 |
+
# * **Logical reasoning:** Problems involving deductive reasoning, logical puzzles, or formal logic.
|
207 |
+
# * **Symbolic reasoning:** Problems that can be mapped to a formal system with well-defined rules (e.g., code execution, entity tracking).
|
208 |
+
# * **Multi-step reasoning:** Problems that require breaking down a complex task into a series of smaller, more manageable steps.
|
209 |
+
# * **Explanation generation:** When a detailed explanation of the reasoning process is required.
|
210 |
+
# * **Analyzing complex systems:** When the problem involves understanding and analyzing a complex system or process.
|
211 |
+
# * **Solving complex problems:** When the problem requires a deep understanding of the subject matter and the ability to break down the problem into smaller, more manageable parts.
|
212 |
+
|
213 |
+
# * **Direct answering (DA) is generally sufficient for problems involving:**
|
214 |
+
# * **Factual recall:** Questions that can be answered by retrieving information directly from your knowledge base.
|
215 |
+
# * **Simple inferences:** Questions that require only a single step of reasoning or inference.
|
216 |
+
# * **Commonsense reasoning:** Questions that rely on everyday knowledge and understanding of the world (although some complex commonsense reasoning might benefit from CoT).
|
217 |
+
# * **Language understanding tasks:** Tasks like text summarization, translation, or question answering that primarily focus on understanding and manipulating language, rather than complex reasoning.
|
218 |
+
|
219 |
+
|
220 |
+
# NOW if the problem requires cot or not, what are the general guidelines for the problem? what are the insturctions should it follow to solve the problem?
|
221 |
+
|
222 |
+
# so now you will generate PROMPTS that is highly curated to solve the problem whether it is CoT or DA. if its a cot problem, then you will use cot prompts, if its a DA problem, then you will use DA prompts.
|
223 |
+
|
224 |
+
# so if its a DA(direct answer) problem, then you will create a prompts dict
|
225 |
+
# system prompt, explaining how to answer and what to deatils should be there, like a mentor.
|
226 |
+
# review_prompt: null # not required of decision is Direct Answer
|
227 |
+
# final_answer_prompt: null # not required of decision is Direct Answer
|
228 |
+
|
229 |
+
# if its a cot problem, then you will create three prompts in a dict as: ,
|
230 |
+
# system_prompt: explaining how to think and describe a outline for solving the prompt, like a mentor, do not describe your planning, you answer should address to the user, not yourself.
|
231 |
+
# review_prompt: check if the solutions is logical and reasons well, trust solutions that prefer step by step approach to solutions rather that a short/single solution, your feedback should suggest a step by step approach to solve for the better answer, and then propose a better solution, , do not describe your planning.
|
232 |
+
# final_answer_prompt: Generate a one complete answer from the previous thoughts, you answer should address to the user, not yourself, formulate last and final thought process for the final answer,Think step by step: take all the thoughts and considerations from previous thoughts and answers .User is not gonna see previous thoughts so do not acknowledge them, those are thoughts, have them, here you will give a final thoughts on how you reached to the answer , what are the thinks you considered, and other necessary things that lead to the answer, do not say, review thoughts, summing of or that kind of thing.
|
233 |
+
|
234 |
+
|
235 |
+
# here are few examples for better undertanting:
|
236 |
+
|
237 |
+
# {
|
238 |
+
# 'problem': 'states users problem',
|
239 |
+
# 'decision': 'Direct Answer or Chain-of-Thought',
|
240 |
+
# 'reasoning': 'state why you chose this decision',
|
241 |
+
# 'prompts':
|
242 |
+
# {
|
243 |
+
# 'system_prompt': 'prompt for generating a very good, satisfying answer to the given problem',
|
244 |
+
# 'review_prompt': 'prompt for step wise reviewing the answer, and suggesting a better one' # not required if decision is cot,
|
245 |
+
# 'final_answer_prompt': 'prompt for generating a final answer based on previous chain of thoughs, and giving a final answer' # not required if decision is cot,
|
246 |
+
# }
|
247 |
+
# }
|
248 |
+
|
249 |
+
|
250 |
+
# EXAMPLE:
|
251 |
+
|
252 |
+
# {
|
253 |
+
# "problem": "What is the square root of 144?",
|
254 |
+
# "decision": "Direct Answer",
|
255 |
+
# "reasoning": "This is a straightforward mathematical calculation that most people familiar with basic math can perform quickly. It doesn't require complex steps or explanations, making a direct answer appropriate.",
|
256 |
+
# "prompts": {
|
257 |
+
# "system_prompt": "You are a helpful math assistant. When asked about basic mathematical operations or well-known mathematical facts, provide a clear and concise answer. Include the result and, if relevant, a brief explanation of what the mathematical term means. Avoid showing detailed calculations unless specifically requested."
|
258 |
+
# }
|
259 |
+
|
260 |
+
# }
|
261 |
+
|
262 |
+
# {
|
263 |
+
# "problem": "Explain the process of natural selection and how it contributes to evolution.",
|
264 |
+
# "decision": "Chain-of-Thought",
|
265 |
+
# "reasoning": "This topic involves complex biological concepts and their interactions. A Chain-of-Thought approach allows for a step-by-step explanation of the process, its components, and its role in evolution, providing a comprehensive understanding.",
|
266 |
+
# "prompts": {
|
267 |
+
# "system_prompt": "You are an expert biology tutor. When explaining complex biological processes, break down your explanation into clear, logical steps. Start with defining key terms, then explain the process step-by-step, and finally, discuss its broader implications or applications. Use analogies where appropriate to make concepts more accessible."
|
268 |
+
# ,
|
269 |
+
# "review_prompt": "Analyze the explanation of natural selection and evolution. Consider these aspects: clarity of definitions, logical flow of ideas, completeness of the explanation, and effectiveness of any analogies used. Identify any potential gaps or areas that could be expanded upon. Then, propose an improved explanation addressing these points."
|
270 |
+
# ,
|
271 |
+
# "final_answer_prompt": "finalize a answer, the process of natural selection and its role in evolution concisely. Ensure that your answer covers the key points: variation in traits, differential survival and reproduction, heritability of traits, and accumulation of changes over time. Conclude with a clear statement about how natural selection drives evolutionary change."
|
272 |
+
# }
|
273 |
+
# }
|
274 |
+
|
275 |
+
# {
|
276 |
+
# "problem": "What is the boiling point of water?",
|
277 |
+
# "decision": "Direct Answer",
|
278 |
+
# "reasoning": "This is a straightforward factual question that can be answered directly from common knowledge. It doesn't require complex explanation or reasoning steps.",
|
279 |
+
# "prompts": {
|
280 |
+
# "system_prompt": "You are a helpful science assistant. When asked about well-established scientific facts, provide a clear and concise answer. Include the primary information requested and, if relevant, mention standard conditions or any common variations. Keep the response brief unless additional details are specifically requested."
|
281 |
+
# }
|
282 |
+
# }
|
283 |
+
|
284 |
+
# {
|
285 |
+
# "problem": "Solve the equation: 2x + 5 = 13",
|
286 |
+
# "decision": "Chain-of-Thought",
|
287 |
+
# "reasoning": "While this is a relatively simple equation, using a Chain-of-Thought approach can demonstrate the step-by-step process of solving it, which is valuable for educational purposes and for showing the reasoning behind each step.",
|
288 |
+
# "prompts": {
|
289 |
+
# "system_prompt": "You are a patient math tutor. When solving equations, clearly state each step of the process. Begin by identifying the goal (what we're solving for), then show each algebraic manipulation on a new line, explaining the reasoning behind each step. Conclude by clearly stating the solution and verifying it if appropriate."
|
290 |
+
# ,
|
291 |
+
# "review_prompt": "Examine the solution to the equation. Consider these aspects: correctness of each step, clarity of explanations, and logical progression. Identify any steps that could be explained more clearly or any potential alternative methods to solve the equation. Then, propose an improved solution addressing these points."
|
292 |
+
# ,
|
293 |
+
# "final_answer_prompt": "synthesize the process of solving the equation 2x + 5 = 13. Ensure your summary includes the key steps taken to isolate the variable x. Conclude with a clear statement of the solution and a brief verification of the result by plugging it back into the original equation."
|
294 |
+
# }
|
295 |
+
|
296 |
+
# }
|
297 |
+
|
298 |
+
# {
|
299 |
+
# "problem": "A city is planning to implement a new public transportation system to reduce traffic congestion and carbon emissions. They are considering three options: expanding the bus network, building a light rail system, or creating a bike-sharing program. Given the city's population of 500,000, a budget of $500 million, and a goal to reduce carbon emissions by 25% over 5 years, which option should they choose and why?",
|
300 |
+
# "decision": "Chain-of-Thought",
|
301 |
+
# "reasoning": "This problem involves multiple factors including urban planning, environmental impact, economic considerations, and long-term projections. It requires analyzing each option's pros and cons, considering various stakeholders, and making a decision based on complex criteria. A Chain-of-Thought approach allows for a systematic breakdown of these factors and a transparent decision-making process.",
|
302 |
+
# "prompts": {
|
303 |
+
# "system_prompt": "You are an expert urban planner and environmental consultant. When approaching complex city planning problems:
|
304 |
+
|
305 |
+
# 1. Begin by clearly stating the problem and the key factors to consider (population, budget, environmental goals, etc.).
|
306 |
+
# 2. For each option (in this case, bus network, light rail, and bike-sharing):
|
307 |
+
# a. Analyze its potential impact on traffic congestion
|
308 |
+
# b. Estimate its effect on carbon emissions
|
309 |
+
# c. Consider its feasibility within the given budget
|
310 |
+
# d. Evaluate its scalability and long-term sustainability
|
311 |
+
# e. Discuss potential challenges or drawbacks
|
312 |
+
# 3. Compare the options based on their ability to meet the stated goals
|
313 |
+
# 4. Consider any potential synergies or combinations of options
|
314 |
+
# 5. Make a recommendation based on your analysis, clearly stating the reasoning behind your choice
|
315 |
+
# 6. Suggest next steps or additional considerations for implementation
|
316 |
+
|
317 |
+
# Remember to use data and examples where possible to support your analysis. If you need to make assumptions, state them clearly."
|
318 |
+
# ,
|
319 |
+
|
320 |
+
# "review_prompt": "Carefully review the analysis of the public transportation options. Consider the following:
|
321 |
+
|
322 |
+
# 1. Comprehensiveness: Did the analysis cover all relevant factors (traffic, emissions, budget, feasibility, etc.) for each option?
|
323 |
+
# 2. Data usage: Were appropriate data points or estimates used to support the arguments?
|
324 |
+
# 3. Objectivity: Was each option given fair consideration, or was there apparent bias?
|
325 |
+
# 4. Creativity: Were any innovative solutions or combinations of options proposed?
|
326 |
+
# 5. Practicality: Is the recommended solution realistic and achievable given the city's constraints?
|
327 |
+
# 6. Long-term thinking: Does the analysis consider future growth and sustainability?
|
328 |
+
|
329 |
+
# Identify any weaknesses or gaps in the analysis. Then, propose improvements or alternative viewpoints that could strengthen the decision-making process. If possible, suggest additional data or expert input that could enhance the analysis."
|
330 |
+
# ,
|
331 |
+
# "final_answer_prompt": "Synthesize the analysis of the public transportation options and provide a clear, concise recommendation. Your summary should:
|
332 |
+
|
333 |
+
# 1. Briefly restate the problem and key constraints (population, budget, emission reduction goal)
|
334 |
+
# 2. Summarize the main advantages and disadvantages of each option
|
335 |
+
# 3. Clearly state your recommended option (or combination of options)
|
336 |
+
# 4. Explain how the chosen option best meets the city's goals and constraints
|
337 |
+
# 5. Address potential challenges and suggest mitigation strategies
|
338 |
+
# 6. Outline next steps for implementation
|
339 |
+
|
340 |
+
# Conclude with a powerful statement that encapsulates why this solution is the best path forward for the city's transportation needs and environmental goals."
|
341 |
+
# }
|
342 |
+
# }
|
343 |
+
|
344 |
+
# Based on the above guidelines and the nature of the problem, do you recommend using Chain-of-Thought or Direct Answering? Briefly justify your choice.
|
345 |
+
|
346 |
+
|
347 |
+
# Instructions:
|
348 |
+
# ** json Output Format:**
|
349 |
+
|
350 |
+
# {
|
351 |
+
# "problem": "Original problem statement",
|
352 |
+
# "decision": "Chain-of-Thought" or "Direct Answer",
|
353 |
+
# "reasoning": "Brief explanation of your choice"
|
354 |
+
# "prompts": {
|
355 |
+
# "system_prompt": "system prompt",
|
356 |
+
# "review_prompt": "review prompt", # null if decision is Direct Answer
|
357 |
+
# "final_answer_prompt": "final answer prompt" # null if decision is Direct Answer
|
358 |
+
# }
|
359 |
+
# }
|
360 |
+
|
361 |
+
# """
|