1441 |
ariadna |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - http://moodle.org/
|
|
|
3 |
//
|
|
|
4 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
// it under the terms of the GNU General Public License as published by
|
|
|
6 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
// (at your option) any later version.
|
|
|
8 |
//
|
|
|
9 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
// GNU General Public License for more details.
|
|
|
13 |
//
|
|
|
14 |
// You should have received a copy of the GNU General Public License
|
|
|
15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
|
|
|
17 |
namespace aiprovider_ollama\aimodel;
|
|
|
18 |
|
|
|
19 |
use core_ai\aimodel\base;
|
|
|
20 |
use MoodleQuickForm;
|
|
|
21 |
|
|
|
22 |
/**
|
|
|
23 |
* Llama 3.3 AI model.
|
|
|
24 |
*
|
|
|
25 |
* @package aiprovider_ollama
|
|
|
26 |
* @copyright 2025 Huong Nguyen <huongnv13@gmail.com>
|
|
|
27 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
28 |
*/
|
|
|
29 |
class llama33 extends base implements ollama_base {
|
|
|
30 |
|
|
|
31 |
#[\Override]
|
|
|
32 |
public function get_model_name(): string {
|
|
|
33 |
return 'llama3.3';
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
#[\Override]
|
|
|
37 |
public function get_model_display_name(): string {
|
|
|
38 |
return 'Llama 3.3';
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
#[\Override]
|
|
|
42 |
public function has_model_settings(): bool {
|
|
|
43 |
return true;
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
#[\Override]
|
|
|
47 |
public function add_model_settings(MoodleQuickForm $mform): void {
|
|
|
48 |
$mform->addElement(
|
|
|
49 |
'text',
|
|
|
50 |
'mirostat',
|
|
|
51 |
get_string('settings_mirostat', 'aiprovider_ollama'),
|
|
|
52 |
);
|
|
|
53 |
$mform->setType('mirostat', PARAM_INT);
|
|
|
54 |
$mform->addHelpButton('mirostat', 'settings_mirostat', 'aiprovider_ollama');
|
|
|
55 |
|
|
|
56 |
$mform->addElement(
|
|
|
57 |
'text',
|
|
|
58 |
'temperature',
|
|
|
59 |
get_string('settings_temperature', 'aiprovider_ollama'),
|
|
|
60 |
);
|
|
|
61 |
$mform->setType('temperature', PARAM_FLOAT);
|
|
|
62 |
$mform->addHelpButton('temperature', 'settings_temperature', 'aiprovider_ollama');
|
|
|
63 |
|
|
|
64 |
$mform->addElement(
|
|
|
65 |
'text',
|
|
|
66 |
'seed',
|
|
|
67 |
get_string('settings_seed', 'aiprovider_ollama'),
|
|
|
68 |
);
|
|
|
69 |
$mform->setType('seed', PARAM_INT);
|
|
|
70 |
$mform->addHelpButton('seed', 'settings_seed', 'aiprovider_ollama');
|
|
|
71 |
|
|
|
72 |
$mform->addElement(
|
|
|
73 |
'text',
|
|
|
74 |
'top_k',
|
|
|
75 |
get_string('settings_top_k', 'aiprovider_ollama'),
|
|
|
76 |
);
|
|
|
77 |
$mform->setType('top_k', PARAM_FLOAT);
|
|
|
78 |
$mform->addHelpButton('top_k', 'settings_top_k', 'aiprovider_ollama');
|
|
|
79 |
|
|
|
80 |
$mform->addElement(
|
|
|
81 |
'text',
|
|
|
82 |
'top_p',
|
|
|
83 |
get_string('settings_top_p', 'aiprovider_ollama'),
|
|
|
84 |
);
|
|
|
85 |
$mform->setType('top_p', PARAM_FLOAT);
|
|
|
86 |
$mform->addHelpButton('top_p', 'settings_top_p', 'aiprovider_ollama');
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
#[\Override]
|
|
|
90 |
public function model_type(): int {
|
|
|
91 |
return self::MODEL_TYPE_TEXT;
|
|
|
92 |
}
|
|
|
93 |
}
|