← All changes
|
config/settings/openAi/prompt-curriculum-course.php
+124
-124
4.3.9
→
4.4.10
View file →
| @@ -1,124 +1,124 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Prompt to create a course | |
| 4 | - */ | |
| 5 | -if ( ! isset( $params ) ) { | |
| 6 | - return; | |
| 7 | -} | |
| 8 | - | |
| 9 | -// Course Intent | |
| 10 | -$title = $params['post-title'] ?? ''; | |
| 11 | -$description = $params['post-content'] ?? ''; | |
| 12 | -$target_audience = $params['target_audience'] ?? 'Beginners'; | |
| 13 | -$course_objective = trim( $params['course_objective'] ?? '' ); | |
| 14 | - | |
| 15 | -// AI Settings | |
| 16 | -$language = trim( $params['language'] ?? 'English' ); | |
| 17 | -$tone = trim( $params['tone'] ?? 'Informative and encouraging' ); | |
| 18 | -$reading_level = trim( $params['reading_level'] ?? 'High school' ); | |
| 19 | -$target_keywords = trim( $params['target_keywords'] ?? '' ); | |
| 20 | - | |
| 21 | -$goal = $params['goal'] ?? ''; | |
| 22 | -$sections = $params['section_number'] ?? 3; | |
| 23 | -$section_title_length = $params['section_title_length'] ?? 60; | |
| 24 | -$section_description_length = $params['section_description_length'] ?? 160; | |
| 25 | -$lessons_per_section = $params['lessons_per_section'] ?? 5; | |
| 26 | -$lesson_title_length = $params['lesson_title_length'] ?? 60; | |
| 27 | -$lesson_desc_length = $params['lesson_desc_length'] ?? 1000; | |
| 28 | -$quizzes_per_section = $params['quizzes_per_section'] ?? 1; | |
| 29 | -$quiz_title_length = $params['quiz_title_length'] ?? 60; | |
| 30 | -$questions_per_quiz = $params['questions_per_quiz'] ?? 2; | |
| 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_title" approximately {$quiz_title_length} characters. | |
| 40 | - - Each quiz MUST contain exactly **{$questions_per_quiz}** question object(s) in a "questions" array. | |
| 41 | - - Each question must be multiple-choice, testing concepts from the lessons in THAT SAME section. | |
| 42 | - - 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). | |
| 43 | - </quiz_requirements> | |
| 44 | -XML; | |
| 45 | - | |
| 46 | - $quiz_json_example = ',' . <<<JSON | |
| 47 | - "quizzes": [ | |
| 48 | - { | |
| 49 | - "quiz_title": "Quiz Title Here", | |
| 50 | - "quiz_description": "Brief description of the quiz...", | |
| 51 | - "questions": [ | |
| 52 | - { | |
| 53 | - "question_title": "Question title here...", | |
| 54 | - "question_description": "Question description task here...", | |
| 55 | - "options": ["Option A", "Option B", "Correct Option", "Option D"], | |
| 56 | - "correct_answer": "Correct Option" | |
| 57 | - } | |
| 58 | - ] | |
| 59 | - } | |
| 60 | - ] | |
| 61 | -JSON; | |
| 62 | -} | |
| 63 | - | |
| 64 | -return <<<XML | |
| 65 | -<prompt> | |
| 66 | - <role_definition> | |
| 67 | - You are an AI assistant specialized in instructional design and content creation. | |
| 68 | - </role_definition> | |
| 69 | - | |
| 70 | - <course_context> | |
| 71 | - <objective> | |
| 72 | - The primary goal of this structure course is: | |
| 73 | - inspired by the course title: "$title", | |
| 74 | - also reflect the course's content: "$description" | |
| 75 | - </objective> | |
| 76 | - <audience> | |
| 77 | - The target audience is: $target_audience | |
| 78 | - </audience> | |
| 79 | - <content_parameters> | |
| 80 | - <language>$language</language> | |
| 81 | - <tone>$tone</tone> | |
| 82 | - <reading_level>$reading_level</reading_level> | |
| 83 | - </content_parameters> | |
| 84 | - </course_context> | |
| 85 | - | |
| 86 | - <task_instructions> | |
| 87 | - Your main task is to generate a complete, well-structured, and engaging online course based on all the provided context. | |
| 88 | - | |
| 89 | - <structure_requirements> | |
| 90 | - - The goal of course is {$goal} | |
| 91 | - - The course MUST be divided into exactly **$sections** section(s). | |
| 92 | - - Each "section_title" approximately {$section_title_length} characters. | |
| 93 | - - Each "section_description" approximately {$section_description_length} characters. | |
| 94 | - - Each section MUST contain a relevant "section_title" and exactly **$lessons_per_section** lesson(s). | |
| 95 | - - Each lesson MUST have a "lesson_title" and detailed "lesson_description". | |
| 96 | - - "lesson_title" values MUST be concise, relevant, and no longer than **$lesson_title_length** characters. | |
| 97 | - - "lesson_description" values MUST be concise, relevant, and no longer than **$lesson_desc_length** characters. | |
| 98 | - </structure_requirements> | |
| 99 | - $quiz_structure_requirements | |
| 100 | - </task_instructions> | |
| 101 | - | |
| 102 | - <output_format> | |
| 103 | - - You MUST respond with ONLY a single, valid JSON object. | |
| 104 | - - Do not include any introductory text, explanations, or markdown code fences like ```json. | |
| 105 | - - The JSON structure must strictly follow this example: | |
| 106 | - <json_example> | |
| 107 | - { | |
| 108 | - "sections": [ | |
| 109 | - { | |
| 110 | - "section_title": "Section 1 Title Here", | |
| 111 | - "section_description": "Section 1 description Here", | |
| 112 | - "lessons": [ | |
| 113 | - { | |
| 114 | - "lesson_title": "Lesson 1.1 Title Here", | |
| 115 | - "lesson_description": "Detailed content for lesson 1.1..." | |
| 116 | - } | |
| 117 | - ]$quiz_json_example | |
| 118 | - } | |
| 119 | - ] | |
| 120 | - } | |
| 121 | - </json_example> | |
| 122 | - </output_format> | |
| 123 | -</prompt> | |
| 124 | -XML; | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Prompt to create a course | |
| 4 | + */ | |
| 5 | +if ( ! isset( $params ) ) { | |
| 6 | + return; | |
| 7 | +} | |
| 8 | + | |
| 9 | +// Course Intent | |
| 10 | +$title = $params['post-title'] ?? ''; | |
| 11 | +$description = $params['post-content'] ?? ''; | |
| 12 | +$target_audience = $params['target_audience'] ?? 'Beginners'; | |
| 13 | +$course_objective = trim( $params['course_objective'] ?? '' ); | |
| 14 | + | |
| 15 | +// AI Settings | |
| 16 | +$language = trim( $params['language'] ?? 'English' ); | |
| 17 | +$tone = trim( $params['tone'] ?? 'Informative and encouraging' ); | |
| 18 | +$reading_level = trim( $params['reading_level'] ?? 'High school' ); | |
| 19 | +$target_keywords = trim( $params['target_keywords'] ?? '' ); | |
| 20 | + | |
| 21 | +$goal = $params['goal'] ?? ''; | |
| 22 | +$sections = $params['section_number'] ?? 3; | |
| 23 | +$section_title_length = $params['section_title_length'] ?? 60; | |
| 24 | +$section_description_length = $params['section_description_length'] ?? 160; | |
| 25 | +$lessons_per_section = $params['lessons_per_section'] ?? 5; | |
| 26 | +$lesson_title_length = $params['lesson_title_length'] ?? 60; | |
| 27 | +$lesson_desc_length = $params['lesson_desc_length'] ?? 1000; | |
| 28 | +$quizzes_per_section = $params['quizzes_per_section'] ?? 1; | |
| 29 | +$quiz_title_length = $params['quiz_title_length'] ?? 60; | |
| 30 | +$questions_per_quiz = $params['questions_per_quiz'] ?? 2; | |
| 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_title" approximately {$quiz_title_length} characters. | |
| 40 | + - Each quiz MUST contain exactly **{$questions_per_quiz}** question object(s) in a "questions" array. | |
| 41 | + - Each question must be multiple-choice, testing concepts from the lessons in THAT SAME section. | |
| 42 | + - 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). | |
| 43 | + </quiz_requirements> | |
| 44 | +XML; | |
| 45 | + | |
| 46 | + $quiz_json_example = ',' . <<<JSON | |
| 47 | + "quizzes": [ | |
| 48 | + { | |
| 49 | + "quiz_title": "Quiz Title Here", | |
| 50 | + "quiz_description": "Brief description of the quiz...", | |
| 51 | + "questions": [ | |
| 52 | + { | |
| 53 | + "question_title": "Question title here...", | |
| 54 | + "question_description": "Question description task here...", | |
| 55 | + "options": ["Option A", "Option B", "Correct Option", "Option D"], | |
| 56 | + "correct_answer": "Correct Option" | |
| 57 | + } | |
| 58 | + ] | |
| 59 | + } | |
| 60 | + ] | |
| 61 | +JSON; | |
| 62 | +} | |
| 63 | + | |
| 64 | +return <<<XML | |
| 65 | +<prompt> | |
| 66 | + <role_definition> | |
| 67 | + You are an AI assistant specialized in instructional design and content creation. | |
| 68 | + </role_definition> | |
| 69 | + | |
| 70 | + <course_context> | |
| 71 | + <objective> | |
| 72 | + The primary goal of this structure course is: | |
| 73 | + inspired by the course title: "$title", | |
| 74 | + also reflect the course's content: "$description" | |
| 75 | + </objective> | |
| 76 | + <audience> | |
| 77 | + The target audience is: $target_audience | |
| 78 | + </audience> | |
| 79 | + <content_parameters> | |
| 80 | + <language>$language</language> | |
| 81 | + <tone>$tone</tone> | |
| 82 | + <reading_level>$reading_level</reading_level> | |
| 83 | + </content_parameters> | |
| 84 | + </course_context> | |
| 85 | + | |
| 86 | + <task_instructions> | |
| 87 | + Your main task is to generate a complete, well-structured, and engaging online course based on all the provided context. | |
| 88 | + | |
| 89 | + <structure_requirements> | |
| 90 | + - The goal of course is {$goal} | |
| 91 | + - The course MUST be divided into exactly **$sections** section(s). | |
| 92 | + - Each "section_title" approximately {$section_title_length} characters. | |
| 93 | + - Each "section_description" approximately {$section_description_length} characters. | |
| 94 | + - Each section MUST contain a relevant "section_title" and exactly **$lessons_per_section** lesson(s). | |
| 95 | + - Each lesson MUST have a "lesson_title" and detailed "lesson_description". | |
| 96 | + - "lesson_title" values MUST be concise, relevant, and no longer than **$lesson_title_length** characters. | |
| 97 | + - "lesson_description" values MUST be concise, relevant, and no longer than **$lesson_desc_length** characters. | |
| 98 | + </structure_requirements> | |
| 99 | + $quiz_structure_requirements | |
| 100 | + </task_instructions> | |
| 101 | + | |
| 102 | + <output_format> | |
| 103 | + - You MUST respond with ONLY a single, valid JSON object. | |
| 104 | + - Do not include any introductory text, explanations, or markdown code fences like ```json. | |
| 105 | + - The JSON structure must strictly follow this example: | |
| 106 | + <json_example> | |
| 107 | + { | |
| 108 | + "sections": [ | |
| 109 | + { | |
| 110 | + "section_title": "Section 1 Title Here", | |
| 111 | + "section_description": "Section 1 description Here", | |
| 112 | + "lessons": [ | |
| 113 | + { | |
| 114 | + "lesson_title": "Lesson 1.1 Title Here", | |
| 115 | + "lesson_description": "Detailed content for lesson 1.1..." | |
| 116 | + } | |
| 117 | + ]$quiz_json_example | |
| 118 | + } | |
| 119 | + ] | |
| 120 | + } | |
| 121 | + </json_example> | |
| 122 | + </output_format> | |
| 123 | +</prompt> | |
| 124 | +XML; | |