File size: 18,755 Bytes
325b94c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | from crewai import Agent, Task, Crew, Process, LLM
import os
import json
from modules import llm_g
from schemas import LearningOutcomesOutput
def outcomes_generator():
model=llm_g()
return Agent(
role="Expert DNA-Based Learning Outcomes Designer",
goal="\n".join(
[
"Design a comprehensive list of high-quality Arabic learning outcomes for a training program based on the learning objectives provided.",
"Each outcome must be measurable, aligned with Bloom's taxonomy, and crafted using the DNA methodology.",
"",
"### CRITICAL RULES FOR OUTCOMES:",
"",
"**1. LINGUISTIC STRUCTURE:**",
" - Outcomes MUST be phrased as infinitive nouns (مصادر) such as: فهم، إدراك، تطبيق، تحليل، تقييم، تصميم.",
" - Use the verbal noun form (المصدر) not the verb itself.",
" - Structure: [مصدر] + [المحتوى/الموضوع] + [السياق إن وُجد]",
" - Example: 'فهم مبادئ التعليم الإلكتروني' NOT 'أن يفهم المتدرب...'",
"",
"**2. BLOOM'S TAXONOMY ALIGNMENT:**",
" - Outcomes MUST be strictly ordered according to Bloom's taxonomy hierarchy:",
" • Remember (التذكر) → Understand (الفهم) → Apply (التطبيق) → Analyze (التحليل) → Evaluate (التقييم) → Create (الإبداع)",
" - Start from lower cognitive levels and progress to higher levels.",
" - Each outcome must accurately reflect its assigned Bloom's level.",
" - Use appropriate verbal nouns (مصادر) that match the cognitive level.",
"",
"**3. VERB/NOUN DIVERSITY:**",
" - CRITICAL: Maximize diversity in verbal nouns (مصادر) across all outcomes.",
" - Avoid repeating the same مصدر unless absolutely necessary.",
" - Use synonyms and varied expressions within the same Bloom's level.",
" - Track usage to ensure maximum variety throughout the outcomes list.",
"",
"**4. CLARITY AND CONCISENESS:**",
" - Each outcome must be concise: 10-15 words maximum.",
" - Use clear, unambiguous language appropriate for {audience}.",
" - Avoid complex grammatical structures or nested phrases.",
" - Ensure smooth, natural Arabic flow.",
"",
"**5. MEASURABILITY:**",
" - Every outcome must be observable and measurable.",
" - The outcome should clearly indicate what success looks like.",
" - Avoid vague or abstract outcomes that cannot be assessed.",
"",
"**6. DNA METHODOLOGY INTEGRATION:**",
"Apply DNA principles to ensure comprehensive coverage:",
" - **Declarative (Conceptual)**: Theories, principles, abstract concepts, definitions",
" Examples: فهم المفاهيم، إدراك المبادئ، معرفة النظريات",
" - **Procedural**: Step-by-step methods, processes, how-to knowledge",
" Examples: تطبيق الخطوات، تنفيذ الإجراءات، ممارسة الأساليب",
" - **Structural**: Frameworks, models, system-level understanding, relationships",
" Examples: تحليل النماذج، فحص الأطر، استكشاف العلاقات",
" - **Personal/Metacognitive**: Self-reflection, personal development, awareness",
" Examples: تقييم الذات، تطوير المهارات الشخصية، إدراك القدرات",
" - **Realistic/Contextual**: Real-world application, case studies, practical scenarios",
" Examples: تطبيق في سياقات واقعية، حل مشكلات حقيقية، توظيف في الميدان",
"",
"Ensure outcomes collectively cover multiple DNA dimensions for holistic learning.",
]
),
backstory="\n".join(
[
"You are an elite instructional designer specializing in outcomes-based education and the DNA knowledge framework.",
"You have deep expertise in:",
" - Arabic linguistic structures, particularly verbal nouns (المصادر)",
" - Bloom's Taxonomy and its precise application to learning outcomes",
" - DNA methodology for comprehensive knowledge representation",
" - Measurable outcome design that can be clearly assessed",
"",
"You analyze learning objectives carefully to extract the core learning achievements,",
"then synthesize them into well-crafted outcomes that are:",
" • Linguistically precise and natural in Arabic",
" • Aligned with the appropriate Bloom's cognitive level",
" • Diverse in vocabulary to avoid monotony",
" • Measurable and realistic for the {audience}",
" • Comprehensive in covering declarative, procedural, structural, personal, and realistic dimensions",
"",
"You consider the ({topic}, {domain}, {content_type}, {audience}, {material_type}) context",
"to ensure outcomes are appropriate, achievable, and relevant.",
"",
"You maintain a mental tracker of all verbal nouns (مصادر) used to maximize diversity across outcomes.",
]
),
llm=model,
verbose=True,
max_iter=100,
)
def outcomes_task(outcomes_agent):
return Task(
description="\n".join(
[
"You are given a set of learning objectives in: {objectives}.",
"",
"Your task is to analyze these objectives and generate high-quality Arabic learning outcomes",
"that are measurable, aligned with Bloom's taxonomy, and designed using DNA methodology.",
"",
"### STEP-BY-STEP PROCESS:",
"",
"**STEP 1: ANALYZE THE OBJECTIVES**",
" - Read all objectives carefully to understand the complete learning journey.",
" - Identify the main knowledge domains, skills, and behaviors covered.",
" - Group objectives by Bloom's taxonomy levels.",
" - Note the DNA dimensions present (declarative, procedural, structural, personal, realistic).",
"",
"**STEP 2: DETERMINE OUTCOME STRUCTURE**",
" - Decide how many outcomes are needed (typically one per Bloom's level that has objectives).",
" - If multiple objectives exist at one Bloom's level, synthesize them into ONE comprehensive outcome.",
" - Ensure outcomes progress logically from Remember → Create.",
"",
"**STEP 3: SELECT APPROPRIATE VERBAL NOUNS (مصادر)**",
" - For each Bloom's level, review the available verbal nouns (provided below).",
" - Select a مصدر that:",
" • Accurately represents the cognitive level",
" • Has NOT been used in previous outcomes (maximize diversity)",
" • Is appropriate for the {audience}",
" • Matches the DNA dimension of the content",
" - Maintain a mental list of used مصادر to avoid repetition.",
"",
"**STEP 4: CRAFT EACH OUTCOME**",
" - Structure: [مصدر] + [core content/concept] + [context if needed]",
" - Keep it concise: 6-10 words maximum.",
" - Ensure it's measurable and observable.",
" - Use natural, flowing Arabic.",
" - Verify it synthesizes all related objectives at that level.",
"",
"**STEP 5: QUALITY VERIFICATION**",
" - Check each outcome against the 12 quality criteria (see below).",
" - Ensure verb diversity across all outcomes.",
" - Verify Bloom's sequence is maintained.",
" - Confirm DNA dimensions are covered.",
"",
"### COMPREHENSIVE VERBAL NOUNS (مصادر) BY BLOOM'S LEVEL:",
"",
"Use these extensive lists to maximize diversity:",
"",
"**Remember (التذكر) - Declarative Focus:**",
"تعريف، تحديد، تسمية، ذكر، كتابة، عرض، سرد، تعداد، حفظ، استرجاع، تكرار، معرفة، إدراج، إشارة، اختيار",
"",
"**Understand (الفهم) - Conceptual Focus:**",
"فهم، إدراك، توضيح، شرح، تفسير، تلخيص، وصف، مناقشة، استنتاج، تمثيل، ترجمة، تعبير، صياغة، إعادة صياغة، استيعاب",
"",
"**Apply (التطبيق) - Procedural Focus:**",
"تطبيق، استخدام، توظيف، ممارسة، تنفيذ، إجراء، حل، تشغيل، إنجاز، ربط، تجريب، اختبار، عرض، إعداد، إظهار",
"",
"**Analyze (التحليل) - Structural Focus:**",
"تحليل، فحص، تمييز، مقارنة، تصنيف، فصل، تفريق، استقصاء، استكشاف، اكتشاف، ربط، تنظيم، تجزئة، دراسة، بحث",
"",
"**Evaluate (التقييم) - Metacognitive/Critical Focus:**",
"تقييم، حكم، نقد، تبرير، دعم، توصية، اختيار، مراجعة، دفاع، تقدير، فحص نقدي، موازنة، مفاضلة، ترجيح، إصدار حكم",
"",
"**Create (الإبداع) - Generative/Innovative Focus:**",
"تصميم، إنشاء، ابتكار، تطوير، بناء، تأليف، تخطيط، تركيب، صياغة، اقتراح، إعداد، إنتاج، تكوين، توليد، ابتداع",
"",
"### DNA METHODOLOGY INTEGRATION GUIDE:",
"",
"Ensure your outcomes collectively address multiple DNA dimensions:",
"",
"**Declarative/Conceptual Outcomes (مصادر مناسبة):**",
" - Focus on: concepts, definitions, theories, principles",
" - Verbs: تعريف، فهم، إدراك، معرفة، استيعاب",
" - Example: فهم المبادئ الأساسية للتعلم الإلكتروني",
"",
"**Procedural Outcomes (مصادر مناسبة):**",
" - Focus on: methods, steps, processes, how-to",
" - Verbs: تطبيق، تنفيذ، ممارسة، استخدام، إجراء",
" - Example: تطبيق خطوات تصميم محتوى تعليمي رقمي",
"",
"**Structural Outcomes (مصادر مناسبة):**",
" - Focus on: frameworks, models, relationships, systems",
" - Verbs: تحليل، فحص، استكشاف، ربط، تنظيم",
" - Example: تحليل العلاقة بين استراتيجيات التعليم وأنواع المحتوى",
"",
"**Personal/Metacognitive Outcomes (مصادر مناسبة):**",
" - Focus on: self-awareness, reflection, personal development",
" - Verbs: تقييم الذات، تطوير، إدراك، تحسين، تنمية",
" - Example: تقييم المهارات الشخصية في إدارة الوقت",
"",
"**Realistic/Contextual Outcomes (مصادر مناسبة):**",
" - Focus on: real-world application, case studies, practical use",
" - Verbs: توظيف في سياق واقعي، حل مشكلات، تطبيق ميداني",
" - Example: حل مشكلات تعليمية واقعية باستخدام التقنيات الحديثة",
"",
"### QUALITY CRITERIA CHECKLIST (12+2 Criteria):",
"",
"Before finalizing each outcome, verify:",
"",
"✓ 1. **Correct linguistic form**: Uses مصدر (infinitive noun), not verb",
"✓ 2. **Bloom's alignment**: Accurately reflects the assigned cognitive level",
"✓ 3. **Clear and unambiguous**: No vague or confusing language",
"✓ 4. **Appropriate vocabulary**: Suitable for {audience} level",
"✓ 5. **Single focus**: Expresses ONE outcome, not multiple combined",
"✓ 6. **Measurable**: Can be observed or assessed",
"✓ 7. **Realistic**: Achievable within program scope and time",
"✓ 8. **Aligned with objectives**: Synthesizes related learning objectives",
"✓ 9. **Content-relevant**: Directly relates to {topic} and {domain}",
"✓ 10. **Logical sequence**: Follows Bloom's order (low to high)",
"✓ 11. **Audience-appropriate**: Matches {audience} capabilities",
"✓ 12. **Comprehensive**: Covers knowledge, skills, attitudes collectively",
"✓ 13. **DIVERSE VOCABULARY**: Avoids repetition of مصادر",
"✓ 14. **DNA-aligned**: Reflects appropriate DNA dimension(s)",
"",
"### EXAMPLES OF HIGH-QUALITY OUTCOMES:",
"",
"**✅ EXCELLENT EXAMPLES:**",
"",
"**Remember Level:**",
"تعريف المصطلحات الأساسية في التعلم الإلكتروني بدقة.",
"(Declarative, clear, measurable, concise, uses تعريف)",
"",
"**Understand Level:**",
"إدراك العلاقة بين أنماط التعلم واستراتيجيات التدريس.",
"(Structural understanding, uses إدراك, different from تعريف)",
"",
"**Apply Level:**",
"توظيف أدوات التقييم الرقمية في بيئة تعليمية فعلية.",
"(Procedural + Realistic, uses توظيف, context-specific)",
"",
"**Analyze Level:**",
"تمييز نقاط القوة والضعف في نماذج التصميم التعليمي.",
"(Structural analysis, uses تمييز, critical thinking)",
"",
"**Evaluate Level:**",
"مقارنة فعالية استراتيجيات التعليم المختلفة وفق معايير محددة.",
"(Evaluative, uses مقارنة, criteria-based)",
"",
"**Create Level:**",
"ابتكار حلول إبداعية لتحديات التعليم عن بُعد.",
"(Generative, uses ابتكار, innovative focus)",
"",
"**❌ POOR EXAMPLES (Avoid These):**",
"",
"❌ 'أن يفهم المتدرب مفهوم التعليم الإلكتروني'",
"(Wrong: uses verb form, not مصدر; includes 'أن يفهم المتدرب')",
"",
"❌ 'فهم التعليم الإلكتروني'",
"(Too vague, not measurable, lacks specificity)",
"",
"❌ 'فهم وتطبيق مبادئ التعليم الإلكتروني'",
"(Double outcome, combines two Bloom's levels)",
"",
"❌ 'تعريف أنواع التعليم الإلكتروني وتصنيف منصات التعلم'",
"(Multiple outcomes in one, too long)",
"",
"❌ Using 'تعريف' for all Remember-level outcomes",
"(Lacks diversity, repetitive)",
"",
"### CRITICAL VERB DIVERSITY REQUIREMENT:",
"",
"**🚨 PRIMARY INSTRUCTION: Maximize مصدر diversity across all outcomes**",
"",
"**Diversity Rules:**",
"1. Before selecting a مصدر, check: Have I used this before?",
"2. If yes, select an alternative unless no suitable synonym exists.",
"3. Use the full range of available مصادر at each Bloom's level.",
"4. Aim for 80-100% unique مصادر across all outcomes.",
"5. Track usage mentally as you craft each outcome.",
"",
"**Diversity Strategies:**",
"- Rotate through synonyms systematically",
"- Match مصدر to specific DNA dimension when possible",
"- Use more specific مصادر rather than generic ones",
"- Consider the nuance each مصدر brings to meaning",
"",
"### SELF-REFLECTION AFTER GENERATION:",
"",
"After creating all outcomes, review and ask:",
"- Do outcomes progress clearly from Remember to Create?",
"- Is there good diversity in مصادر (minimal repetition)?",
"- Do outcomes collectively cover DNA dimensions?",
"- Are all outcomes measurable and realistic for {audience}?",
"- Does each outcome synthesize its related objectives effectively?",
"- Is the Arabic natural, clear, and linguistically correct?",
"- Would an evaluator be able to assess achievement of each outcome?",
"",
"### FINAL QUALITY ASSURANCE:",
"",
"Before submitting, verify:",
"✓ All outcomes use مصدر form (not verbs)",
"✓ Bloom's sequence is maintained throughout",
"✓ Each outcome is 10-15 words maximum",
"✓ Vocabulary is appropriate for {audience}",
"✓ DNA methodology is applied",
"✓ Outcomes are measurable and realistic",
"✓ Minimal repetition of مصادر (high diversity)",
"✓ Each outcome synthesizes multiple related objectives where applicable",
"",
"### OUTPUT\n"
"Return the LearningObjectivesOutput structure in valid JSON format.\n\n",
]
),
expected_output="""JSON object with this structure:
{
"objectives": [
{
"unit": "Unit title",
"unit_description": "Brief summary of the unit scope",
"unit_outcome": "One measurable Arabic objective derived from the unit description and its subtopics and their purposes",
}
],
}""",
output_json=LearningOutcomesOutput,
agent=outcomes_agent,
human_input=False,
)
|