Skip to content

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

FEATURE: update preconfigured models (#36095)

Sam3c7f56c0c72b
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-llm-editor-form.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-llm-editor-form.gjs
index b15bd3da1ed..7ba8e03eb2f 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-llm-editor-form.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-llm-editor-form.gjs
@@ -53,10 +53,14 @@ export default class AiLlmEditorForm extends Component {
display_name: modelInfo.display_name,
name: modelInfo.name,
provider: info.provider,
- provider_params: this.computeProviderParams(info.provider),
+ provider_params: this.computeProviderParams(
+ info.provider,
+ modelInfo.provider_params ?? {}
+ ),
input_cost: modelInfo.input_cost,
output_cost: modelInfo.output_cost,
cached_input_cost: modelInfo.cached_input_cost,
+ vision_enabled: modelInfo.vision_enabled || false,
};
}
diff --git a/plugins/discourse-ai/config/locales/client.en.yml b/plugins/discourse-ai/config/locales/client.en.yml
index ba8d6faef37..f4dd93e3b24 100644
--- a/plugins/discourse-ai/config/locales/client.en.yml
+++ b/plugins/discourse-ai/config/locales/client.en.yml
@@ -678,24 +678,21 @@ en:
model_description:
none: "General settings that work for most language models"
anthropic-claude-opus-4-1: "Anthropic's most intelligent model"
- anthropic-claude-sonnet-4-0: "Optimal balance of speed and cost"
- anthropic-claude-3-7-sonnet-latest: "Optimal balance of speed and cost (previous generation)"
- anthropic-claude-3-5-haiku-latest: "Fast and cost-effective"
+ anthropic-claude-sonnet-4-5: "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-2-5-pro: "Large multimodal model capable of a wide range of tasks"
- google-gemini-2-0-flash: "Lightweight, fast, and cost-efficient with multimodal reasoning (previous generation)"
google-gemini-2-5-flash: "Lightweight, fast, and cost-efficient with multimodal reasoning"
- google-gemini-2-0-flash-lite: "Cost efficient and low latency model"
+ google-gemini-2-5-flash-lite: "Google's smallest and most cost-effective model"
google-gemini-2-5-flash-image-preview: "Latest image generation model with vision capabilities"
- open_ai-o3: "OpenAI's most capable reasoning model"
- open_ai-o4-mini: "Advanced Cost-efficient reasoning model"
- open_ai-gpt-5: "OpenAI's flagship model. It is well suited for problem solving across domains"
+ open_ai-gpt-5-1: "OpenAI's flagship model. It is well suited for problem solving across domains"
open_ai-gpt-5-mini: "Provides a balance between intelligence, speed, and cost that makes it an attractive model for many use cases."
open_ai-gpt-5-nano: "Fastest, most cost-effective GPT-5 model."
samba_nova-Meta-Llama-3-1-8B-Instruct: "Efficient lightweight multilingual model"
samba_nova-Meta-Llama-3-3-70B-Instruct": "Powerful multipurpose model"
mistral-mistral-large-latest: "Mistral's most powerful model"
mistral-pixtral-large-latest: "Mistral's most powerful vision capable model"
- open_router-x-ai-grok-3-beta: "xAI's latest model"
+ open_router-x-ai-grok-4: "xAI's latest model"
open_router-deepseek-deepseek-r1-0528-free: "DeepSeek's latest reasoning model"
open_router-meta-llama-3-3-70b-instruct: "Highly capable multilingual model"
groq-openai-gpt-oss-120b: "State of the art open-weight model by OpenAI"
diff --git a/plugins/discourse-ai/lib/completions/llm.rb b/plugins/discourse-ai/lib/completions/llm.rb
index 02c9e471c11..7819d413d8b 100644
--- a/plugins/discourse-ai/lib/completions/llm.rb
+++ b/plugins/discourse-ai/lib/completions/llm.rb
@@ -19,7 +19,6 @@ module DiscourseAi
class << self
def presets
- # Sam: I am not sure if it makes sense to translate model names at all
@presets ||=
begin
[
@@ -27,28 +26,22 @@ module DiscourseAi
id: "anthropic",
models: [
{
- name: "claude-3-7-sonnet-latest",
+ name: "claude-sonnet-4-5",
tokens: 200_000,
- display_name: "Claude 3.7 Sonnet",
+ display_name: "Claude 4.5 Sonnet",
input_cost: 3,
cached_input_cost: 0.30,
output_cost: 15,
+ vision_enabled: true,
},
{
- name: "claude-sonnet-4-0",
+ name: "claude-haiku-4-5",
tokens: 200_000,
- display_name: "Claude 4 Sonnet",
- input_cost: 3,
- cached_input_cost: 0.30,
- output_cost: 15,
- },
- {
- name: "claude-3-5-haiku-latest",
- tokens: 200_000,
- display_name: "Claude 3.5 Haiku",
- input_cost: 0.80,
- cached_input_cost: 0.08,
- output_cost: 4,
+ display_name: "Claude 4.5 Haiku",
+ input_cost: 1,
+ cached_input_cost: 0.1,
+ output_cost: 5,
+ vision_enabled: true,
},
{
name: "claude-opus-4-1",
@@ -57,6 +50,7 @@ module DiscourseAi
input_cost: 15,
cached_input_cost: 1.50,
output_cost: 75,
+ vision_enabled: true,
},
],
tokenizer: DiscourseAi::Tokenizer::AnthropicTokenizer,
@@ -66,6 +60,17 @@ module DiscourseAi
{
id: "google",
models: [
+ {
+ name: "gemini-3-pro",
+ tokens: 800_000,
+ endpoint:
+ "https://generativelanguage.googleapis.com/v1beta/models/gemini-3-pro-preview",
+ display_name: "Gemini 3 Pro",
+ input_cost: 2,
+ output_cost: 12,
+ cached_input_cost: 0.2,
+ vision_enabled: true,
+ },
{
name: "gemini-2.5-pro",
tokens: 800_000,
@@ -73,7 +78,9 @@ module DiscourseAi
"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro",
display_name: "Gemini 2.5 Pro",
input_cost: 1.25,
- oputput_cost: 10.0,
+ output_cost: 10.0,
+ cached_input_cost: 0.125,
+ vision_enabled: true,
},
{
name: "gemini-2.5-flash",
@@ -83,24 +90,17 @@ module DiscourseAi
display_name: "Gemini 2.5 Flash",
input_cost: 0.30,
output_cost: 2.50,
+ vision_enabled: true,
},
{
- name: "gemini-2.0-flash",
+ name: "gemini-2.5-flash-lite",
tokens: 800_000,
endpoint:
- "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash",
- display_name: "Gemini 2.0 Flash",
- input_cost: 0.10,
- output_cost: 0.40,
- },
- {
- name: "gemini-2.0-flash-lite",
- tokens: 800_000,
- endpoint:
- "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-lite",
- display_name: "Gemini 2.0 Flash Lite",
- input_cost: 0.075,
- output_cost: 0.30,
+ "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-lite",
+ display_name: "Gemini 2.5 Flash Lite",
+ input_cost: 0.1,
+ output_cost: 0.4,
+ vision_enabled: true,
},
{
name: "gemini-2.5-flash-image-preview",
@@ -108,6 +108,7 @@ module DiscourseAi
endpoint:
"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image-preview",
display_name: "Gemini 2.5 Flash Image",
+ vision_enabled: true,
},
],
tokenizer: DiscourseAi::Tokenizer::GeminiTokenizer,
@@ -117,29 +118,18 @@ module DiscourseAi
id: "open_ai",
models: [
{
- name: "o4-mini",
- tokens: 200_000,
- display_name: "o4 Mini",
- input_cost: 1.10,
- cached_input_cost: 0.275,
- output_cost: 4.40,
- },
- {
- name: "o3",
- tokens: 200_000,
- display_name: "o3",
- input_cost: 2,
- cached_input_cost: 0.5,
- output_cost: 8,
- },
- {
- name: "gpt-5",
+ name: "gpt-5.1",
tokens: 400_000,
- display_name: "GPT-5",
+ display_name: "GPT-5.1",
input_cost: 1.25,
cached_input_cost: 0.125,
output_cost: 10,
max_output_tokens: 128_000,
+ endpoint: "https://api.openai.com/v1/responses",
+ vision_enabled: true,
+ provider_params: {
+ enable_responses_api: true,
+ },
},
{
name: "gpt-5-mini",
@@ -149,6 +139,10 @@ module DiscourseAi
cached_input_cost: 0.025,
output_cost: 2.0,
max_output_tokens: 128_000,
+ endpoint: "https://api.openai.com/v1/responses",
+ provider_params: {
+ enable_responses_api: true,
+ },
},
{
name: "gpt-5-nano",
@@ -158,6 +152,10 @@ module DiscourseAi
cached_input_cost: 0.005,
output_cost: 0.40,
max_output_tokens: 128_000,
+ endpoint: "https://api.openai.com/v1/responses",
+ provider_params: {
+ enable_responses_api: true,
+ },
},
],
tokenizer: DiscourseAi::Tokenizer::OpenAiTokenizer,
@@ -208,11 +206,12 @@ module DiscourseAi
id: "open_router",
models: [
{
- name: "x-ai/grok-3-beta",
+ name: "x-ai/grok-4",
tokens: 131_072,
- display_name: "xAI Grok 3 Beta",
+ display_name: "xAI Grok 4",
input_cost: 3,
output_cost: 15,
+ vision_enabled: true,
},
{
name: "deepseek/deepseek-r1-0528:free",
diff --git a/plugins/discourse-ai/lib/personas/bot_context.rb b/plugins/discourse-ai/lib/personas/bot_context.rb
index e87235139d0..bbae463772b 100644
--- a/plugins/discourse-ai/lib/personas/bot_context.rb
+++ b/plugins/discourse-ai/lib/personas/bot_context.rb
@@ -88,6 +88,7 @@ module DiscourseAi
# these are strings that can be safely interpolated into templates
TEMPLATE_PARAMS = %w[
+ date
time
site_url
site_title
@@ -108,6 +109,10 @@ module DiscourseAi
@time ||= Time.zone.now
end
+ def date
+ @date ||= time.strftime("%B %d, %Y")
+ end
+
def site_url
@site_url ||= Discourse.base_url
end
diff --git a/plugins/discourse-ai/lib/personas/discourse_helper.rb b/plugins/discourse-ai/lib/personas/discourse_helper.rb
index 2e9db14220b..a5c0a2682d2 100644
--- a/plugins/discourse-ai/lib/personas/discourse_helper.rb
+++ b/plugins/discourse-ai/lib/personas/discourse_helper.rb
@@ -38,7 +38,7 @@ module DiscourseAi
- Discourse Helper Bot will lean on categories to filter results.
- The date now is: {time}, much has changed since you were trained.
+ The date now is: {date}, much has changed since you were trained.
PROMPT
end
end
diff --git a/plugins/discourse-ai/lib/personas/forum_researcher.rb b/plugins/discourse-ai/lib/personas/forum_researcher.rb
index 3381b8313c3..634ce4aaf25 100644
--- a/plugins/discourse-ai/lib/personas/forum_researcher.rb
+++ b/plugins/discourse-ai/lib/personas/forum_researcher.rb
@@ -20,7 +20,7 @@ module DiscourseAi
The title of your site: {site_title}
The description is: {site_description}
The participants in this conversation are: {participants}
- The date now is: {time}, much has changed since you were trained.
+ The date now is: {date}, much has changed since you were trained.
Topic URLs are formatted as: /t/-/TOPIC_ID
Post URLs are formatted as: /t/-/TOPIC_ID/POST_NUMBER
diff --git a/plugins/discourse-ai/lib/personas/general.rb b/plugins/discourse-ai/lib/personas/general.rb
index 01c05e08b01..6ec5e490d35 100644
--- a/plugins/discourse-ai/lib/personas/general.rb
+++ b/plugins/discourse-ai/lib/personas/general.rb
@@ -24,7 +24,7 @@ module DiscourseAi
The title of your site: {site_title}
The description is: {site_description}
The participants in this conversation are: {participants}
- The date now is: {time}, much has changed since you were trained.
+ The date now is: {date}, much has changed since you were trained.
PROMPT
end
end
diff --git a/plugins/discourse-ai/lib/personas/github_helper.rb b/plugins/discourse-ai/lib/personas/github_helper.rb
index 91bba812080..2c08b30b851 100644
--- a/plugins/discourse-ai/lib/personas/github_helper.rb
+++ b/plugins/discourse-ai/lib/personas/github_helper.rb
@@ -24,7 +24,7 @@ module DiscourseAi
- Files: [file.rb](https://github.com/owner/repo/blob/branch/file.rb#L10-L25)
- PRs/Issues: [#123](https://github.com/owner/repo/pull/123)
- The date now is: {time}, much has changed since you were trained.
+ The date now is: {date}, much has changed since you were trained.
PROMPT
end
end
diff --git a/plugins/discourse-ai/lib/personas/researcher.rb b/plugins/discourse-ai/lib/personas/researcher.rb
index 6650836bddc..8b5e3e86d7f 100644
--- a/plugins/discourse-ai/lib/personas/researcher.rb
+++ b/plugins/discourse-ai/lib/personas/researcher.rb
@@ -44,7 +44,7 @@ module DiscourseAi
Remember, efficient use of your tools not only saves time but also ensures the high quality and relevance of the information provided.
- The date now is: {time}, much has changed since you were trained.
+ The date now is: {date}, much has changed since you were trained.
PROMPT
end
end
diff --git a/plugins/discourse-ai/lib/personas/settings_explorer.rb b/plugins/discourse-ai/lib/personas/settings_explorer.rb
index 77ae45e3424..e196a808f52 100644
--- a/plugins/discourse-ai/lib/personas/settings_explorer.rb
+++ b/plugins/discourse-ai/lib/personas/settings_explorer.rb
@@ -16,7 +16,7 @@ module DiscourseAi
- You are a helpful teacher that teaches people about what each settings does.
- Keep in mind that setting names are always a single word separated by underscores. eg. 'site_description'
- Current time is: {time}
+ Current date is: {date}
PROMPT
end
end
diff --git a/plugins/discourse-ai/lib/personas/sql_helper.rb b/plugins/discourse-ai/lib/personas/sql_helper.rb
index 720bc145b61..824ed42978c 100644
--- a/plugins/discourse-ai/lib/personas/sql_helper.rb
+++ b/plugins/discourse-ai/lib/personas/sql_helper.rb
@@ -78,7 +78,7 @@ module DiscourseAi
notification_level can be: {muted: 0, regular: 1, tracking: 2, watching: 3, watching_first_post: 4}.
bookmarkable_type can be: Post,Topic,ChatMessage and more
- Current time is: {time}
+ Current date is: {date}
Participants here are: {participants}
Here is a partial list of tables in the database (you can retrieve schema from these tables as needed)
diff --git a/plugins/discourse-ai/spec/lib/personas/persona_spec.rb b/plugins/discourse-ai/spec/lib/personas/persona_spec.rb
index cde7d787e38..ace2792bd19 100644
--- a/plugins/discourse-ai/spec/lib/personas/persona_spec.rb
+++ b/plugins/discourse-ai/spec/lib/personas/persona_spec.rb
@@ -16,6 +16,7 @@ class TestPersona < DiscourseAi::Personas::Persona
{site_description}
{participants}
{time}
+ {date}
{resource_url}
{inferred_concepts}
PROMPT