A platform for community discussion. Free, open, simple.
DEV: Remove hard-coded temperatures from built-in agents (#42441)
Rafael dos Santos Silvab8e75bd45db3
diff --git a/plugins/discourse-ai/evals/lib/judge.rb b/plugins/discourse-ai/evals/lib/judge.rbindex 33f30ff69d4..2c2b779aee9 100644--- a/plugins/discourse-ai/evals/lib/judge.rb+++ b/plugins/discourse-ai/evals/lib/judge.rb@@ -86,7 +86,6 @@ module DiscourseAijudge_llm.to_llm.generate(prompt,user: Discourse.system_user,- temperature: 0,response_format: RESPONSE_FORMAT,execution_context:,)@@ -113,7 +112,6 @@ module DiscourseAijudge_llm.to_llm.generate(prompt,user: Discourse.system_user,- temperature: 0,response_format: COMPARISON_RESPONSE_FORMAT,execution_context:,)diff --git a/plugins/discourse-ai/lib/agents/admin_dashboard_highlights.rb b/plugins/discourse-ai/lib/agents/admin_dashboard_highlights.rbindex af3b092e705..fff7ae1b799 100644--- a/plugins/discourse-ai/lib/agents/admin_dashboard_highlights.rb+++ b/plugins/discourse-ai/lib/agents/admin_dashboard_highlights.rb@@ -11,10 +11,6 @@ module DiscourseAi[]end- def temperature- 0- end-def system_prompt<<~PROMPT.stripYou write the brief highlight shown at the top of a Discourse community admin dashboard, for the community owner.diff --git a/plugins/discourse-ai/lib/agents/locale_detector.rb b/plugins/discourse-ai/lib/agents/locale_detector.rbindex 69b2a6e2385..40f7c3019ff 100644--- a/plugins/discourse-ai/lib/agents/locale_detector.rb+++ b/plugins/discourse-ai/lib/agents/locale_detector.rb@@ -52,10 +52,6 @@ module DiscourseAi]end- def temperature- 0- end-privatedef configured_locale_linesdiff --git a/plugins/discourse-ai/lib/agents/markdown_table_generator.rb b/plugins/discourse-ai/lib/agents/markdown_table_generator.rbindex ec871526927..af9e73c80e4 100644--- a/plugins/discourse-ai/lib/agents/markdown_table_generator.rb+++ b/plugins/discourse-ai/lib/agents/markdown_table_generator.rb@@ -25,10 +25,6 @@ module DiscourseAi[{ "key" => "output", "type" => "string" }]end- def temperature- 0.5- end-def examples[["<input>sam,joe,jane\nage: 22| 10|11</input>", { output: <<~TEXT }.to_json],diff --git a/plugins/discourse-ai/lib/agents/spam_detector.rb b/plugins/discourse-ai/lib/agents/spam_detector.rbindex 7e56dc3894a..ef8c3ad0812 100644--- a/plugins/discourse-ai/lib/agents/spam_detector.rb+++ b/plugins/discourse-ai/lib/agents/spam_detector.rb@@ -7,10 +7,6 @@ module DiscourseAifalseend- def temperature- 0.1- end-def system_prompt<<~PROMPTYou are a spam detection system. Analyze the following post content and context.diff --git a/plugins/discourse-ai/lib/agents/sql_helper.rb b/plugins/discourse-ai/lib/agents/sql_helper.rbindex 3f77681fce8..5f02fbe432c 100644--- a/plugins/discourse-ai/lib/agents/sql_helper.rb+++ b/plugins/discourse-ai/lib/agents/sql_helper.rb@@ -43,10 +43,6 @@ module DiscourseAi[Tools::DbSchema]end- def temperature- 0.2- end-def system_prompt<<~PROMPTYou are a PostgreSQL expert.diff --git a/plugins/discourse-ai/lib/agents/tools/summarize.rb b/plugins/discourse-ai/lib/agents/tools/summarize.rbindex af237ab1060..a59d8180dd1 100644--- a/plugins/discourse-ai/lib/agents/tools/summarize.rb+++ b/plugins/discourse-ai/lib/agents/tools/summarize.rb@@ -132,13 +132,7 @@ module DiscourseAiprompt = section_prompt(topic, section, guidance)summary =- llm.generate(- prompt,- temperature: 0.6,- max_tokens: 400,- user: bot_user,- feature_name: "summarize_tool",- )+ llm.generate(prompt, max_tokens: 400, user: bot_user, feature_name: "summarize_tool")summaries << summaryend@@ -155,7 +149,6 @@ module DiscourseAillm.generate(concatenation_prompt,- temperature: 0.6,max_tokens: 500,user: bot_user,feature_name: "summarize_tool",diff --git a/plugins/discourse-ai/lib/agents/translator.rb b/plugins/discourse-ai/lib/agents/translator.rbindex 815a29491e1..4bbd1ca5520 100644--- a/plugins/discourse-ai/lib/agents/translator.rb+++ b/plugins/discourse-ai/lib/agents/translator.rb@@ -33,10 +33,6 @@ module DiscourseAidef response_format[{ "key" => "output", "type" => "string" }]end-- def temperature- 0.2- endendendenddiff --git a/plugins/discourse-ai/lib/automation/report_runner.rb b/plugins/discourse-ai/lib/automation/report_runner.rbindex 1b7d7d452ff..c5c621fa40a 100644--- a/plugins/discourse-ai/lib/automation/report_runner.rb+++ b/plugins/discourse-ai/lib/automation/report_runner.rb@@ -53,7 +53,7 @@ module DiscourseAiexclude_category_ids: nil,exclude_tags: nil,top_p: 0.1,- temperature: 0.2,+ temperature: nil,suppress_notifications: false,automation: nil)diff --git a/plugins/discourse-ai/lib/completions/endpoints/hugging_face.rb b/plugins/discourse-ai/lib/completions/endpoints/hugging_face.rbindex e076b0e3139..b44b21add53 100644--- a/plugins/discourse-ai/lib/completions/endpoints/hugging_face.rb+++ b/plugins/discourse-ai/lib/completions/endpoints/hugging_face.rb@@ -20,7 +20,7 @@ module DiscourseAienddef default_options- { model: llm_model.name, temperature: 0.7 }+ { model: llm_model.name }enddef provider_iddiff --git a/plugins/discourse-ai/lib/configuration/llm_validator.rb b/plugins/discourse-ai/lib/configuration/llm_validator.rbindex 71187882b20..0bebcbbff0a 100644--- a/plugins/discourse-ai/lib/configuration/llm_validator.rb+++ b/plugins/discourse-ai/lib/configuration/llm_validator.rb@@ -88,7 +88,6 @@ module DiscourseAiTEST_PROMPT,user: @opts[:user] || Discourse.system_user,feature_name: "llm_validator",- temperature: 0.7,top_p: 0.9,&blk)diff --git a/plugins/discourse-ai/spec/evals/judge_spec.rb b/plugins/discourse-ai/spec/evals/judge_spec.rbindex 8cd46555f5f..ea1cef3c87b 100644--- a/plugins/discourse-ai/spec/evals/judge_spec.rb+++ b/plugins/discourse-ai/spec/evals/judge_spec.rb@@ -47,7 +47,6 @@ RSpec.describe DiscourseAi::Evals::Judge doexpect(llm_proxy).to have_received(:generate).with(satisfy { |prompt| prompt.messages.any? { |msg| msg[:content].include?("hash-output") } },user: Discourse.system_user,- temperature: 0,response_format: DiscourseAi::Evals::Judge::RESPONSE_FORMAT,execution_context: nil,)@@ -73,7 +72,6 @@ RSpec.describe DiscourseAi::Evals::Judge doprompt.messages.any? { |msg| msg[:content].include?("Candidate 2 (custom):") }end,user: Discourse.system_user,- temperature: 0,response_format: DiscourseAi::Evals::Judge::COMPARISON_RESPONSE_FORMAT,execution_context: nil,)diff --git a/plugins/discourse-ai/spec/lib/agents/admin_dashboard_highlights_spec.rb b/plugins/discourse-ai/spec/lib/agents/admin_dashboard_highlights_spec.rbindex 4b9ec0db61a..3988e4afd81 100644--- a/plugins/discourse-ai/spec/lib/agents/admin_dashboard_highlights_spec.rb+++ b/plugins/discourse-ai/spec/lib/agents/admin_dashboard_highlights_spec.rb@@ -5,7 +5,6 @@ RSpec.describe DiscourseAi::Agents::AdminDashboardHighlights doinstance = described_class.newexpect(instance.tools).to eq([])- expect(instance.temperature).to eq(0)expect(instance.response_format).to eq([{ "key" => "highlight", "type" => "string" }])enddiff --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.rbindex 757e2c66772..4dc7fab2cdc 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@@ -19,10 +19,6 @@ module DiscourseDataExplorer100_000end- def temperature- 0.2- end-def system_prompt<<~PROMPTYou are a PostgreSQL expert that generates queries for Discourse Data Explorer.