Skip to content

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

FEATURE: Ship explicit thinking effort defaults for AI agents (#45343)

Rafael dos Santos Silva837060724ce2
diff --git a/plugins/discourse-ai/lib/agents/admin_dashboard_highlights.rb b/plugins/discourse-ai/lib/agents/admin_dashboard_highlights.rb
index fff7ae1b799..0815a49113b 100644
--- a/plugins/discourse-ai/lib/agents/admin_dashboard_highlights.rb
+++ b/plugins/discourse-ai/lib/agents/admin_dashboard_highlights.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def tools
[]
end
diff --git a/plugins/discourse-ai/lib/agents/artist.rb b/plugins/discourse-ai/lib/agents/artist.rb
index 3f7bc37261b..57a1dccb040 100644
--- a/plugins/discourse-ai/lib/agents/artist.rb
+++ b/plugins/discourse-ai/lib/agents/artist.rb
@@ -3,6 +3,10 @@
module DiscourseAi
module Agents
class Artist < Agent
+ def thinking_effort
+ "low"
+ end
+
def tools
# Only include Tools::Image if custom image generation tools are configured
Tools::Tool.available_custom_image_tools.present? ? [Tools::Image] : []
diff --git a/plugins/discourse-ai/lib/agents/ask_ai_reporter.rb b/plugins/discourse-ai/lib/agents/ask_ai_reporter.rb
index 412b4ffdace..b6a848305f4 100644
--- a/plugins/discourse-ai/lib/agents/ask_ai_reporter.rb
+++ b/plugins/discourse-ai/lib/agents/ask_ai_reporter.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def response_format
[
{ "key" => "summary", "type" => "string" },
diff --git a/plugins/discourse-ai/lib/agents/ask_ai_synthesis.rb b/plugins/discourse-ai/lib/agents/ask_ai_synthesis.rb
index df990ad2660..cf6e2539fc9 100644
--- a/plugins/discourse-ai/lib/agents/ask_ai_synthesis.rb
+++ b/plugins/discourse-ai/lib/agents/ask_ai_synthesis.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def response_format
# Abstaining first avoids streaming an answer that would be retracted;
# the short title and then the answer follow so both stream early.
diff --git a/plugins/discourse-ai/lib/agents/chat_thread_titler.rb b/plugins/discourse-ai/lib/agents/chat_thread_titler.rb
index 61d30c9e548..4ec927b6de5 100644
--- a/plugins/discourse-ai/lib/agents/chat_thread_titler.rb
+++ b/plugins/discourse-ai/lib/agents/chat_thread_titler.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT.strip
You are an advanced chat thread title generator. Analyze a given conversation and produce a concise,
diff --git a/plugins/discourse-ai/lib/agents/concept_deduplicator.rb b/plugins/discourse-ai/lib/agents/concept_deduplicator.rb
index ef90ca16d2b..d9689bc399a 100644
--- a/plugins/discourse-ai/lib/agents/concept_deduplicator.rb
+++ b/plugins/discourse-ai/lib/agents/concept_deduplicator.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT.strip
You will be given a list of machine-generated tags.
diff --git a/plugins/discourse-ai/lib/agents/concept_finder.rb b/plugins/discourse-ai/lib/agents/concept_finder.rb
index 068abc06a72..a1c0883a2e6 100644
--- a/plugins/discourse-ai/lib/agents/concept_finder.rb
+++ b/plugins/discourse-ai/lib/agents/concept_finder.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
existing_concepts = DiscourseAi::InferredConcepts::Manager.new.list_concepts(limit: 100)
existing_concepts_text = ""
diff --git a/plugins/discourse-ai/lib/agents/concept_matcher.rb b/plugins/discourse-ai/lib/agents/concept_matcher.rb
index 9196ae98f93..8985d895aa2 100644
--- a/plugins/discourse-ai/lib/agents/concept_matcher.rb
+++ b/plugins/discourse-ai/lib/agents/concept_matcher.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT.strip
You are an advanced concept matching system that determines which concepts from a provided list are relevant to a piece of content.
diff --git a/plugins/discourse-ai/lib/agents/content_creator.rb b/plugins/discourse-ai/lib/agents/content_creator.rb
index af0e36af5e2..a8f7e78ce25 100644
--- a/plugins/discourse-ai/lib/agents/content_creator.rb
+++ b/plugins/discourse-ai/lib/agents/content_creator.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT.strip
You are a content creator for a forum. The forum title and description is as follows:
diff --git a/plugins/discourse-ai/lib/agents/custom_prompt.rb b/plugins/discourse-ai/lib/agents/custom_prompt.rb
index 75350aff52b..38b8e55cd82 100644
--- a/plugins/discourse-ai/lib/agents/custom_prompt.rb
+++ b/plugins/discourse-ai/lib/agents/custom_prompt.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT.strip
You are a helpful assistant. I will give you instructions inside <input></input> XML tags.
diff --git a/plugins/discourse-ai/lib/agents/designer.rb b/plugins/discourse-ai/lib/agents/designer.rb
index 1427f0f7c24..2141f474cb7 100644
--- a/plugins/discourse-ai/lib/agents/designer.rb
+++ b/plugins/discourse-ai/lib/agents/designer.rb
@@ -3,6 +3,10 @@
module DiscourseAi
module Agents
class Designer < Agent
+ def thinking_effort
+ "low"
+ end
+
def tools
# Only include image tools if custom image generation tools are configured
if Tools::Tool.available_custom_image_tools.present?
diff --git a/plugins/discourse-ai/lib/agents/discover.rb b/plugins/discourse-ai/lib/agents/discover.rb
index c18fd8c2d32..204d78ad95a 100644
--- a/plugins/discourse-ai/lib/agents/discover.rb
+++ b/plugins/discourse-ai/lib/agents/discover.rb
@@ -7,6 +7,10 @@ module DiscourseAi
true
end
+ def thinking_effort
+ "none"
+ end
+
def tools
[Tools::Read, Tools::Search]
end
diff --git a/plugins/discourse-ai/lib/agents/emotion_classifier.rb b/plugins/discourse-ai/lib/agents/emotion_classifier.rb
index e7d5cdbba0d..7c053cd3670 100644
--- a/plugins/discourse-ai/lib/agents/emotion_classifier.rb
+++ b/plugins/discourse-ai/lib/agents/emotion_classifier.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT
You classify Discourse forum posts by emotion.
diff --git a/plugins/discourse-ai/lib/agents/github_helper.rb b/plugins/discourse-ai/lib/agents/github_helper.rb
index bb40f29e993..a1c32b560d9 100644
--- a/plugins/discourse-ai/lib/agents/github_helper.rb
+++ b/plugins/discourse-ai/lib/agents/github_helper.rb
@@ -3,6 +3,10 @@
module DiscourseAi
module Agents
class GithubHelper < Agent
+ def thinking_effort
+ "medium"
+ end
+
def tools
[
Tools::GithubFileContent,
diff --git a/plugins/discourse-ai/lib/agents/image_captioner.rb b/plugins/discourse-ai/lib/agents/image_captioner.rb
index 40cb3c27ff0..8ebe14627e1 100644
--- a/plugins/discourse-ai/lib/agents/image_captioner.rb
+++ b/plugins/discourse-ai/lib/agents/image_captioner.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def self.vision_enabled
true
end
diff --git a/plugins/discourse-ai/lib/agents/locale_detector.rb b/plugins/discourse-ai/lib/agents/locale_detector.rb
index 40f7c3019ff..af4e11a7322 100644
--- a/plugins/discourse-ai/lib/agents/locale_detector.rb
+++ b/plugins/discourse-ai/lib/agents/locale_detector.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
STATIC_LANGUAGE_CODES = %w[en es fr de it pt-BR ru zh-CN ja ko].freeze
def system_prompt
diff --git a/plugins/discourse-ai/lib/agents/markdown_table_generator.rb b/plugins/discourse-ai/lib/agents/markdown_table_generator.rb
index af9e73c80e4..bdc1a4e4522 100644
--- a/plugins/discourse-ai/lib/agents/markdown_table_generator.rb
+++ b/plugins/discourse-ai/lib/agents/markdown_table_generator.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT.strip
You are a markdown table formatter, I will provide you text inside <input></input> XML tags and you will format it into a markdown table
diff --git a/plugins/discourse-ai/lib/agents/post_illustrator.rb b/plugins/discourse-ai/lib/agents/post_illustrator.rb
index caff044db7e..b6bf2520216 100644
--- a/plugins/discourse-ai/lib/agents/post_illustrator.rb
+++ b/plugins/discourse-ai/lib/agents/post_illustrator.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT.strip
You are an AI assistant that creates images to illustrate posts.
diff --git a/plugins/discourse-ai/lib/agents/post_raw_translator.rb b/plugins/discourse-ai/lib/agents/post_raw_translator.rb
index 74ab04d1e54..4e45d16accb 100644
--- a/plugins/discourse-ai/lib/agents/post_raw_translator.rb
+++ b/plugins/discourse-ai/lib/agents/post_raw_translator.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT.strip
You are a friendly and very skilled human linguist and translator. Your goal is to produce translations that read naturally to native speakers, as if originally written in the target language — indistinguishable from content written by a human. Follow these instructions strictly:
diff --git a/plugins/discourse-ai/lib/agents/proofreader.rb b/plugins/discourse-ai/lib/agents/proofreader.rb
index 005195f8e4f..8fcb4829fa8 100644
--- a/plugins/discourse-ai/lib/agents/proofreader.rb
+++ b/plugins/discourse-ai/lib/agents/proofreader.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT.strip
You are a markdown proofreader. You correct egregious typos and phrasing issues but keep the user's original voice.
diff --git a/plugins/discourse-ai/lib/agents/report_runner.rb b/plugins/discourse-ai/lib/agents/report_runner.rb
index 924646d3394..c0587e3ae28 100644
--- a/plugins/discourse-ai/lib/agents/report_runner.rb
+++ b/plugins/discourse-ai/lib/agents/report_runner.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT
You are ForumBot, a backend AI information processor and writer, powered by an AI model capable of generating responses over 4000 words.
diff --git a/plugins/discourse-ai/lib/agents/researcher.rb b/plugins/discourse-ai/lib/agents/researcher.rb
index 9d249a86182..431f4c81ad3 100644
--- a/plugins/discourse-ai/lib/agents/researcher.rb
+++ b/plugins/discourse-ai/lib/agents/researcher.rb
@@ -3,6 +3,10 @@
module DiscourseAi
module Agents
class Researcher < Agent
+ def thinking_effort
+ "medium"
+ end
+
def tools
[Tools::Google, Tools::WebBrowser]
end
diff --git a/plugins/discourse-ai/lib/agents/sentiment_classifier.rb b/plugins/discourse-ai/lib/agents/sentiment_classifier.rb
index 46f3d6ddfff..7ae1a774175 100644
--- a/plugins/discourse-ai/lib/agents/sentiment_classifier.rb
+++ b/plugins/discourse-ai/lib/agents/sentiment_classifier.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT
You classify Discourse forum posts by sentiment.
diff --git a/plugins/discourse-ai/lib/agents/settings_explorer.rb b/plugins/discourse-ai/lib/agents/settings_explorer.rb
index e394b0ea08b..d43f6d66c05 100644
--- a/plugins/discourse-ai/lib/agents/settings_explorer.rb
+++ b/plugins/discourse-ai/lib/agents/settings_explorer.rb
@@ -3,6 +3,10 @@
module DiscourseAi
module Agents
class SettingsExplorer < Agent
+ def thinking_effort
+ "low"
+ end
+
def tools
[
Tools::SettingContext,
diff --git a/plugins/discourse-ai/lib/agents/short_summarizer.rb b/plugins/discourse-ai/lib/agents/short_summarizer.rb
index 7342e558540..99f6db4df1d 100644
--- a/plugins/discourse-ai/lib/agents/short_summarizer.rb
+++ b/plugins/discourse-ai/lib/agents/short_summarizer.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT.strip
You are an advanced summarization bot. Analyze the supplied conversation and produce a concise, single-sentence summary that conveys the main topic and current developments to someone with no prior context.
diff --git a/plugins/discourse-ai/lib/agents/short_text_translator.rb b/plugins/discourse-ai/lib/agents/short_text_translator.rb
index 7b28f6e305c..ac5b29fdba2 100644
--- a/plugins/discourse-ai/lib/agents/short_text_translator.rb
+++ b/plugins/discourse-ai/lib/agents/short_text_translator.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT.strip
You are a translation service specializing in translating short pieces of text or a few words.
diff --git a/plugins/discourse-ai/lib/agents/smart_dates.rb b/plugins/discourse-ai/lib/agents/smart_dates.rb
index 950b9bd54b5..2bab077773f 100644
--- a/plugins/discourse-ai/lib/agents/smart_dates.rb
+++ b/plugins/discourse-ai/lib/agents/smart_dates.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT.strip
You are a date and time formatter for Discourse posts. Convert natural language time references into date placeholders.
diff --git a/plugins/discourse-ai/lib/agents/spam_detector.rb b/plugins/discourse-ai/lib/agents/spam_detector.rb
index ef8c3ad0812..4b1e15193f0 100644
--- a/plugins/discourse-ai/lib/agents/spam_detector.rb
+++ b/plugins/discourse-ai/lib/agents/spam_detector.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT
You are a spam detection system. Analyze the following post content and context.
diff --git a/plugins/discourse-ai/lib/agents/summarizer.rb b/plugins/discourse-ai/lib/agents/summarizer.rb
index a735103d52c..30d220a13cf 100644
--- a/plugins/discourse-ai/lib/agents/summarizer.rb
+++ b/plugins/discourse-ai/lib/agents/summarizer.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT.strip
You are an advanced summarization bot that generates concise, coherent summaries of provided text.
diff --git a/plugins/discourse-ai/lib/agents/titles_generator.rb b/plugins/discourse-ai/lib/agents/titles_generator.rb
index e110835d582..8376146eeb4 100644
--- a/plugins/discourse-ai/lib/agents/titles_generator.rb
+++ b/plugins/discourse-ai/lib/agents/titles_generator.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT.strip
I want you to act as a title generator for written pieces. I will provide you with a text,
diff --git a/plugins/discourse-ai/lib/agents/topic_title_translator.rb b/plugins/discourse-ai/lib/agents/topic_title_translator.rb
index 8fce41b405c..a9c9b06174b 100644
--- a/plugins/discourse-ai/lib/agents/topic_title_translator.rb
+++ b/plugins/discourse-ai/lib/agents/topic_title_translator.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT.strip
You are a friendly human linguist and translator specializing in translating forum post titles. Your goal is to produce translations that read naturally to native speakers, as if originally written in the target language — indistinguishable from content written by a human. Follow these guidelines:
diff --git a/plugins/discourse-ai/lib/agents/translator.rb b/plugins/discourse-ai/lib/agents/translator.rb
index 4bbd1ca5520..e943243ed39 100644
--- a/plugins/discourse-ai/lib/agents/translator.rb
+++ b/plugins/discourse-ai/lib/agents/translator.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT.strip
I want you to act as an {user_language} translator. I will write to you in any language and you will
diff --git a/plugins/discourse-ai/lib/agents/tutor.rb b/plugins/discourse-ai/lib/agents/tutor.rb
index 89a32c2d9b6..7baaa4093b2 100644
--- a/plugins/discourse-ai/lib/agents/tutor.rb
+++ b/plugins/discourse-ai/lib/agents/tutor.rb
@@ -7,6 +7,10 @@ module DiscourseAi
false
end
+ def thinking_effort
+ "none"
+ end
+
def system_prompt
<<~PROMPT.strip
You are a tutor explaining a term to a student in a specific context.
diff --git a/plugins/discourse-ai/lib/agents/web_artifact_creator.rb b/plugins/discourse-ai/lib/agents/web_artifact_creator.rb
index d116d8d4939..9137e1ebd34 100644
--- a/plugins/discourse-ai/lib/agents/web_artifact_creator.rb
+++ b/plugins/discourse-ai/lib/agents/web_artifact_creator.rb
@@ -3,6 +3,10 @@
module DiscourseAi
module Agents
class WebArtifactCreator < Agent
+ def thinking_effort
+ "medium"
+ end
+
def tools
[Tools::CreateArtifact, Tools::UpdateArtifact, Tools::ReadArtifact]
end
diff --git a/plugins/discourse-ai/lib/completions/endpoints/open_ai_shared.rb b/plugins/discourse-ai/lib/completions/endpoints/open_ai_shared.rb
index 799dfb8d90b..d41585859d3 100644
--- a/plugins/discourse-ai/lib/completions/endpoints/open_ai_shared.rb
+++ b/plugins/discourse-ai/lib/completions/endpoints/open_ai_shared.rb
@@ -24,6 +24,7 @@ module DiscourseAi
# effort they support.
OPEN_AI_LOW_EFFORT_FLOOR_MODELS = %w[gpt-6-astra gpt-6.1-sol].freeze
OPEN_AI_MODEL_SNAPSHOT_SUFFIX = /-\d{4}-\d{2}-\d{2}\z/
+ OPEN_AI_REASONING_MODEL_NAME = /\A(o\d|gpt-[5-9])/
OPEN_AI_REASONING_OUTPUT_RESERVATION = 25_000
# "minimal" isn't a distinct tier on every OpenAI reasoning model and can
# be rejected outright, so collapse it into "low".
@@ -97,6 +98,9 @@ module DiscourseAi
DiscourseAi::Completions::ThinkingConfig.normalize_effort(
model_params[:thinking_effort],
)
+ # Non-reasoning models (and OpenAI-compatible hosts) reject the parameter,
+ # so agent-level efforts only apply where the model can reason.
+ effort = nil if !reasoning_model?
effort ||= legacy_reasoning_effort
if effort.blank?
@@ -169,6 +173,11 @@ module DiscourseAi
OPEN_AI_MAX_TO_XHIGH_MODELS.include?(normalized_model_name)
end
+ def reasoning_model?
+ legacy_reasoning_effort.present? || reasoning_mode.present? ||
+ normalized_model_name.match?(OPEN_AI_REASONING_MODEL_NAME)
+ end
+
def low_effort_floor_model?
OPEN_AI_LOW_EFFORT_FLOOR_MODELS.include?(normalized_model_name)
end
diff --git a/plugins/discourse-ai/spec/lib/completions/endpoints/open_ai_spec.rb b/plugins/discourse-ai/spec/lib/completions/endpoints/open_ai_spec.rb
index 066d05a8eac..b8e66231100 100644
--- a/plugins/discourse-ai/spec/lib/completions/endpoints/open_ai_spec.rb
+++ b/plugins/discourse-ai/spec/lib/completions/endpoints/open_ai_spec.rb
@@ -1652,6 +1652,8 @@ TEXT
end
it "collapses minimal to low since some models reject it outright" do
+ model.update!(name: "gpt-5")
+
parsed_body = nil
stub_request(:post, "https://api.openai.com/v1/chat/completions").with(
body:
@@ -1771,6 +1773,43 @@ TEXT
expect(parsed_body[:reasoning_effort]).to eq("none")
end
+ %w[gpt-4.1-mini gpt-35-turbo].each do |model_name|
+ it "omits per-call efforts for #{model_name}, which does not reason" do
+ model.update!(name: model_name)
+
+ bodies = []
+ stub_request(:post, "https://api.openai.com/v1/chat/completions").with(
+ body:
+ proc do |req_body|
+ bodies << JSON.parse(req_body, symbolize_names: true)
+ true
+ end,
+ ).to_return(status: 200, body: { choices: [{ message: { content: "test" } }] }.to_json)
+
+ endpoint.perform_completion!(dialect, user, { thinking_effort: "none" })
+ endpoint.perform_completion!(dialect, user, { thinking_effort: "medium" })
+
+ expect(bodies.map { |body| body.key?(:reasoning_effort) }).to eq([false, false])
+ end
+ end
+
+ it "sends a per-call none to reasoning models" do
+ model.update!(name: "gpt-5-mini")
+
+ parsed_body = nil
+ stub_request(:post, "https://api.openai.com/v1/chat/completions").with(
+ body:
+ proc do |req_body|
+ parsed_body = JSON.parse(req_body, symbolize_names: true)
+ true
+ end,
+ ).to_return(status: 200, body: { choices: [{ message: { content: "test" } }] }.to_json)
+
+ endpoint.perform_completion!(dialect, user, { thinking_effort: "none" })
+
+ expect(parsed_body[:reasoning_effort]).to eq("none")
+ end
+
it "uses native max effort for GPT-6 Astra" do
model.update!(name: "gpt-6-astra")
@@ -1831,13 +1870,15 @@ TEXT
end
it "reserves OpenAI recommended output room for reasoning when no token cap is configured" do
+ model.update!(name: "gpt-5")
+
prepared_params = endpoint.prepare_model_params(thinking_effort: "high")
expect(prepared_params[:reserved_output_tokens]).to eq(25_000)
end
it "uses the model output limit as the reasoning output reservation when configured" do
- model.update!(max_output_tokens: 12_000)
+ model.update!(name: "gpt-5", max_output_tokens: 12_000)
prepared_params = endpoint.prepare_model_params(thinking_effort: "high")
diff --git a/plugins/discourse-ai/spec/lib/translation/base_translator_spec.rb b/plugins/discourse-ai/spec/lib/translation/base_translator_spec.rb
index 8130c99ece4..4ebd4927763 100644
--- a/plugins/discourse-ai/spec/lib/translation/base_translator_spec.rb
+++ b/plugins/discourse-ai/spec/lib/translation/base_translator_spec.rb
@@ -85,6 +85,7 @@ describe DiscourseAi::Translation::BaseTranslator do
end
it "accounts for the system prompt, examples, and content description" do
+ agent.update!(thinking_effort: nil)
allow(agent.class_instance).to receive(:compression_threshold).and_return(nil)
llm_model = Fabricate(:fake_model, max_output_tokens: 8192, max_prompt_tokens: 4096)
source = "hello world " * 3000
@@ -115,6 +116,7 @@ describe DiscourseAi::Translation::BaseTranslator do
end
it "bounds output by the agent work allowance when the model has no output limit" do
+ agent.update!(thinking_effort: nil)
llm_model = Fabricate(:fake_model, max_output_tokens: nil, max_prompt_tokens: 8192)
translator =
DiscourseAi::Translation::PostRawTranslator.new(text:, target_locale:, llm_model:)
diff --git a/plugins/discourse-ai/spec/models/ai_agent_spec.rb b/plugins/discourse-ai/spec/models/ai_agent_spec.rb
index 0ccbab24ce1..1da19da7532 100644
--- a/plugins/discourse-ai/spec/models/ai_agent_spec.rb
+++ b/plugins/discourse-ai/spec/models/ai_agent_spec.rb
@@ -446,11 +446,23 @@ RSpec.describe AiAgent do
expect(agent.thinking_effort).to eq("max")
end
- it "declares a default thinking effort for reasoning-enabled system agents" do
+ it "declares an explicit thinking effort for every built-in system agent" do
+ DiscourseAi::Agents::Agent
+ .send(:builtin_system_agents)
+ .each_key do |klass|
+ expect(DiscourseAi::Completions::ThinkingConfig::VALUES).to include(
+ klass.new.thinking_effort,
+ ),
+ "expected #{klass} to declare a thinking effort, got #{klass.new.thinking_effort.inspect}"
+ end
+ end
+
+ it "disables thinking for single-shot agents and enables it for multi-step ones" do
{
- DiscourseAi::Agents::Creative => "low",
+ DiscourseAi::Agents::Summarizer => "none",
+ DiscourseAi::Agents::Translator => "none",
+ DiscourseAi::Agents::Proofreader => "none",
DiscourseAi::Agents::General => "low",
- DiscourseAi::Agents::DiscourseHelper => "low",
DiscourseAi::Agents::SqlHelper => "medium",
DiscourseAi::Agents::ForumResearcher => "high",
}.each do |klass, effort|
diff --git a/plugins/discourse-data-explorer/lib/discourse_data_explorer/ai_query_generator.rb b/plugins/discourse-data-explorer/lib/discourse_data_explorer/ai_query_generator.rb
index 41e37d42119..e6f4f61b1f0 100644
--- a/plugins/discourse-data-explorer/lib/discourse_data_explorer/ai_query_generator.rb
+++ b/plugins/discourse-data-explorer/lib/discourse_data_explorer/ai_query_generator.rb
@@ -6,6 +6,10 @@ module DiscourseDataExplorer
false
end
+ def thinking_effort
+ "medium"
+ end
+
def tools
[
DiscourseAi::Agents::Tools::DbSchema,
diff --git a/plugins/discourse-workflows/lib/discourse_workflows/ai_workflow_author.rb b/plugins/discourse-workflows/lib/discourse_workflows/ai_workflow_author.rb
index 179e5200e0c..09f5edd401d 100644
--- a/plugins/discourse-workflows/lib/discourse_workflows/ai_workflow_author.rb
+++ b/plugins/discourse-workflows/lib/discourse_workflows/ai_workflow_author.rb
@@ -13,6 +13,10 @@ module DiscourseWorkflows
100_000
end
+ def thinking_effort
+ "high"
+ end
+
def tools
[
DiscourseWorkflows::Ai::Tools::WorkflowAskQuestions,