-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MBS-9335 aipurpose_genai: Add purpose for ai based question generation
- Loading branch information
Showing
9 changed files
with
279 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* aipurpose_genai privacy provider class. | ||
* | ||
* @package aipurpose_genai | ||
* @copyright ISB Bayern, 2024 | ||
* @author Dr. Peter Mayer | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace aipurpose_genai\privacy; | ||
|
||
/** | ||
* aipurpose_genai privacy provider class. | ||
* | ||
* @package aipurpose_genai | ||
* @copyright ISB Bayern, 2024 | ||
* @author Dr. Peter Mayer | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class provider implements \core_privacy\local\metadata\null_provider { | ||
|
||
/** | ||
* Get the language string identifier with the component's language | ||
* file to explain why this plugin stores no data. | ||
* | ||
* @return string | ||
*/ | ||
public static function get_reason(): string { | ||
return 'privacy:metadata'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Purpose genai methods | ||
* | ||
* @package aipurpose_genai | ||
* @copyright ISB Bayern, 2024 | ||
* @author Dr. Peter Mayer | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace aipurpose_genai; | ||
|
||
use local_ai_manager\base_purpose; | ||
|
||
/** | ||
* Purpose genai methods | ||
* | ||
* @package aipurpose_genai | ||
* @copyright ISB Bayern, 2024 | ||
* @author Dr. Peter Mayer | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class purpose extends base_purpose { | ||
|
||
/** | ||
* Get the request options. | ||
* | ||
* @param array $options | ||
* @return array | ||
*/ | ||
#[\Override] | ||
public function get_request_options(array $options): array { | ||
|
||
if (array_key_exists('messages', $options)) { | ||
$messages = []; | ||
foreach($options['messages'] as $message) { | ||
switch($message['role']) { | ||
case 'user': | ||
$messages[] = ['sender' => 'user', 'message' => $message['content']]; | ||
break; | ||
case 'system': | ||
$messages[] = ['sender' => 'system', 'message' => $message['content']]; | ||
break; | ||
} | ||
} | ||
return ['conversationcontext' => $messages]; | ||
} | ||
return []; | ||
} | ||
|
||
/** | ||
* Get the additional purpose options | ||
* | ||
* @return array | ||
*/ | ||
#[\Override] | ||
public function get_additional_purpose_options(): array { | ||
return ['messages' => base_purpose::PARAM_ARRAY]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Lang strings for aipurpose_genai - DE. | ||
* | ||
* @package aipurpose_genai | ||
* @copyright ISB Bayern, 2024 | ||
* @author Dr. Peter Mayer | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
$string['pluginname'] = 'Testfragengenerierung'; | ||
$string['privacy:metadata'] = 'Das Zweck-Subplugin "Testfragengenerierung" speichert keine persönlichen Daten.'; | ||
$string['requestcount'] = 'GenAI-Anfragen'; | ||
$string['requestcount_shortened'] = 'GenAI-'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Lang strings for aipurpose_genai - EN. | ||
* | ||
* @package aipurpose_genai | ||
* @copyright ISB Bayern, 2024 | ||
* @author Dr. Peter Mayer | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
$string['pluginname'] = 'Questiongeneration'; | ||
$string['privacy:metadata'] = 'The local ai_manager purpose subplugin "Questiongeneration" does not store any personal data.'; | ||
$string['requestcount'] = 'GenAI requests'; | ||
$string['requestcount_shortened'] = 'GenAI'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Version file for aipurpose_genai. | ||
* | ||
* @package aipurpose_genai | ||
* @copyright ISB Bayern, 2024 | ||
* @author Dr. Peter Mayer | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
$plugin->version = 2024090300; | ||
$plugin->requires = 2023042403; | ||
$plugin->release = '0.0.1'; | ||
$plugin->component = 'aipurpose_genai'; | ||
$plugin->maturity = MATURITY_ALPHA; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.