For the online learning world

Elearning WorldLMSMoodle

Enhancing E-Learning in Moodle LMS with an AI Chat Block and FilterCodes

Are you ready to take your Moodle LMS learning experience to the next level? Look no further than the OpenAI Chat Block plugin by Bryce Yoder, available on Moodle.org. This month we will learn about how this useful plugin can be enhanced by giving it context awareness using the popular FilterCodes plugin. Together with the ChatGPT A.I., these tools will turn into an amazingly smart teacher’s assistant that will help students, teachers, course creators, and even Moodle managers and administrators get unstuck 24/7. It truly is amazing!

What is ChatGPT

Created by OpenAI and first launched in November 2022, ChatGPT has been one of the biggest advancements in publicly available artificial intelligence in the past year. It can understand human language, do research and, though it is not perfect, it usually respond to questions using helpful generate human-like answers and solutions in a natural conversational manner. It has since gained significance in many fields including online education. This breakthrough technology has opened up new possibilities for enhancing learning experiences and facilitating meaningful interactions.

ChatGPT has been trained on a vast amount of data, enabling it to understand and respond to a wide range of prompts (questions you ask). This versatility makes ChatGPT a valuable tool for various applications in the field of online education.

Can you tell that I am very excited about the possibilities this technology offers? If you can ask it a question, ChatGPT will do its best to give you an answer. Just like with humans, you can never be completely sure the answer is 100% accurate. Based on my own experience, I feel that it is probably around 80% but that depends a lot on the subject. The problem is, these AI’s were trained using information available on the Web and, as we all know, it is not always correct either. But please, don’t let that stop you from trying it out and taking advantage of this powerful and useful technology.

Benefits for Students, Teachers, and Course Creators

For students, ChatGPT can provide personalized feedback, answer questions, and clarify doubts. It acts as a virtual teacher’s assistant, offering instant assistance and guidance. Students can engage in interactive conversations with ChatGPT, allowing them to seek clarification on complex topics, receive additional resources, and enhance their understanding of the course material. A.I. is still brand new and it is here to stay. Teach your students how to use A.I. responsibly and ethically. Technologies like ChatGPT should be used to as a learning aid to suplement a student’s education, not to replace it. It cannot replace creativity and thinking. Teach students to question everything that ChatGPT-like technologies tells them.

Teachers can leverage ChatGPT to provide timely support to their students. It can assist in grading assignments, offering feedback and providing additional explanations. ChatGPT can also facilitate discussions and encourage active participation and collaboration among students. By automating certain tasks, teachers can focus more on personalized instruction and fostering a supportive learning environment.

Course creators can harness the power of ChatGPT to design interactive lessons, quizzes, and simulations. It can adapt to the learners’ needs, providing personalized learning experiences. Course creators can use ChatGPT to generate dynamic content, offer real-time feedback, and create engaging activities that cater to the unique requirements of their learners. This level of customization enhances the effectiveness of the course and promotes learner engagement.

Let’s face it, Moodle LMS is a wonderful, robust and flexible learning management system. But all this flexibility sometimes comes with a learning curve for those trying to set it up, build a course and manage students. For teachers, managers and administrators, it can be a challenge just to find their way around for the first time.

Introduction to the OpenAI Chat Block plugin

The OpenAI Chat Block plugin is a powerful addition to Moodle LMS that seamlessly integrates ChatGPT into the Moodle LMS environment. This plugin enhances the learning experience by enabling interactive and dynamic conversations between users and ChatGPT directly within Moodle LMS courses.

In the recent release of 1.7.0, the OpenAI Chat Block plugin has undergone significant updates to further enhance its functionality and user experience. Some notable changes include:

  1. Support for More GPT Versions: The plugin now supports a wider range of GPT versions, including GPT-3.5-Turbo, GPT-3.5-Turbo-16k, GPT-4 and others. Unfortunately, it was released just before the announcement of GPT-4-Turbo but I’m sure that will be coming soon. This ensures compatibility with the most advanced language models available, allowing users to leverage the cutting-edge capabilities of ChatGPT.
  2. Compatibility Updates: Release 1.7.0 includes compatibility updates for PHP versions 7.2 to 8.2 and Moodle versions 3.9 to 4.3. This ensures seamless integration with the latest versions of PHP and Moodle, providing users with a stable and up-to-date plugin experience.
  3. Enhanced Settings: The latest version allows users to define all settings per block, giving them greater control over the behaviour and appearance of the Chat Block within their Moodle LMS courses. This flexibility enables customization to suit specific course requirements and user preferences.
  4. HTML Content Display: Release 1.7.0 introduces the ability to display generated content as HTML. This feature enhances the visual appeal and interactivity of the conversations, making the learning experience more engaging and immersive for users.
  5. Improved Digital Accessibility: The latest version of the OpenAI Chat Block plugin improves digital accessibility. This ensures that the plugin is inclusive and user-friendly for learners with diverse needs, promoting equal opportunities for all users to engage in meaningful conversations and access educational content.
  6. Context Awareness: Context awareness is a significant improvement in the OpenAI Chat Block plugin. When combined with FilterCodes and some custom prompts, it is possible for GPT to understand the context of the conversation, resulting in more relevant responses. This enhances the quality of interactions and provides users with a more personalized and effective learning experience.

To get started with OpenAI Chat Block, you will need an OpenAI API key. Head over to OpenAI, create an account and then create an API key. When you first create an account, OpenAI will gift you with a free 3 month trial with a value of up to $5 – which is plenty for testing, especially if you use the GPT 3.5 Turbo model. While GPT 4.0 Turbo is more advanced, it is also about 10 times the price per token (and therefore eats up your $5 faster) and at least twice as slow. Be aware that some models had cut-off dates for their knowledge.

On its own, GPT and the OpenAI Chat block know nothing about your Moodle LMS site, your student or the course that they are in. To put it simply, it knows nothing about the conversation’s context. Context plays a crucial role in effective communication and learning. It helps us understand the nuances of a conversation, adapt our responses accordingly, and provide more accurate and relevant information. Recognizing the significance of context, the OpenAI Chat Block plugin can be enhanced using the tags in FilterCodes to become more context-aware within the Moodle LMS environment.

Making OpenAI Chat Block and ChatGPT Smarter with FilterCodes

FilterCodes is a powerful and very popular filter-type plugin for Moodle-based LMS’ that can enhance the OpenAI Chat Block plugin. By combining some useful FilterCodes plain text tags with carefully crafted prompts and adding them to the OpenAI Chat Block’s Source of Truth settings field, we can now provide ChatGPT with some contextual information enabling it to dynamically generate responses within the scope of a Moodle LMS courses. FilterCodes plays a crucial role in making conversations more meaningful and relevant by combining site, course and user meta information with the user’s question.

Here are a few examples of prompts that you can add to OpenAI Chat Block’s settings in the Source of Truth field to help GPT understand the context in which the questions are being asked:

Q: Did you forget our conversation?
A: Each time you reload a page, we start a new conversation.

Q: How can I access my grades?
A: You can access your grades on the [Grades page]({wwwroot}/grade/report/overview.php).

This course is called {coursename}. The course is about "{coursesummary}".{ifstudent} Only answer questions about this topic.{/ifstudent}

Your name is {firstname}.

To reach support, send an email to {supportmail}.

It is currently {siteyear}.

After adding this to the Source of Truth field and saving, FilterCodes will dynamically generate content adding a layer of personalization to the chat experience, making it more engaging and tailored to the individual learner’s context. It will tell chat GPT about the learner and the purpose of the course and even give them a link to their grades.

These are just a few examples of how you can enhance GPT’s understanding of the context from which a question is being asked. You can expand on this technique, and make it even smarter by using the complete list of OpenAI Chat Block Source of Truth prompts.

For more information on FilterCodes tags, see the FilterCodes documentation.

Frequently asked questions

Question: What if I don’t want students to have access?
Answer: Here are the steps to remove permissions for students to see the block:

Step 1: Navigate to the course that contains the OpenAI Chat block.

Step 2: Turn editing on.

Step 3: Click on the gear for the OpenAI Chat block and select Permissions.

Step 4: Add Student to the Prohibited list for the block/moodle:view permission. When you do that, it will automatically be removed from the Roles with Permissions side.

Step 5: That’s it, no more steps. You can test this by switching roles to the Student role.

Unfortunately, there is no way yet to apply this permission globally.

Question: Why do I get an error when I add other custom prompts to the Source of Truth and try to save?
Answer: Prompts must be in either plain text or markdown format. You will get an error if you try to use HTML. See the example above that creates a link to the My Courses page.

Question: After I ask a few questions, why do I see the following error message? An error occurred! Please try again later.
Answer: This happens because you have likely exceeded the GPT context size. This includes all you’re the Source of Truth (including text inserted by FilterCodes), some additional prompts created by OpenAI Chat Block behind the scenes, all your previous questions and all of ChatGPT’s answers. When this happens, the solution is to start a new conversation by reloading the page containing the OpenAI Chat Block. Hopefully a future release of OpenAI Chat Block will provide a better solution than this misleading message. Alternatively, you can increase this limit by choosing a model with a bigger context, like GPT-3.5-Turbo-16k. That said, sometimes you might prefer to limit how much a student can spend on chatting with GPT.

Are you ready to give generative A.I. a try?

The OpenAI Chat Block plugin for Moodle LMS, enhanced with FilterCodes, offers a powerful and transformative learning experience. The plugin leverages GPT’s capabilities to make life a little easier for students, teachers, course creators, managers and administrators. With the recent updates in release 1.7.0, including support for advanced GPT versions, enhanced settings, context awareness with FilterCodes, HTML content display, and improved accessibility, the plugin has become even more versatile and user-friendly.

I encourage you to explore the potential of the OpenAI Chat Block plugin and its integration with Moodle LMS. This can be a real game-changer for education.

Hope you found this information useful. Feel free to share your OpenAI Chat Block Source of Truth prompts in the comments below.

It’s beginning to look a lot like Christmas around here. Time to start baking those Chistmas cookies. See you next month!

Michael Milette

Michael Milette
Follow me

Michael Milette

Michael Milette is the owner and an independent consultant with TNG Consulting Inc. in Canada. He works with government, non-profit organizations, businesses and educational institutions on Moodle-related projects. Michael writes about implementing Moodle LMS, developing in Moodle, Moodle administration, using the FilterCodes plugin (his own project), creating multi-language Moodle implementations and courses, and WCAG 2.1 accessibility.

5 thoughts on “Enhancing E-Learning in Moodle LMS with an AI Chat Block and FilterCodes

  • Anonymous

    Hello Michael,

    I want to use OpenAI chat block, it’s great but I want to place multiple chat block on the same page (Dashboard), if I do this (because I can), I can only write the first chat block. This is I suppose because if selector, but can I make them work independently on the same page somehow?

    Thanks !

  • Anonymous

    Thank you so much for the amazing tutorial on the Moodle plugin “OpenAI Chat Block”! I used my Assistant API key. I uploaded my documents, allowing the assistant to communicate effectively based on these documents. Initially, everything worked correctly, and the chatbot provided one or two responses as expected.
    But, I’m encountering a significant issue where, after a brief period of interaction, the chatbot stops responding. It’s just stuck on loading, and eventually, the entire Moodle system crashes. The only workaround I’ve found so far is to delete cookies and reload the page, which is quite inconvenient.
    Could anyone please offer some help or guidance on this? Is there something I might be missing in the setup, or is it a known issue with a potential fix? Thanks in advance!

  • Anonymous

    Interesting post Michael !
    I think the AI Chat Block could be an interesting way into AI for many Moodle teachers, and students.
    However, my experiences shows me that most do not use tags, much less FilterCode, to enhance the meta data.
    I guess at some point there will be a plugin for Moodle, that can crawl all the data within the Moodle site – and that may then become more compelling?

  • Pingback: Enhancing OpenAI Chat Block for Moodle LMS with FilterCodes - TNG Consulting Inc. Ottawa Canada

Add a reply or comment...