|
| 1 | +Usage Guide |
| 2 | +########### |
| 3 | + |
| 4 | +This guide walks you through creating your first AI workflows and configuring them for different contexts in your Open edX installation. |
| 5 | + |
| 6 | +Prerequisites |
| 7 | +************* |
| 8 | + |
| 9 | +Before following this guide, ensure you have: |
| 10 | + |
| 11 | +- Completed the plugin installation |
| 12 | +- Configured at least one AI provider (see `Configuration Guide <configuration_guide.html>`_) |
| 13 | +- Django admin access to your Open edX instance |
| 14 | + |
| 15 | +Overview |
| 16 | +******** |
| 17 | + |
| 18 | +To make an AI workflow available to users, you need to create two components: |
| 19 | + |
| 20 | +1. **Profile**: Defines what the AI will do (the behavior and instructions) |
| 21 | +2. **Scope**: Defines where the AI workflow will appear (LMS/CMS, courses, specific locations) |
| 22 | + |
| 23 | +LMS Example: Content Summary |
| 24 | +***************************** |
| 25 | + |
| 26 | +This example creates a content summarization feature available to learners in the LMS. |
| 27 | + |
| 28 | +Creating the Profile |
| 29 | +==================== |
| 30 | + |
| 31 | +1. Navigate to the profile creation page: |
| 32 | + |
| 33 | + .. code-block:: text |
| 34 | +
|
| 35 | + /admin/openedx_ai_extensions/aiworkflowprofile/add/ |
| 36 | +
|
| 37 | + .. image:: /_static/screenshots/profile_create.png |
| 38 | + :alt: Create new profile interface |
| 39 | + |
| 40 | +2. Configure the profile: |
| 41 | + |
| 42 | + - **Slug**: Enter a descriptive identifier (e.g., ``lms-content-summary``) |
| 43 | + - **Base filepath**: Select ``base.summary`` from the dropdown |
| 44 | + |
| 45 | +3. Click **Save and continue editing** |
| 46 | + |
| 47 | +4. Review the configuration: |
| 48 | + |
| 49 | + You can now see two sections: |
| 50 | + |
| 51 | + - **Base template**: The default configuration from the selected filepath |
| 52 | + - **Effective configuration**: The final configuration after applying any patches |
| 53 | + |
| 54 | + .. image:: /_static/screenshots/profile_configuration_view.png |
| 55 | + :alt: Profile configuration view showing base template and effective configuration |
| 56 | + |
| 57 | +Creating the Scope |
| 58 | +=================== |
| 59 | + |
| 60 | +1. Navigate to the scope creation page: |
| 61 | + |
| 62 | + .. code-block:: text |
| 63 | +
|
| 64 | + /admin/openedx_ai_extensions/aiworkflowscope/add/ |
| 65 | +
|
| 66 | + .. image:: /_static/screenshots/scope_create.png |
| 67 | + :alt: Create new scope interface |
| 68 | + |
| 69 | +2. Configure the scope: |
| 70 | + |
| 71 | + - **Service variant**: Select ``LMS`` |
| 72 | + - **Course ID**: Leave empty (applies to all courses) |
| 73 | + - **Location regex**: Leave empty (applies to all units) |
| 74 | + - **Profile**: Select the profile you just created |
| 75 | + |
| 76 | +3. Click **Save** |
| 77 | + |
| 78 | +Testing the Workflow |
| 79 | +===================== |
| 80 | + |
| 81 | +Navigate to any course unit in the LMS. You should see the AI workflow interface available to learners. |
| 82 | + |
| 83 | +.. image:: /_static/screenshots/lms_summary_workflow_1.png |
| 84 | + :alt: Content summary workflow in LMS unit view |
| 85 | + |
| 86 | +.. image:: /_static/screenshots/lms_summary_workflow_2.png |
| 87 | + :alt: Response of the summary workflow in LMS |
| 88 | + |
| 89 | +Studio Example: Library Question Assistant |
| 90 | +******************************************* |
| 91 | + |
| 92 | +This example creates an AI assistant for content authors working with content libraries in Studio. |
| 93 | + |
| 94 | +Creating the Profile |
| 95 | +==================== |
| 96 | + |
| 97 | +1. Navigate to the profile creation page: |
| 98 | + |
| 99 | + .. code-block:: text |
| 100 | +
|
| 101 | + /admin/openedx_ai_extensions/aiworkflowprofile/add/ |
| 102 | +
|
| 103 | +2. Configure the profile: |
| 104 | + |
| 105 | + - **Slug**: Enter a descriptive identifier (e.g., ``studio-library-assistant``) |
| 106 | + - **Base filepath**: Select ``base.library_questions_assistant`` |
| 107 | + |
| 108 | +3. Click **Save and continue editing** |
| 109 | + |
| 110 | +4. Review the base template and effective configuration as before. |
| 111 | + |
| 112 | +Creating the Scope |
| 113 | +=================== |
| 114 | + |
| 115 | +1. Navigate to the scope creation page: |
| 116 | + |
| 117 | + .. code-block:: text |
| 118 | +
|
| 119 | + /admin/openedx_ai_extensions/aiworkflowscope/add/ |
| 120 | +
|
| 121 | +2. Configure the scope: |
| 122 | + |
| 123 | + - **Service variant**: Select ``CMS - Studio`` |
| 124 | + - **Course ID**: Leave empty (applies to all content libraries) |
| 125 | + - **Location regex**: Leave empty (applies to all locations) |
| 126 | + - **Profile**: Select the profile you just created |
| 127 | + |
| 128 | +3. Click **Save** |
| 129 | + |
| 130 | +Testing the Workflow |
| 131 | +===================== |
| 132 | + |
| 133 | +Navigate to a content library in Studio. You should see the AI assistant interface available to authors. |
| 134 | + |
| 135 | +.. image:: /_static/screenshots/studio_library_assistant.png |
| 136 | + :alt: Library question assistant in Studio |
| 137 | + |
| 138 | +Advanced Configuration |
| 139 | +********************** |
| 140 | + |
| 141 | +Targeting Specific Courses |
| 142 | +=========================== |
| 143 | + |
| 144 | +To limit a workflow to a specific course, use the **Course ID** field in the scope configuration. |
| 145 | + |
| 146 | +Course ID Format |
| 147 | +---------------- |
| 148 | + |
| 149 | +Course IDs follow this format: |
| 150 | + |
| 151 | +.. code-block:: text |
| 152 | +
|
| 153 | + course-v1:edunext+01+2025 |
| 154 | +
|
| 155 | +Example: To make a workflow available only in your Demo course: |
| 156 | + |
| 157 | +1. Edit your scope configuration |
| 158 | +2. Set **Course ID** to: ``course-v1:edX+DemoX+Demo_Course`` |
| 159 | +3. Save the scope |
| 160 | + |
| 161 | +.. note:: |
| 162 | + Multiple courses are not currently supported in a single scope. Create separate scopes for different courses. |
| 163 | + |
| 164 | +Targeting Specific Units |
| 165 | +========================= |
| 166 | + |
| 167 | +The **Location regex** field allows you to target specific course units using regular expressions. |
| 168 | + |
| 169 | +Unit Location Format |
| 170 | +-------------------- |
| 171 | + |
| 172 | +Course units have location IDs in this format: |
| 173 | + |
| 174 | +.. code-block:: text |
| 175 | +
|
| 176 | + block-v1:edX+DemoX+Demo_Course+type@vertical+block@30b3cb3f372a493589a9632c472550a7 |
| 177 | +
|
| 178 | +Targeting a Single Unit |
| 179 | +----------------------- |
| 180 | + |
| 181 | +To target a specific unit, use a regex pattern matching the block ID: |
| 182 | + |
| 183 | +.. code-block:: text |
| 184 | +
|
| 185 | + .*a3ada3c77ab74014aa620f3c494e5558 |
| 186 | +
|
| 187 | +This matches any location ending with that block ID. |
| 188 | + |
| 189 | +Targeting Multiple Units |
| 190 | +------------------------ |
| 191 | + |
| 192 | +To target multiple specific units, use the OR operator (``|``): |
| 193 | + |
| 194 | +.. code-block:: text |
| 195 | +
|
| 196 | + .*(a3ada3c77ab74014aa620f3c494e5558|30b3cb3f372a493589a9632c472550a7|7f8e9d6c5b4a3210fedcba9876543210) |
| 197 | +
|
| 198 | +This matches any unit with one of the three specified block IDs. |
| 199 | + |
| 200 | +.. warning:: |
| 201 | + Location regex is a powerful but technical feature. Test your regex patterns carefully to ensure they match the intended units. |
| 202 | + |
| 203 | +Customizing Prompts |
| 204 | +******************* |
| 205 | + |
| 206 | +You can customize the AI's instructions and behavior by modifying prompts at the profile level. |
| 207 | + |
| 208 | +Method 1: Inline Prompt in Profile Patch |
| 209 | +========================================= |
| 210 | + |
| 211 | +Use the **Content patch** field to override the prompt: |
| 212 | + |
| 213 | +Single Line Prompt |
| 214 | +------------------ |
| 215 | + |
| 216 | +.. code-block:: json |
| 217 | +
|
| 218 | + { |
| 219 | + "processor_config": { |
| 220 | + "LLMProcessor": { |
| 221 | + "prompt": "Your custom prompt here" |
| 222 | + } |
| 223 | + } |
| 224 | + } |
| 225 | +
|
| 226 | +Multi-line Prompt |
| 227 | +----------------- |
| 228 | + |
| 229 | +For longer prompts, use the backslash line continuation syntax: |
| 230 | + |
| 231 | +.. code-block:: json |
| 232 | +
|
| 233 | + { |
| 234 | + "processor_config": { |
| 235 | + "LLMProcessor": { |
| 236 | + "prompt": "\ |
| 237 | + Your custom prompt \ |
| 238 | + on many lines \ |
| 239 | + with detailed instructions \ |
| 240 | + " |
| 241 | + } |
| 242 | + } |
| 243 | + } |
| 244 | +
|
| 245 | +Example Profile |
| 246 | +--------------- |
| 247 | + |
| 248 | +The plugin includes an example at ``base.custom_prompt`` demonstrating this approach. |
| 249 | + |
| 250 | +.. image:: /_static/screenshots/inline_prompt_patch.png |
| 251 | + :alt: Inline prompt configuration in profile patch |
| 252 | + |
| 253 | +Method 2: Prompt Templates (Recommended) |
| 254 | +========================================= |
| 255 | + |
| 256 | +For reusable prompts, create a prompt template that can be referenced by multiple profiles. |
| 257 | + |
| 258 | +Creating a Prompt Template |
| 259 | +--------------------------- |
| 260 | + |
| 261 | +1. Navigate to the prompt template creation page: |
| 262 | + |
| 263 | + .. code-block:: text |
| 264 | +
|
| 265 | + /admin/openedx_ai_extensions/prompttemplate/add/ |
| 266 | +
|
| 267 | +2. Configure the template: |
| 268 | + |
| 269 | + - **Slug**: Enter a descriptive identifier (e.g., ``tutor-assistant-prompt``) |
| 270 | + - **Prompt body**: Enter your prompt text |
| 271 | + |
| 272 | +3. Click **Save** |
| 273 | + |
| 274 | +4. Note the identifiers shown after saving: |
| 275 | + |
| 276 | + .. code-block:: text |
| 277 | +
|
| 278 | + "prompt_template": "769965eb-c242-4512-8d27-4f4feb800fe2" |
| 279 | + "prompt_template": "your-prompt-slug" |
| 280 | +
|
| 281 | + You can use either the UUID or the slug to reference this template. |
| 282 | + |
| 283 | +Using a Prompt Template in a Profile |
| 284 | +------------------------------------- |
| 285 | + |
| 286 | +In your profile's **Content patch** field: |
| 287 | + |
| 288 | +.. code-block:: json |
| 289 | +
|
| 290 | + { |
| 291 | + "processor_config": { |
| 292 | + "LLMProcessor": { |
| 293 | + "prompt_template": "769965eb-c242-4512-8d27-4f4feb800fe2" |
| 294 | + } |
| 295 | + } |
| 296 | + } |
| 297 | +
|
| 298 | +Or using the slug: |
| 299 | + |
| 300 | +.. code-block:: json |
| 301 | +
|
| 302 | + { |
| 303 | + "processor_config": { |
| 304 | + "LLMProcessor": { |
| 305 | + "prompt_template": "tutor-assistant-prompt" |
| 306 | + } |
| 307 | + } |
| 308 | + } |
| 309 | +
|
| 310 | +.. tip:: |
| 311 | + Using prompt templates makes it easier to: |
| 312 | + |
| 313 | + - Reuse prompts across multiple profiles |
| 314 | + - Update prompts without modifying profile configurations |
| 315 | + - Maintain a library of tested, effective prompts |
| 316 | + |
| 317 | +Next Steps |
| 318 | +********** |
| 319 | + |
| 320 | +Now that you have basic workflows configured, you can: |
| 321 | + |
| 322 | +- Experiment with different base profiles such as the chat for different providers |
| 323 | +- Create custom prompts tailored to your use cases |
| 324 | +- Configure multiple scopes for different courses and contexts |
| 325 | +- Monitor usage and refine your configurations |
| 326 | + |
| 327 | +For advanced customization and development, see the how-to guides and reference documentation. |
| 328 | +For additional support, visit the `GitHub Issues <https://github.com/openedx/openedx-ai-extensions/issues>`_ page. |
0 commit comments