From c4cafb7eb156fcf8e1d43c87c6bf5e4ad5b10521 Mon Sep 17 00:00:00 2001 From: David Woloszyn Date: Tue, 22 Jul 2025 11:20:27 +1000 Subject: [PATCH] MDL-85967 aiprovider_openai: O1 model settings updated --- .../ai/provider/openai/classes/aimodel/o1.php | 30 +++++++++++++++++++ public/ai/tests/behat/admin.feature | 6 ---- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/public/ai/provider/openai/classes/aimodel/o1.php b/public/ai/provider/openai/classes/aimodel/o1.php index 71454319ee8..9c75b80e72e 100644 --- a/public/ai/provider/openai/classes/aimodel/o1.php +++ b/public/ai/provider/openai/classes/aimodel/o1.php @@ -35,6 +35,36 @@ class o1 extends gpt4o { return 'O1'; } + #[\Override] + public function get_model_settings(): array { + return [ + 'top_p' => [ + 'elementtype' => 'text', + 'label' => [ + 'identifier' => 'settings_top_p', + 'component' => 'aiprovider_openai', + ], + 'type' => PARAM_FLOAT, + 'help' => [ + 'identifier' => 'settings_top_p', + 'component' => 'aiprovider_openai', + ], + ], + 'max_completion_tokens' => [ + 'elementtype' => 'text', + 'label' => [ + 'identifier' => 'settings_max_completion_tokens', + 'component' => 'aiprovider_openai', + ], + 'type' => PARAM_INT, + 'help' => [ + 'identifier' => 'settings_max_completion_tokens', + 'component' => 'aiprovider_openai', + ], + ], + ]; + } + #[\Override] public function model_type(): array { return [self::MODEL_TYPE_TEXT]; diff --git a/public/ai/tests/behat/admin.feature b/public/ai/tests/behat/admin.feature index ef627330915..60d5cc002ba 100644 --- a/public/ai/tests/behat/admin.feature +++ b/public/ai/tests/behat/admin.feature @@ -173,21 +173,15 @@ Feature: An administrator can manage AI subsystem settings | AI model | O1 | And the field "top_p" matches value "" And the field "max_completion_tokens" matches value "" - And the field "frequency_penalty" matches value "" - And the field "presence_penalty" matches value "" # Set model settings for 'O1'. And I set the following fields to these values: | top_p | 21 | | max_completion_tokens | 22 | - | frequency_penalty | 23 | - | presence_penalty | 24 | And I press "Save changes" # Go back and check both models have their settings stored. And I click on the "Settings" link in the table row containing "Generate text" And the field "top_p" matches value "21" And the field "max_completion_tokens" matches value "22" - And the field "frequency_penalty" matches value "23" - And the field "presence_penalty" matches value "24" And I set the following fields to these values: | AI model | GPT-4o | And the field "top_p" matches value "11"