Skip to content

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

FIX: correct open ai endpoint call (#34170)

Régis Hanolac08fdf65e92
diff --git a/plugins/discourse-ai/lib/completions/endpoints/open_ai.rb b/plugins/discourse-ai/lib/completions/endpoints/open_ai.rb
index 6d90bc26193..000108f67d3 100644
--- a/plugins/discourse-ai/lib/completions/endpoints/open_ai.rb
+++ b/plugins/discourse-ai/lib/completions/endpoints/open_ai.rb
@@ -14,7 +14,7 @@ module DiscourseAi
# max_tokens is deprecated however we still need to support it
# on older OpenAI models and older Azure models, so we will only normalize
# if our model name starts with o (to denote all the reasoning models)
- if llm_model.name.starts_with?("o") | llm_model.name.starts_with?("gpt-5")
+ if llm_model.name.starts_with?(/o|gpt-5/)
max_tokens = model_params.delete(:max_tokens)
model_params[:max_completion_tokens] = max_tokens if max_tokens
end