Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -472,69 +472,6 @@ ADDITIONAL PROOF GUIDELINES:
|
|
472 |
{proof_examples}"""
|
473 |
|
474 |
return enhanced_prompt
|
475 |
-
|
476 |
-
|
477 |
-
def get_difficulty_parameters(difficulty_level):
|
478 |
-
"""Return specific parameters and constraints based on difficulty level"""
|
479 |
-
parameters = {
|
480 |
-
1: { # Very Easy
|
481 |
-
"description": "suitable for beginners",
|
482 |
-
"constraints": [
|
483 |
-
"Use only basic concepts and straightforward calculations",
|
484 |
-
"Break complex problems into smaller, guided steps",
|
485 |
-
"Use simple numbers and avoid complex algebraic expressions"
|
486 |
-
],
|
487 |
-
"example_style": "Similar to standard homework problems",
|
488 |
-
"model": "claude-3-5-sonnet-20241022"
|
489 |
-
},
|
490 |
-
2: { # Easy
|
491 |
-
"description": "easy, but requiring some thought",
|
492 |
-
"constraints": [
|
493 |
-
"Use basic concepts with minor complications",
|
494 |
-
"Minimal guidance provided",
|
495 |
-
"Use moderately complex numbers or expressions"
|
496 |
-
],
|
497 |
-
"example_style": "Similar to quiz questions",
|
498 |
-
"model": "claude-3-5-sonnet-20241022"
|
499 |
-
},
|
500 |
-
3: { # Intermediate
|
501 |
-
"description": "intermediate difficulty, testing deeper understanding",
|
502 |
-
"constraints": [
|
503 |
-
"Combine 2-3 related concepts",
|
504 |
-
"Include some non-obvious solution paths",
|
505 |
-
"Require multi-step reasoning",
|
506 |
-
"Use moderate algebraic complexity"
|
507 |
-
],
|
508 |
-
"example_style": "Similar to intermediate-difficulty exam questions",
|
509 |
-
"model": "claude-3-5-sonnet-20241022"
|
510 |
-
},
|
511 |
-
4: { # Difficult
|
512 |
-
"description": "challenging, requiring strong mathematical maturity",
|
513 |
-
"constraints": [
|
514 |
-
"Combine multiple concepts creatively",
|
515 |
-
"Require insight and deep understanding",
|
516 |
-
"Use sophisticated mathematical reasoning"
|
517 |
-
],
|
518 |
-
"example_style": "Similar to challenging exam questions",
|
519 |
-
"model": "claude-3-5-sonnet-20241022"
|
520 |
-
},
|
521 |
-
5: { # Very Difficult
|
522 |
-
"description": "very challenging, testing mastery and creativity at a graduate level",
|
523 |
-
"constraints": [
|
524 |
-
"Create novel applications of theoretical concepts",
|
525 |
-
"Require graduate-level mathematical reasoning",
|
526 |
-
"Combine multiple advanced topics in unexpected ways",
|
527 |
-
"Demand creative problem-solving approaches",
|
528 |
-
"Include rigorous proof construction",
|
529 |
-
"Require synthesis across mathematical domains",
|
530 |
-
"Test deep theoretical understanding"
|
531 |
-
],
|
532 |
-
"example_style": "Similar to graduate qualifying exams or advanced competition problems",
|
533 |
-
"model": "claude-3-5-sonnet-20241022"
|
534 |
-
}
|
535 |
-
}
|
536 |
-
|
537 |
-
return parameters.get(difficulty_level)
|
538 |
|
539 |
def create_latex_document(content, questions_only=False):
|
540 |
"""Create a complete LaTeX document"""
|
@@ -833,7 +770,6 @@ def generate_question(subject, difficulty, question_type, subtopic=None, use_enh
|
|
833 |
selected_topic = subtopic if subtopic else random.choice(SUBJECT_SUBTOPICS[subject])
|
834 |
logger.debug(f"Using selected subtopic: {selected_topic}")
|
835 |
|
836 |
-
difficulty_params = get_difficulty_parameters(difficulty)
|
837 |
problem_type_addition = get_problem_type_addition(question_type)
|
838 |
|
839 |
system_prompt = f"""You are a mathematics professor.
|
@@ -973,12 +909,12 @@ make sure the question is CLEAR about what regions you intend to be included in
|
|
973 |
|
974 |
logger.debug("Sending request to Anthropic API")
|
975 |
message = anthropic.messages.create(
|
976 |
-
model=
|
977 |
max_tokens=4096,
|
978 |
temperature=0.9,
|
979 |
messages=[{
|
980 |
"role": "user",
|
981 |
-
"content":
|
982 |
}]
|
983 |
)
|
984 |
|
|
|
472 |
{proof_examples}"""
|
473 |
|
474 |
return enhanced_prompt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
475 |
|
476 |
def create_latex_document(content, questions_only=False):
|
477 |
"""Create a complete LaTeX document"""
|
|
|
770 |
selected_topic = subtopic if subtopic else random.choice(SUBJECT_SUBTOPICS[subject])
|
771 |
logger.debug(f"Using selected subtopic: {selected_topic}")
|
772 |
|
|
|
773 |
problem_type_addition = get_problem_type_addition(question_type)
|
774 |
|
775 |
system_prompt = f"""You are a mathematics professor.
|
|
|
909 |
|
910 |
logger.debug("Sending request to Anthropic API")
|
911 |
message = anthropic.messages.create(
|
912 |
+
model = "claude-3-5-sonnet-20241022",
|
913 |
max_tokens=4096,
|
914 |
temperature=0.9,
|
915 |
messages=[{
|
916 |
"role": "user",
|
917 |
+
"content": system_prompt
|
918 |
}]
|
919 |
)
|
920 |
|