| 1 |
<?php |
| 2 |
/** |
| 3 |
* Prompt to create a course |
| 4 |
*/ |
| 5 |
if ( ! isset( $params ) ) { |
| 6 |
return; |
| 7 |
} |
| 8 |
|
| 9 |
// Course Intent |
| 10 |
$role_persona = $params['role_persona'] ?? ''; |
| 11 |
$target_audience = $params['target_audience'] ?? 'Beginners'; |
| 12 |
$course_objective = $params['course_objective'] ?? ''; |
| 13 |
|
| 14 |
// AI Settings |
| 15 |
$language = $params['language'] ?? 'English'; |
| 16 |
$tone = $params['tone'] ?? ''; |
| 17 |
$lesson_length = $params['lessons_title_length'] ?? 300; |
| 18 |
$reading_level = $params['reading_level'] ?? 'High school'; |
| 19 |
$seo_emphasis = $params['seo_emphasis'] ?? ''; |
| 20 |
$target_keywords = $params['target_keywords'] ?? ''; |
| 21 |
|
| 22 |
// Course Structure |
| 23 |
$sections = $params['section_number'] ?? 1; |
| 24 |
$section_title_length = $params['section_title_length'] ?? 60; |
| 25 |
$section_desc_length = $params['section_desc_length'] ?? 160; |
| 26 |
$lessons_per_section = $params['lessons_per_section'] ?? 1; |
| 27 |
$lesson_title_length = $params['lesson_title_length'] ?? 60; |
| 28 |
$quizzes_per_section = $params['quizzes_per_section'] ?? 0; |
| 29 |
$quiz_title_length = $params['quiz_title_length'] ?? 60; |
| 30 |
$questions_per_quiz = $params['questions_per_quiz'] ?? 0; |
| 31 |
|
| 32 |
$quiz_structure_requirements = ''; |
| 33 |
$quiz_json_example = ''; |
| 34 |
if ( $quizzes_per_section > 0 ) { |
| 35 |
$quiz_structure_requirements = <<<XML |
| 36 |
<quiz_requirements> |
| 37 |
- Each section MUST contain exactly **{$quizzes_per_section}** quiz object(s) within a "quizzes" array. |
| 38 |
- Each quiz MUST have a relevant "quiz_title" and "quiz_description". |
| 39 |
- Each quiz MUST contain exactly **{$questions_per_quiz}** question object(s) in a "questions" array. |
| 40 |
- Each question must be multiple-choice, testing concepts from the lessons in THAT SAME section. |
| 41 |
- Each question object MUST contain: "question_title", "question_description", "options" (an array of 4 strings), and "correct_answer" (a string matching one of the options). |
| 42 |
</quiz_requirements> |
| 43 |
XML; |
| 44 |
|
| 45 |
$quiz_json_example = ',' . <<<JSON |
| 46 |
"quizzes": [ |
| 47 |
{ |
| 48 |
"quiz_title": "Quiz Title Here", |
| 49 |
"quiz_description": "Brief description of the quiz...", |
| 50 |
"questions": [ |
| 51 |
{ |
| 52 |
"question_title": "Question title here...", |
| 53 |
"question_description": "Question description task here...", |
| 54 |
"options": ["Option A", "Option B", "Correct Option", "Option D"], |
| 55 |
"correct_answer": "Correct Option" |
| 56 |
} |
| 57 |
] |
| 58 |
} |
| 59 |
] |
| 60 |
JSON; |
| 61 |
} |
| 62 |
|
| 63 |
return <<<XML |
| 64 |
<prompt> |
| 65 |
<role_definition> |
| 66 |
You are an AI assistant specialized in instructional design and content creation. Your persona for this task is: **$role_persona**. |
| 67 |
</role_definition> |
| 68 |
|
| 69 |
<course_context> |
| 70 |
<objective> |
| 71 |
The primary goal of this course is: $course_objective |
| 72 |
</objective> |
| 73 |
<audience> |
| 74 |
The target audience is: $target_audience |
| 75 |
</audience> |
| 76 |
<content_parameters> |
| 77 |
<language>$language</language> |
| 78 |
<tone>$tone</tone> |
| 79 |
<reading_level>$reading_level</reading_level> |
| 80 |
</content_parameters> |
| 81 |
<seo_parameters> |
| 82 |
<emphasis>$seo_emphasis</emphasis> |
| 83 |
<keywords>$target_keywords</keywords> |
| 84 |
</seo_parameters> |
| 85 |
</course_context> |
| 86 |
|
| 87 |
<task_instructions> |
| 88 |
Your main task is to generate a complete, well-structured, and engaging online course based on all the provided context. |
| 89 |
|
| 90 |
<structure_requirements> |
| 91 |
- The course MUST have a compelling "course_title" and a concise "course_description". |
| 92 |
- The "course_description" must be between 200 and 1000 words, content have html like list, heading h3, paragraph to make content easy to read and eye-catching, and include one image with tag <image> on the content. |
| 93 |
- The course MUST be divided into exactly **$sections** section(s). |
| 94 |
- "section_title" values MUST be concise, relevant, and no longer than **$section_title_length** characters. |
| 95 |
- "section_description" values MUST be concise, relevant, and no longer than **$section_desc_length** characters. |
| 96 |
- Each section MUST contain a relevant "section_title" and exactly **$lessons_per_section** lesson(s). |
| 97 |
- Each lesson MUST have a "lesson_title" and detailed "lesson_description". |
| 98 |
- "lesson_title" values MUST be concise, relevant, and no longer than **$lesson_title_length** characters. |
| 99 |
</structure_requirements> |
| 100 |
$quiz_structure_requirements |
| 101 |
</task_instructions> |
| 102 |
|
| 103 |
<output_format> |
| 104 |
- You MUST respond with ONLY a single, valid JSON object. |
| 105 |
- Do not include any introductory text, explanations, or markdown code fences like ```json. |
| 106 |
- The JSON structure must strictly follow this example: |
| 107 |
<json_example> |
| 108 |
{ |
| 109 |
"course_title": "Compelling Course Title Here", |
| 110 |
"course_description": "A brief summary of the course.", |
| 111 |
"sections": [ |
| 112 |
{ |
| 113 |
"section_title": "Section 1 Title Here", |
| 114 |
"section_description": "Section 1 description Here", |
| 115 |
"lessons": [ |
| 116 |
{ |
| 117 |
"lesson_title": "Lesson 1.1 Title Here", |
| 118 |
"lesson_description": "Detailed content for lesson 1.1..." |
| 119 |
} |
| 120 |
]$quiz_json_example |
| 121 |
} |
| 122 |
] |
| 123 |
} |
| 124 |
</json_example> |
| 125 |
</output_format> |
| 126 |
</prompt> |
| 127 |
XML; |
| 128 |
|