Skip to content

A platform for community discussion. Free, open, simple.

DEV: update preset model versions (#39342)

Sam3b13aaa00333
diff --git a/plugins/discourse-ai/app/models/llm_model.rb b/plugins/discourse-ai/app/models/llm_model.rb
index 64d92218c69..d71940434b6 100644
--- a/plugins/discourse-ai/app/models/llm_model.rb
+++ b/plugins/discourse-ai/app/models/llm_model.rb
@@ -74,7 +74,7 @@ class LlmModel < ActiveRecord::Base
},
effort: {
type: :enum,
- values: %w[default low medium high max],
+ values: ["default", *DiscourseAi::Completions::Endpoints::AnthropicShared::EFFORT_VALUES],
default: "default",
},
disable_native_tools: :checkbox,
@@ -109,7 +109,7 @@ class LlmModel < ActiveRecord::Base
},
effort: {
type: :enum,
- values: %w[default low medium high max],
+ values: ["default", *DiscourseAi::Completions::Endpoints::AnthropicShared::EFFORT_VALUES],
default: "default",
},
disable_temperature: {
@@ -140,7 +140,7 @@ class LlmModel < ActiveRecord::Base
},
effort: {
type: :enum,
- values: %w[default low medium high max],
+ values: ["default", *DiscourseAi::Completions::Endpoints::AnthropicShared::EFFORT_VALUES],
default: "default",
},
disable_native_tools: :checkbox,
diff --git a/plugins/discourse-ai/config/locales/client.en.yml b/plugins/discourse-ai/config/locales/client.en.yml
index 86e1b9b5cc8..c703237f7cc 100644
--- a/plugins/discourse-ai/config/locales/client.en.yml
+++ b/plugins/discourse-ai/config/locales/client.en.yml
@@ -917,19 +917,19 @@ en:
model_description:
none: "General settings that work for most language models"
- anthropic-claude-opus-4-6: "Anthropic's most intelligent model"
+ anthropic-claude-opus-4-7: "Anthropic's most intelligent model"
anthropic-claude-sonnet-4-6: "Optimal balance of speed and cost"
anthropic-claude-haiku-4-5: "Fast and cost-effective"
google-gemini-3-pro: "Google's most intelligent model"
google-gemini-3-flash: "Fast and cost-efficient with multimodal reasoning"
- open_ai-gpt-5-2: "OpenAI's flagship model, well suited for problem solving across domains"
- open_ai-gpt-5-mini: "Provides a balance between intelligence, speed, and cost"
+ open_ai-gpt-5-4: "OpenAI's flagship model, well suited for problem solving across domains"
+ open_ai-gpt-5-4-mini: "Provides a balance between intelligence, speed, and cost"
open_ai-gpt-5-nano: "Fastest, most cost-effective GPT-5 model"
open_router-deepseek-deepseek-v3-2: "DeepSeek's latest high-performance model"
open_router-moonshotai-kimi-k2-5: "Moonshot's multimodal model with vision capabilities"
open_router-x-ai-grok-4-fast: "xAI's flagship model with vision"
- open_router-minimax-minimax-m2-5: "MiniMax's multimodal model with large context"
- open_router-z-ai-glm-5: "Z-AI's multimodal model with vision"
+ open_router-minimax-minimax-m2-7: "MiniMax's multimodal model with large context"
+ open_router-z-ai-glm-5-1: "Z-AI's multimodal model with vision"
open_router-arcee-ai-trinity-large-preview-free: "Free open-source model from Arcee AI"
preseeded_model_description: "Pre-configured open-source model utilizing %{model}"
diff --git a/plugins/discourse-ai/lib/completions/endpoints/anthropic.rb b/plugins/discourse-ai/lib/completions/endpoints/anthropic.rb
index 4b9188d3ead..7056e328896 100644
--- a/plugins/discourse-ai/lib/completions/endpoints/anthropic.rb
+++ b/plugins/discourse-ai/lib/completions/endpoints/anthropic.rb
@@ -60,7 +60,9 @@ module DiscourseAi
# effort parameter
effort = llm_model.lookup_custom_param("effort")
- options[:output_config] = { effort: effort } if %w[low medium high max].include?(effort)
+ options[:output_config] = { effort: effort } if AnthropicShared::EFFORT_VALUES.include?(
+ effort,
+ )
options
end
diff --git a/plugins/discourse-ai/lib/completions/endpoints/anthropic_shared.rb b/plugins/discourse-ai/lib/completions/endpoints/anthropic_shared.rb
index d85c965a59e..e27434aa780 100644
--- a/plugins/discourse-ai/lib/completions/endpoints/anthropic_shared.rb
+++ b/plugins/discourse-ai/lib/completions/endpoints/anthropic_shared.rb
@@ -4,6 +4,8 @@ module DiscourseAi
module Completions
module Endpoints
module AnthropicShared
+ EFFORT_VALUES = %w[low medium high xhigh max].freeze
+
def normalize_model_params(model_params)
model_params = model_params.dup
diff --git a/plugins/discourse-ai/lib/completions/endpoints/aws_bedrock.rb b/plugins/discourse-ai/lib/completions/endpoints/aws_bedrock.rb
index 6a597b4e806..bc352b5f7ac 100644
--- a/plugins/discourse-ai/lib/completions/endpoints/aws_bedrock.rb
+++ b/plugins/discourse-ai/lib/completions/endpoints/aws_bedrock.rb
@@ -38,9 +38,9 @@ module DiscourseAi
# effort parameter
effort = llm_model.lookup_custom_param("effort")
- result[:output_config] = { effort: effort } if %w[low medium high max].include?(
- effort,
- )
+ if AnthropicShared::EFFORT_VALUES.include?(effort)
+ result[:output_config] = { effort: effort }
+ end
result
else
diff --git a/plugins/discourse-ai/lib/completions/endpoints/aws_bedrock_converse.rb b/plugins/discourse-ai/lib/completions/endpoints/aws_bedrock_converse.rb
index 0eabc0b1a75..52b52077802 100644
--- a/plugins/discourse-ai/lib/completions/endpoints/aws_bedrock_converse.rb
+++ b/plugins/discourse-ai/lib/completions/endpoints/aws_bedrock_converse.rb
@@ -231,7 +231,9 @@ module DiscourseAi
end
effort = llm_model.lookup_custom_param("effort")
- options[:output_config] = { effort: effort } if %w[low medium high max].include?(effort)
+ if AnthropicShared::EFFORT_VALUES.include?(effort)
+ options[:output_config] = { effort: effort }
+ end
options
end
diff --git a/plugins/discourse-ai/lib/completions/llm_presets.rb b/plugins/discourse-ai/lib/completions/llm_presets.rb
index a0d998ad7c4..114b0856253 100644
--- a/plugins/discourse-ai/lib/completions/llm_presets.rb
+++ b/plugins/discourse-ai/lib/completions/llm_presets.rb
@@ -33,9 +33,9 @@ module DiscourseAi
id: "anthropic",
models: [
model(
- name: "claude-opus-4-6",
+ name: "claude-opus-4-7",
tokens: 200_000,
- display_name: "Claude Opus 4.6",
+ display_name: "Claude Opus 4.7",
max_output_tokens: 128_000,
input_cost: 5.0,
cached_input_cost: 0.50,
@@ -111,9 +111,9 @@ module DiscourseAi
id: "open_ai",
models: [
model(
- name: "gpt-5.2",
+ name: "gpt-5.4",
tokens: 400_000,
- display_name: "GPT-5.2",
+ display_name: "GPT-5.4",
max_output_tokens: 128_000,
input_cost: 1.25,
cached_input_cost: 0.125,
@@ -122,13 +122,14 @@ module DiscourseAi
endpoint: "https://api.openai.com/v1/responses",
),
model(
- name: "gpt-5-mini",
+ name: "gpt-5.4-mini",
tokens: 400_000,
- display_name: "GPT-5 Mini",
+ display_name: "GPT-5.4 Mini",
max_output_tokens: 128_000,
- input_cost: 0.25,
- cached_input_cost: 0.025,
- output_cost: 2.0,
+ input_cost: 0.75,
+ cached_input_cost: 0.075,
+ output_cost: 4.50,
+ vision_enabled: true,
endpoint: "https://api.openai.com/v1/responses",
),
model(
@@ -179,21 +180,21 @@ module DiscourseAi
vision_enabled: true,
),
model(
- name: "minimax/minimax-m2.5",
- tokens: 196_608,
- display_name: "MiniMax M2.5",
- max_output_tokens: 65_536,
+ name: "minimax/minimax-m2.7",
+ tokens: 205_000,
+ display_name: "MiniMax M2.7",
+ max_output_tokens: 131_000,
input_cost: 0.30,
output_cost: 1.20,
vision_enabled: true,
),
model(
- name: "z-ai/glm-5",
- tokens: 204_800,
- display_name: "Z-AI GLM-5",
+ name: "z-ai/glm-5.1",
+ tokens: 203_000,
+ display_name: "Z-AI GLM-5.1",
max_output_tokens: 131_072,
- input_cost: 0.30,
- output_cost: 2.55,
+ input_cost: 0.95,
+ output_cost: 3.15,
vision_enabled: true,
),
model(
diff --git a/plugins/discourse-ai/spec/lib/completions/endpoints/anthropic_spec.rb b/plugins/discourse-ai/spec/lib/completions/endpoints/anthropic_spec.rb
index bd307e38c45..b6343e9f824 100644
--- a/plugins/discourse-ai/spec/lib/completions/endpoints/anthropic_spec.rb
+++ b/plugins/discourse-ai/spec/lib/completions/endpoints/anthropic_spec.rb
@@ -1753,6 +1753,40 @@ RSpec.describe DiscourseAi::Completions::Endpoints::Anthropic do
expect(parsed_body.dig(:output_config, :effort)).to eq("max")
end
+ it "includes effort in output_config when set to xhigh" do
+ model.update!(provider_params: { effort: "xhigh" })
+
+ parsed_body = nil
+ stub_request(:post, url).with(
+ body:
+ proc do |req_body|
+ parsed_body = JSON.parse(req_body, symbolize_names: true)
+ true
+ end,
+ headers: {
+ "Content-Type" => "application/json",
+ "X-Api-Key" => "123",
+ "Anthropic-Version" => "2023-06-01",
+ },
+ ).to_return(
+ status: 200,
+ body: {
+ id: "msg_123",
+ type: "message",
+ role: "assistant",
+ content: [{ type: "text", text: "test response" }],
+ model: "claude-3-opus-20240229",
+ usage: {
+ input_tokens: 10,
+ output_tokens: 5,
+ },
+ }.to_json,
+ )
+
+ llm.generate(prompt, user: Discourse.system_user)
+ expect(parsed_body.dig(:output_config, :effort)).to eq("xhigh")
+ end
+
it "includes effort in output_config when set to low, medium, or high" do
model.update!(provider_params: { effort: "high" })
diff --git a/plugins/discourse-ai/spec/lib/completions/endpoints/aws_bedrock_converse_spec.rb b/plugins/discourse-ai/spec/lib/completions/endpoints/aws_bedrock_converse_spec.rb
index c54c5e748ca..4468bafeb46 100644
--- a/plugins/discourse-ai/spec/lib/completions/endpoints/aws_bedrock_converse_spec.rb
+++ b/plugins/discourse-ai/spec/lib/completions/endpoints/aws_bedrock_converse_spec.rb
@@ -144,6 +144,16 @@ RSpec.describe DiscourseAi::Completions::Endpoints::AwsBedrockConverse do
options = endpoint.default_options(dialect)
expect(options[:output_config]).to eq({ effort: "high" })
end
+
+ it "configures xhigh effort" do
+ model.provider_params["effort"] = "xhigh"
+
+ prompt = DiscourseAi::Completions::Prompt.new("hello")
+ dialect = DiscourseAi::Completions::Dialects::Converse.new(prompt, model)
+
+ options = endpoint.default_options(dialect)
+ expect(options[:output_config]).to eq({ effort: "xhigh" })
+ end
end
describe "non-streaming completion" do
diff --git a/plugins/discourse-ai/spec/lib/completions/endpoints/aws_bedrock_spec.rb b/plugins/discourse-ai/spec/lib/completions/endpoints/aws_bedrock_spec.rb
index 0e51937e449..3422cfcc1f6 100644
--- a/plugins/discourse-ai/spec/lib/completions/endpoints/aws_bedrock_spec.rb
+++ b/plugins/discourse-ai/spec/lib/completions/endpoints/aws_bedrock_spec.rb
@@ -1442,6 +1442,36 @@ RSpec.describe DiscourseAi::Completions::Endpoints::AwsBedrock do
expect(request_body.dig("output_config", "effort")).to eq("max")
end
+ it "includes effort in output_config when set to xhigh" do
+ model.update!(provider_params: { access_key_id: "123", region: "us-east-1", effort: "xhigh" })
+
+ proxy = DiscourseAi::Completions::Llm.proxy(model)
+ request = nil
+
+ content = {
+ content: [text: "test response"],
+ usage: {
+ input_tokens: 10,
+ output_tokens: 5,
+ },
+ }.to_json
+
+ stub_request(
+ :post,
+ "https://bedrock-runtime.us-east-1.amazonaws.com/model/anthropic.claude-3-sonnet-20240229-v1:0/invoke",
+ )
+ .with do |inner_request|
+ request = inner_request
+ true
+ end
+ .to_return(status: 200, body: content)
+
+ proxy.generate("test prompt", user: user)
+
+ request_body = JSON.parse(request.body)
+ expect(request_body.dig("output_config", "effort")).to eq("xhigh")
+ end
+
it "includes effort in output_config when set to low, medium, or high" do
model.update!(
provider_params: {
diff --git a/plugins/discourse-ai/spec/system/llms/ai_llm_spec.rb b/plugins/discourse-ai/spec/system/llms/ai_llm_spec.rb
index 16aaf03c133..33555c1a1a0 100644
--- a/plugins/discourse-ai/spec/system/llms/ai_llm_spec.rb
+++ b/plugins/discourse-ai/spec/system/llms/ai_llm_spec.rb
@@ -16,7 +16,7 @@ RSpec.describe "Managing LLM configurations" do
it "correctly sets defaults" do
visit "/admin/plugins/discourse-ai/ai-llms"
- find("[data-llm-id='anthropic-claude-opus-4-6'] button").click()
+ find("[data-llm-id='anthropic-claude-opus-4-7'] button").click()
secret_selector = PageObjects::Components::SelectKit.new(".ai-secret-selector__dropdown")
secret_selector.expand
@@ -32,9 +32,9 @@ RSpec.describe "Managing LLM configurations" do
expect(llm.api_key).to eq("abcd")
preset = DiscourseAi::Completions::Llm.presets.find { |p| p[:id] == "anthropic" }
- model_preset = preset[:models].find { |m| m[:name] == "claude-opus-4-6" }
+ model_preset = preset[:models].find { |m| m[:name] == "claude-opus-4-7" }
- expect(llm.name).to eq("claude-opus-4-6")
+ expect(llm.name).to eq("claude-opus-4-7")
expect(llm.url).to eq(preset[:endpoint])
expect(llm.tokenizer).to eq(preset[:tokenizer].to_s)
expect(llm.max_prompt_tokens.to_i).to eq(model_preset[:tokens])