HarpIA Ajax is a Moodle plugin that implements an AJAX interaction with an arbitrary answer provider, such as an external language model.
The actual calls to the language models are performed on the server. Currently, the plugin sends the requests to a (usually local) HTTP server that implements a simple API demonstrated in the examples below (change the host and port accordingly).
GET http://localhost:42774/list
Response:
{
"providers": [
"name of the first provider",
"name of the second provider",
"name of the third provider",
]
}
POST http://localhost:42774/send
Content-Type: application/json
{
"query": "the query",
"answer_provider": "name of the requested provider"
}
Response:
{
"text": "the answer",
"interaction_id": "id_of_this_interaction"
}
The repository [HarpIA Moodle - Answer Providers] contains an implementation of a few answer providers, such as:
- GPT models (via OpenAI API);
- constant utterances (for quick testing purposes).
- Moodle ≥ 4.0.3.
- HarpIA Ajax plugin.