Category: News

AI Subsystem in Moodle 4.5

One of the many new features in Moodle 4.5 is the AI Subsystem. Given the buzz around AI development and the wild pace of change with LLM based tools it isn’t a surprise to see the beginnings of AI incorporated into Moodle. At the Lafeyette College-hosted Winter Hack/Doc 2025 I spent some time exploring the functionality. The development task for AI was documented by Moodle as “AI subsystem MVP”. The functionality released in Moodle 4.5 consists of three primary user facing interfaces into AI tools, “Generate Text”, “Generate Image,” and “Summarize”.

AI Implementation

For the new features to be available an admin needs to visit the AI section of the Site Administration menu. In Moodle 4.5, two AI providers are supported, OpenAI and AzureAI. Without a valid configuration, UI elements regarding AI are not shown.

AI Provider Configuration

The configuration for the AI providers is broken down into two areas. The first involves configuring the API keys and other requirements for your connection.

Image of the configuration options for Azure AI inside Moodle 4.5 the options. The Options are: Azure AI API Key, Azure AI API Endpoint, a checkbox to enable/disable a site-wide rate limit (default: off), the field for the maximum site wide requests per hour (default if enabled: 100), a checkbox to enable/disable user limits (default: off), and the field for the user requests per hour limit (default if enabled: 10).
Azure AI Configuration options

You can enable a maximum number of requests per person and/or at the server level for communications with the AI provider.

Below the AI provider configuration there are three configurations for each of the user facing interfaces. In addition to individual toggles these include configuration of API versions (these vary slightly between providers, OpenAI screenshot provided below), but also contain an area for a set of System Instructions. These are instructions passed along to the AI Model prior to the content of the user’s prompt:

Screenshot of the configuration of the Generate Text for ChatGPT under Moodle 4.5 showing the 3 configuration options. Those options are: AI model, the AI endpoint and System Instructions. The default for system instructions are: "You will receive a text input from the user. Your task is to generate text based on their request. Follow these important instructions: 1. Return the summary in plain text only. 2. Do not include any markdown formatting, greetings, or platitudes."
Generate Text Settings

AI Placement Configuration

Located below the provider configuration are AI Placement configurations. These allow for UI based control over enabling/disabling of AI elements in the text editor (generate text/image) and course pages (summarize).

User Experience with AI Tools enabled in Moodle

The “universal” sparkle/diamonds symbol indicating AI are added to the toolbar when Text Editor placement is enabled (and an API provider is configured). In further confirmation that Atto editor is being deprecated the Atto editor doesn’t have the AI buttons. Under the sparkles the user experiences two options if everything is enabled: Generate Text, Generate Image. If one or the other is disabled, the sparkles are replaced by a pictogram indicating the one remaining enabled option instead of pure sparkles.

The first time a user first clicks any of the AI tool options, an AI Usage Policy appears. If the user declines, the AI dialog closes. If they accept they are allowed to proceed into the tool.

Screen shot of the AI policy default settings in Moodle 4.5: <h4><strong>Welcome to the new AI feature!</strong></h4> <p>This Artificial Intelligence (AI) feature is based solely on external Large Language Models (LLM) to improve your learning and teaching experience. Before you start using these AI services, please read this usage policy.</p> <h4><strong>Accuracy of AI-generated content</strong></h4> <p>AI can give useful suggestions and information, but its accuracy may vary. You should always double-check the information provided to make sure it's accurate, complete, and suitable for your specific situation.</p> <h4><strong>How your data is processed</strong></h4> <p>This AI feature uses external Large Language Models (LLM). If you use this feature, any information or personal data you share will be handled according to the privacy policy of those LLMs. We recommend that you read their privacy policy to understand how they will handle your data. Additionally, a record of your interactions with the AI features may be saved in this site.</p> <p>If you have questions about how your data is processed, please check with your teachers or learning organisation.</p> <p>By continuing, you acknowledge that you understand and agree to this policy.</p>

The policy text lives in the language pack under core > ai.php. It’s named “userpolicy”.

The summarize button appears in lots of places by default but the portion of the page that it sends to the AI provider for summary doesn’t always make sense. For example, on this quiz page with a description of the assignment (well, sort of) the student doesn’t get any useful information from the quiz description that the instructor “provided”.

A bad AI summary of a Quiz

Limiting AI availability inside Moodle to specific courses

In the event that your institution has the appropriate subscriptions and you think someone might need to access the functionality in Moodle but you don’t want to make it available to your whole community we suggest the following implementation.

Set the following permissions to PREVENT at the site level for the teacher, student, and other roles at your institution that shouldn’t see the tools:

  • aiplacement/courseassist:summarise_text: controls access to the Summarize text button
  • aiplacement/editor:generate_text: Controls access to the generate text button in the TinyMCE interface
  • aiplacement/editor:generate_image: Controls access to the generate image button in the TinyMCE interface

Once they are set to prevent you can override these capabilities to ALLOW at the course (instructor capability under Participants -> Permissions) or category level where appropriate.

Note: CLAMP didn’t have access to both providers so I can’t provide insight into what happens if both providers are enabled. Do users get two “generate image buttons/summarize/etc” or a choice after clicking the button? If you experiment with this let us know!

Image redaction and orientation in Moodle 4.5

Moodle 4.5 introduces many new features which we’ll be covering in the forthcoming report out of the 2025 Winter Hack/Doc Fest. Here, I’m going to highlight one in particular: image redaction. This is a new security feature that will automatically strip out geolocation data from uploaded images. It’s important that you configure it correctly, because at the moment there’s a bug that could cause many images that have a portrait orientation to display in landscape.

Exif and GPS data

Exif is a metadata standard implemented by images. You can specify a dizzying array of information, but we’re concerned here with just a few fields: geographic coordinates, image width and height, and orientation. When smartphones take images they include latitude and longitude unless you disable that behavior on your phone. For example, here’s a photo I took from the rear of the California Zephyr in 2018:

Railroad tracks disappear into the horizonMy notes say that I took it in Utah. The encoded GPS information says that I took in near Mt. Elliott, about twenty miles northwest of Green River. Here’s what that data looks like:

GPS Altitude  : 1419 m Above Sea Level
GPS Date/Time : 2018:10:21 00:14:56Z
GPS Latitude  : 39 deg 9' 39.62" N
GPS Longitude : 110 deg 20' 33.62" W
GPS Position  : 39 deg 9' 39.62" N, 110 deg 20' 33.62" W

This is pretty useful for knowing where I when I took this! This might be less useful if I’d taken this picture somewhere private–say from a dorm room when I’m uploading an assignment to Moodle. Location data can be a major privacy risk if disclosed inadvertently.

Exif and Orientation

Another use of Exif data is to store the width and height of the image and its orientation (portrait or landscape). Some smartphones, particularly the iPhones we tested at Hack/Doc, store all images in the landscape format but then set the orientation to indicate that they should be displayed in portrait mode:

Orientation  : Rotate 90 CW
Image Width  : 5712
Image Height : 4284
Image Size   : 5712x4284

An image with the width greater than the height would imply landscape except that Orientation is set to “Rotate 90 CW”: rotate ninety degrees clockwise. When you view that image, you’ll see it in portrait mode so long as the browser or image software respects that Exif data.

Redaction

Moodle 4.5 adds a new feature called EXIF remover to strip out GPS information. It’s located in Site administration > Server > File redaction > EXIF remover. If you’re installing a new 4.5 instance it’s enabled by default; if you’re upgrading an existing instance to Moodle 4.5 it’s off by default and you have to choose to turn it on. By default, it uses the GD library to reprocess the image. GD doesn’t have special features for managing Exif metadata; GD will remove all fields, including Orientation! That’s undesirable at best, and probably a bug (see MDL-84128).

Moodle HQ doesn’t recommend running this way and CLAMP doesn’t either. The recommended approach is to install exiftool on your server and configure your Moodle instance to use it. Exiftool is a common command-line application; it’s available for Windows and Mac and most Linux distributions. I used it to extract the Exif examples in this post. Once you’ve installed it (or your hosting provider has), you need to configure the path in Site administration. Below is an example of a working configuration:

Moodle configuration page. Enable EXIF remover is checked. Path to ExifTool is set to "/usr/bin/exiftool". The EXIF tags that will be removed is set to GPS only.

Exiftool will output a new image with the given Exif tags removed but won’t change anything else. I assume that the GD option was provided as a fallback since it doesn’t require new external tools or new PHP libraries, but I don’t think it should be enabled by default because of the real possibility that it breaks image uploads from smartphones.

New Moodle LAE Releases for December 2024

There are three new Moodle: Liberal Arts Edition releases. There are no new LAE features; these are maintenance releases only. You can download the updates from the CLAMP code release archive. The new releases are for versions 4.1, 4.3, and 4.4.

The next stable releases are scheduled for mid-February 2025. Moodle 4.5 has been released; CLAMP will evaluate it at the Winter 2025 Hack/Doc Fest at Lafayette College. For more information about Moodle 4.4, please read CLAMP’s recap for the Summer 2024 Hack/Doc Fest at Bryn Mawr College.

Registration open for Winter 2025 Hack/Doc Fest

The “Free Bridge” links Easton, Pennsylvania, with Phillipsburg, New Jersey

Registration is now open for the Winter 2025 Hack/Doc Fest, which will be held at Lafayette College from January 7 through January 9, 2025. CLAMP’s Hack/Doc Fests are twice-yearly unconference-style events dedicated to improving the Moodle experience for liberal arts colleges.

For CLAMP schools, CLAMP will reimburse your first night’s stay at the Grand Eastonian. There is no group rate for lodging.

New Moodle LAE Releases for October 2024

There are four new Moodle: Liberal Arts Edition releases. There are no new LAE features; these are maintenance releases only. You can download the updates from the CLAMP code release archive. The new releases are for versions 4.1, 4.2, 4.3, and 4.4.

The next stable releases are scheduled for mid-December. Moodle 4.5 has been released; CLAMP will evaluate it at the Winter 2025 Hack/Doc Fest at Lafayette College. For more information about Moodle 4.4, please read CLAMP’s recap for the Summer 2024 Hack/Doc Fest at Bryn Mawr College.