# --- STEP 3: THE PROMPT IS UPDATED TO HANDLE DIFFICULTY INTERNALLY ---
# --- STEP 3: PROMPT CONSTRUCTION ---
ifis_arabic:
# (A similar detailed prompt in Arabic would be needed here)
prompt=f"""
أنت خبير في تطوير المناهج التعليمية، ومهمتك هي إنشاء **أسئلة اختيار من متعدد جديدة بالكامل** (أسئلة لم تظهر من قبل).
prompt=f"""
أنت خبير في تطوير المناهج التعليمية، ومهمتك هي إنشاء **أسئلة اختيار من متعدد جديدة بالكامل**.
هذه هي الأسئلة الموجودة بالفعل لمفهوم "{concept}":
--- الأسئلة الموجودة ---
...
...
@@ -185,95 +187,107 @@ class AgentService:
قم بإنشاء {num_questions} سؤالًا جديدًا تمامًا من نوع الاختيار من متعدد (MCQ)، **مختلفة كليًا عن الأسئلة الموجودة أعلاه**.
⚠️ **مهم جدًا**:
يجب أن تتضمن الأسئلة مستويات صعوبة متنوعة وفق التوزيع التالي تقريبًا:
- ٤٠٪ أسئلة سهلة (مستوى صعوبة من ١ إلى ٤)
- ٣٠٪ أسئلة متوسطة (مستوى صعوبة من ٥ إلى ٧)
- ٣٠٪ أسئلة صعبة (مستوى صعوبة من ٨ إلى ١٠)
يجب أن تشمل الأسئلة مستويات متنوعة من الصعوبة وفق التوزيع التالي:
- ٤٠٪ أسئلة سهلة (١ إلى ٤)
- ٣٠٪ أسئلة متوسطة (٥ إلى ٧)
- ٣٠٪ أسئلة صعبة (٨ إلى ١٠)
كما يجب أن تغطي الأسئلة مستويات تصنيف بلوم الستة التالية بشكل متوازن تقريبًا:
- "تذكر" (remember)
- "فهم" (understand)
- "تطبيق" (apply)
- "تحليل" (analysis)
- "تقييم" (evaluate)
- "إبداع" (create)
**صيغة الإخراج مطلوبة أن تكون مصفوفة JSON صالحة** (JSON array) من الكائنات (objects).
كل كائن يجب أن يحتوي على المفاتيح التالية **بالضبط**:
**صيغة الإخراج** يجب أن تكون مصفوفة JSON صالحة (JSON array) تحتوي على كائنات (objects) بالمفاتيح التالية تمامًا:
- "question_text": نص السؤال.
- "difficulty_level": رقم صحيح من ١ إلى ١٠ يمثل مستوى الصعوبة.
- "difficulty_level": رقم من ١ إلى ١٠.
- "blooms_level": واحدة من ["remember", "understand", "apply", "analysis", "evaluate", "create"].
- "question_type": نوع السؤال (مثلاً: "multiple_choice").
- "correct_answer": الإجابة الصحيحة الوحيدة.
- "wrong_answer_1": إجابة خاطئة ولكن معقولة.
- "wrong_answer_2": إجابة خاطئة ولكن معقولة.
- "wrong_answer_3": إجابة خاطئة ولكن معقولة.
- "wrong_answer_4": إجابة خاطئة ولكن معقولة.
- "hint": تلميح أو مساعدة للطالب لفهم السؤال.
- "question_image_url": اترك هذا الحقل كسلسلة فارغة "".
- "correct_image_url": اترك هذا الحقل كسلسلة فارغة "".
- "wrong_image_url_1": اترك هذا الحقل كسلسلة فارغة "".
- "wrong_image_url_2": اترك هذا الحقل كسلسلة فارغة "".
- "wrong_image_url_3": اترك هذا الحقل كسلسلة فارغة "".
- "wrong_image_url_4": اترك هذا الحقل كسلسلة فارغة "".
- "correct_answer": الإجابة الصحيحة.
- "wrong_answer_1" إلى "wrong_answer_4": إجابات خاطئة معقولة.
- "hint": تلميح للطالب.
- "question_image_url", "correct_image_url", "wrong_image_url_1" إلى "_4": اتركها كسلسلة فارغة "".
لا تكتب أي نص خارج مصفوفة JSON.
"""
else:
prompt=f"""
You are an expert curriculum developer creating new multiple-choice questions.
You are an expert curriculum developer. Your task is to generate **entirely new multiple-choice questions (MCQs)** that do NOT overlap with any existing ones.
Here are the questions that ALREADY EXIST for the concept "{concept}":
--- EXISTING QUESTIONS ---
{existing_questions_text}
--- END EXISTING QUESTIONS ---
Based ONLY on the following context:
--- CONTEXT ---
{full_context}
--- END CONTEXT ---
Generate {num_questions} NEW and COMPLETELY DIFFERENT multiple-choice questions from the list above.
Here are the questions that ALREADY EXIST for the concept "{concept}":
--- EXISTING QUESTIONS ---
{existing_questions_text}
--- END EXISTING QUESTIONS ---
**IMPORTANT**: For the {num_questions} questions you generate, assign a difficulty level to each one. The distribution should be approximately:
- 40% easy (difficulty 1-4)
- 30% medium (difficulty 5-7)
- 30% hard (difficulty 8-10)
Your response MUST be a valid JSON array of objects. Each object must have these exact keys:
- "question_text": The text of the question.
- "difficulty_level": An integer between 1 and 10, based on the distribution rule.
- "question_type": The type of question (e.g., "multiple_choice").
- "correct_answer": The single correct answer.
- "wrong_answer_1": A plausible wrong answer.
- "wrong_answer_2": Another plausible wrong answer.
- "wrong_answer_3": A third plausible wrong answer.
- "wrong_answer_4": A fourth plausible wrong answer.
- "hint": A helpful hint for the student.
- "question_image_url": Leave this as an empty string "".
- "correct_image_url": Leave this as an empty string "".
- "wrong_image_url_1": Leave this as an empty string "".
- "wrong_image_url_2": Leave this as an empty string "".
- "wrong_image_url_3": Leave this as an empty string "".
- "wrong_image_url_4": Leave this as an empty string "".
Do not include any text outside of the JSON array.
"""
Based ONLY on the following context:
--- CONTEXT ---
{full_context}
--- END CONTEXT ---
Generate {num_questions} NEW and COMPLETELY DIFFERENT multiple-choice questions.
⚠️ **Important Requirements**:
- Distribute difficulty levels approximately as follows:
- 40% easy (difficulty 1–4)
- 30% medium (difficulty 5–7)
- 30% hard (difficulty 8–10)
- Also, balance across Bloom's taxonomy levels:
- "remember"
- "understand"
- "apply"
- "analysis"
- "evaluate"
- "create"
Your response MUST be a valid JSON array of objects.
Each object must have **exactly** these keys:
- "question_text": The text of the question.
- "difficulty_level": Integer 1–10.
- "blooms_level": One of ["remember", "understand", "apply", "analysis", "evaluate", "create"].
- "question_type": The type (e.g., "multiple_choice").
- "correct_answer": The single correct answer.
- "wrong_answer_1" to "wrong_answer_4": Plausible incorrect answers.