Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -514,6 +514,7 @@ def generate_question(subject, difficulty, question_type):
|
|
514 |
|
515 |
system_prompt = f"""You are an expert mathematics professor creating a {difficulty_params['description']} exam question.
|
516 |
STRICT REQUIREMENTS:
|
|
|
517 |
1. Write exactly 1 {question_type} question on {subject} covering {selected_topic}.
|
518 |
2. Difficulty Level Guidelines:
|
519 |
{difficulty_params['description'].upper()}
|
@@ -530,7 +531,7 @@ STRICT REQUIREMENTS:
|
|
530 |
- Put each solution step on its own line in $$ $$
|
531 |
- DO NOT use \\begin{{aligned}} or similar environments
|
532 |
5. Include a detailed solution
|
533 |
-
- Begin the solution with a heading in bold
|
534 |
- If the question involves geometry make sure to identify any general geometric formulas that apply, For example:
|
535 |
* Areas/volumes of common shapes and solids
|
536 |
* Cross-sectional areas of geometric figures
|
@@ -540,7 +541,7 @@ STRICT REQUIREMENTS:
|
|
540 |
* ensure integration bounds align with the physical direction of the process being modeled
|
541 |
6. Maintain clear formatting
|
542 |
7. At the end of the solution output, print SymPy code that you would use to solve or verify the main equations in the question
|
543 |
-
and give this section a heading in bold
|
544 |
8. Observe the folloiwng SymPy Guidelines
|
545 |
{SYMPY_GUIDELINES}"""
|
546 |
|
@@ -669,7 +670,7 @@ def check_and_resolve_discrepancy(initial_response, sympy_output):
|
|
669 |
The first, called Original solution, is a complete solution.
|
670 |
The second, called SymPy Verification, will only provide the final answer.
|
671 |
|
672 |
-
Begin this section with a heading in bold
|
673 |
|
674 |
If the SymPy Verification answer is consistent with the final answer Original solution,
|
675 |
then please say that they are consistent and briefly explain why.
|
@@ -779,6 +780,8 @@ Revised Solution to Verify:
|
|
779 |
|
780 |
Please follow these steps exactly:
|
781 |
|
|
|
|
|
782 |
1. First, analyze the solution for:
|
783 |
- Mathematical correctness
|
784 |
- Missing cases or assumptions
|
@@ -786,7 +789,8 @@ Please follow these steps exactly:
|
|
786 |
- Necessary conditions and edge cases
|
787 |
- Any subtle errors or oversights
|
788 |
|
789 |
-
2. After your analysis,
|
|
|
790 |
"Here is the complete verified solution:"
|
791 |
|
792 |
3. Then write out the ENTIRE solution from beginning to end, including:
|
@@ -804,7 +808,6 @@ Your complete solution must:
|
|
804 |
- Maintain proper LaTeX formatting with $ for inline math and $ on separate lines
|
805 |
- Include any relevant SymPy code for verification
|
806 |
|
807 |
-
Begin this section with a heading in bold and larger font size: Final Verified Solution
|
808 |
Remember to write out the complete solution even if you only need to add a few steps - the goal is to have a single, complete, verified solution that includes everything necessary for full mathematical rigor."""
|
809 |
|
810 |
try:
|
|
|
514 |
|
515 |
system_prompt = f"""You are an expert mathematics professor creating a {difficulty_params['description']} exam question.
|
516 |
STRICT REQUIREMENTS:
|
517 |
+
0. Start out with a heading in bold: Question
|
518 |
1. Write exactly 1 {question_type} question on {subject} covering {selected_topic}.
|
519 |
2. Difficulty Level Guidelines:
|
520 |
{difficulty_params['description'].upper()}
|
|
|
531 |
- Put each solution step on its own line in $$ $$
|
532 |
- DO NOT use \\begin{{aligned}} or similar environments
|
533 |
5. Include a detailed solution
|
534 |
+
- Begin the solution with a heading in bold: Original Solution
|
535 |
- If the question involves geometry make sure to identify any general geometric formulas that apply, For example:
|
536 |
* Areas/volumes of common shapes and solids
|
537 |
* Cross-sectional areas of geometric figures
|
|
|
541 |
* ensure integration bounds align with the physical direction of the process being modeled
|
542 |
6. Maintain clear formatting
|
543 |
7. At the end of the solution output, print SymPy code that you would use to solve or verify the main equations in the question
|
544 |
+
and give this section a heading in bold: SymPy Verification
|
545 |
8. Observe the folloiwng SymPy Guidelines
|
546 |
{SYMPY_GUIDELINES}"""
|
547 |
|
|
|
670 |
The first, called Original solution, is a complete solution.
|
671 |
The second, called SymPy Verification, will only provide the final answer.
|
672 |
|
673 |
+
Begin this section with a heading in bold: Comparison of SymPy Verifiation with Original Solution
|
674 |
|
675 |
If the SymPy Verification answer is consistent with the final answer Original solution,
|
676 |
then please say that they are consistent and briefly explain why.
|
|
|
780 |
|
781 |
Please follow these steps exactly:
|
782 |
|
783 |
+
0. Begin with a heading in bold: Expert Analysis of Revised Solution
|
784 |
+
|
785 |
1. First, analyze the solution for:
|
786 |
- Mathematical correctness
|
787 |
- Missing cases or assumptions
|
|
|
789 |
- Necessary conditions and edge cases
|
790 |
- Any subtle errors or oversights
|
791 |
|
792 |
+
2. After your analysis, include a heading in bold: Final Verified Solution
|
793 |
+
Then write exactly this phrase:
|
794 |
"Here is the complete verified solution:"
|
795 |
|
796 |
3. Then write out the ENTIRE solution from beginning to end, including:
|
|
|
808 |
- Maintain proper LaTeX formatting with $ for inline math and $ on separate lines
|
809 |
- Include any relevant SymPy code for verification
|
810 |
|
|
|
811 |
Remember to write out the complete solution even if you only need to add a few steps - the goal is to have a single, complete, verified solution that includes everything necessary for full mathematical rigor."""
|
812 |
|
813 |
try:
|