With the recent success of ChatGPT, it seems possible to start including some nice helpers in Chamilo. This feature request for a plugin goes in that direction.
ai_helper
To maintain the neutrality in our plugin, and the possibility to later support other similar APIs, we'll just call it "ai_helper", with a README.md of this kind:
The AI helper plugin integrates into parts of the platform that seem the most useful to teachers/trainers or learners. Because available Artificial Intelligence (to use the broad term) now allows us to ask for meaningful texts to be generated, we can use those systems to pre-generate content, then let the teacher/trainer review the content before publication.
Visual integration
This first version helps the teacher/trainer generate questions on a specific topic through a method similar to the Aiken importer. To avoid major changes in Chamilo, we integrate it into the bottmo of the Aiken import page by allowing the teacher/trainer to give a prompt and receive an Aiken-formatted answer that we then import as if it had been uploaded.
We only ask the user for a topic and a number of questions (between one and twenty), then add the following context, wich works with ChatGPT:
Generate %d multiple choice questions in Aiken format in the %s language about "%s", making sure there is a 'ANSWER' line for each question. 'ANSWER' lines must only mention the letter of the correct answer, not the full answer text and not a parenthesis. The response line must not be separated from the last answer by a blank line. Each answer starts with an uppercase letter, a dot, one space and the answer text. Include an 'ANSWER_EXPLANATION' line after the 'ANSWER' line for each question. The terms between single quotes above must not be translated. There must be a blank line between each question.
Where:
%d is the number of questions obtained from the form
%s is the language of the course (ChatGPT does not work in Arabic or Chinese, so expect issues there)
%s is the topic (which does not need to be in English to work)
Plugin settings
The plugin should ask for an AI API to connect to (dropdown), and an API key. Because endpoints are likely to change over time, choosing an API should pre-fill an "endpoint" field (hardcoded in the plugin), but let the admin change it.
An optional "Organization ID" field should be offered in case the account is from an organization.
We should use a "temperature" of 0.2 or so so allow for some changes between several runs of the same request.
"max_tokens" should be 2000 or so, for 20 answers, and the model should be "text-davinci-003" for this first version.
In future versions, these should be configurable, but for now we can leave them hardcoded (they are specific to ChatGPT).
Doing the requests
On the Aiken import page, allow launching the requests in AJAX and prepare for the format returned to be a message (not an Aiken) by showing the returned text and asking the user explicitly to confirm that (s)he would like to import this generated set of questions, and allow her/him to edit the text (simple textarea) before confirming.
When clicking the submit button, process the textarea as if it was an uploaded Aiken.
With the recent success of ChatGPT, it seems possible to start including some nice helpers in Chamilo. This feature request for a plugin goes in that direction.
ai_helper
To maintain the neutrality in our plugin, and the possibility to later support other similar APIs, we'll just call it "ai_helper", with a README.md of this kind:
Visual integration
This first version helps the teacher/trainer generate questions on a specific topic through a method similar to the Aiken importer. To avoid major changes in Chamilo, we integrate it into the bottmo of the Aiken import page by allowing the teacher/trainer to give a prompt and receive an Aiken-formatted answer that we then import as if it had been uploaded.
We only ask the user for a topic and a number of questions (between one and twenty), then add the following context, wich works with ChatGPT:
Where:
Plugin settings
The plugin should ask for an AI API to connect to (dropdown), and an API key. Because endpoints are likely to change over time, choosing an API should pre-fill an "endpoint" field (hardcoded in the plugin), but let the admin change it. An optional "Organization ID" field should be offered in case the account is from an organization.
API communication
We'll start with ChatGPT's API, and with the default settings for everything. We can later improve on that plugin by adding more settings. https://beta.openai.com/docs/api-reference/authentication
We should use a "temperature" of 0.2 or so so allow for some changes between several runs of the same request. "max_tokens" should be 2000 or so, for 20 answers, and the model should be "text-davinci-003" for this first version. In future versions, these should be configurable, but for now we can leave them hardcoded (they are specific to ChatGPT).
Doing the requests
On the Aiken import page, allow launching the requests in AJAX and prepare for the format returned to be a message (not an Aiken) by showing the returned text and asking the user explicitly to confirm that (s)he would like to import this generated set of questions, and allow her/him to edit the text (simple textarea) before confirming.
When clicking the submit button, process the textarea as if it was an uploaded Aiken.