Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -528,6 +528,7 @@ STRICT REQUIREMENTS:
|
|
528 |
- Put each solution step on its own line in $$ $$
|
529 |
- DO NOT use \\begin{{aligned}} or similar environments
|
530 |
5. Include a detailed solution
|
|
|
531 |
- If the question involves geometry make sure to identify any general geometric formulas that apply, For example:
|
532 |
* Areas/volumes of common shapes and solids
|
533 |
* Cross-sectional areas of geometric figures
|
@@ -536,7 +537,8 @@ STRICT REQUIREMENTS:
|
|
536 |
* carefully consider the direction of change in variables
|
537 |
* ensure integration bounds align with the physical direction of the process being modeled
|
538 |
6. Maintain clear formatting
|
539 |
-
7. At the end of the
|
|
|
540 |
8. Observe the folloiwng SymPy Guidelines
|
541 |
{SYMPY_GUIDELINES}"""
|
542 |
|
@@ -578,7 +580,7 @@ STRICT REQUIREMENTS:
|
|
578 |
response_text = f"{response_text}\n\nSymPy Verification Results:\n```\n{sympy_output}\n```\n\nVerification Analysis:\n{resolution_text}"
|
579 |
|
580 |
# For difficulty level 5 AND when there's a discrepancy with a revised solution
|
581 |
-
if
|
582 |
logger.debug("Performing final verification for difficulty 5 problem with discrepancy")
|
583 |
final_verification = perform_final_verification(revised_solution)
|
584 |
response_text += "\n\nFinal Expert Verification:\n" + final_verification
|
@@ -664,6 +666,8 @@ def check_and_resolve_discrepancy(initial_response, sympy_output):
|
|
664 |
resolution_prompt = f"""Here is a mathematics question with two answers.
|
665 |
The first, called Original solution, is a complete solution.
|
666 |
The second, called SymPy Verification, will only provide the final answer.
|
|
|
|
|
667 |
|
668 |
If the SymPy Verification answer is consistent with the final answer Original solution,
|
669 |
then please say that they are consistent and briefly explain why.
|
@@ -674,7 +678,7 @@ def check_and_resolve_discrepancy(initial_response, sympy_output):
|
|
674 |
3. Write "Here is the revised complete solution:" and then write out the ENTIRE solution from beginning
|
675 |
to end, including all parts that were correct and the corrections for any incorrect parts.
|
676 |
Do not refer to the original solution or say things like "the rest remains the same" - write
|
677 |
-
out everything in full.
|
678 |
|
679 |
Original solution:
|
680 |
{initial_response}
|
@@ -798,6 +802,7 @@ Your complete solution must:
|
|
798 |
- Maintain proper LaTeX formatting with $ for inline math and $ on separate lines
|
799 |
- Include any relevant SymPy code for verification
|
800 |
|
|
|
801 |
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."""
|
802 |
|
803 |
try:
|
|
|
528 |
- Put each solution step on its own line in $$ $$
|
529 |
- DO NOT use \\begin{{aligned}} or similar environments
|
530 |
5. Include a detailed solution
|
531 |
+
- Begin the solution with a heading in bold and larger font size: Original Solution
|
532 |
- If the question involves geometry make sure to identify any general geometric formulas that apply, For example:
|
533 |
* Areas/volumes of common shapes and solids
|
534 |
* Cross-sectional areas of geometric figures
|
|
|
537 |
* carefully consider the direction of change in variables
|
538 |
* ensure integration bounds align with the physical direction of the process being modeled
|
539 |
6. Maintain clear formatting
|
540 |
+
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
|
541 |
+
and give this section a heading in bold and larger font size: SymPy Verification
|
542 |
8. Observe the folloiwng SymPy Guidelines
|
543 |
{SYMPY_GUIDELINES}"""
|
544 |
|
|
|
580 |
response_text = f"{response_text}\n\nSymPy Verification Results:\n```\n{sympy_output}\n```\n\nVerification Analysis:\n{resolution_text}"
|
581 |
|
582 |
# For difficulty level 5 AND when there's a discrepancy with a revised solution
|
583 |
+
if has_discrepancy and revised_solution:
|
584 |
logger.debug("Performing final verification for difficulty 5 problem with discrepancy")
|
585 |
final_verification = perform_final_verification(revised_solution)
|
586 |
response_text += "\n\nFinal Expert Verification:\n" + final_verification
|
|
|
666 |
resolution_prompt = f"""Here is a mathematics question with two answers.
|
667 |
The first, called Original solution, is a complete solution.
|
668 |
The second, called SymPy Verification, will only provide the final answer.
|
669 |
+
|
670 |
+
Begin this section with a heading in bold and larger font size: Comparison of SymPy Verifiation with Original Solution
|
671 |
|
672 |
If the SymPy Verification answer is consistent with the final answer Original solution,
|
673 |
then please say that they are consistent and briefly explain why.
|
|
|
678 |
3. Write "Here is the revised complete solution:" and then write out the ENTIRE solution from beginning
|
679 |
to end, including all parts that were correct and the corrections for any incorrect parts.
|
680 |
Do not refer to the original solution or say things like "the rest remains the same" - write
|
681 |
+
out everything in full. Begin this section with a heading in bold and larger font size: Revised Complete Solution
|
682 |
|
683 |
Original solution:
|
684 |
{initial_response}
|
|
|
802 |
- Maintain proper LaTeX formatting with $ for inline math and $ on separate lines
|
803 |
- Include any relevant SymPy code for verification
|
804 |
|
805 |
+
Begin this section with a heading in bold and larger font size: Final Verified Solution
|
806 |
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."""
|
807 |
|
808 |
try:
|