Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

adjust the default value of reasoningEffort to mitigate empty response from GPT-5 models

Forhad Hosaincb05a551526c
diff --git a/packages/app/src/builder-ui/components/GenAILLM.class.ts b/packages/app/src/builder-ui/components/GenAILLM.class.ts
index 32210257..a91542eb 100644
--- a/packages/app/src/builder-ui/components/GenAILLM.class.ts
+++ b/packages/app/src/builder-ui/components/GenAILLM.class.ts
@@ -1546,13 +1546,21 @@ export class GenAILLM extends Component {
selectElem.addOption(option.value, option.text, false); // Don't auto-select during addition
});
- // Always reset to the model's default when switching models
- const defaultValue = this.getDefaultReasoningEffortForModel(model, options);
- selectElem.val(defaultValue);
+ // Preserve user's existing selection if it's valid for this model's options
+ // Otherwise, use the model's default value
+ const existingValue = this.data.reasoningEffort;
+ const isValidOption = options.some((opt) => opt.value === existingValue);
+
+ const valueToSet = isValidOption
+ ? existingValue
+ : this.getDefaultReasoningEffortForModel(model, options);
+
+ selectElem.val(valueToSet);
}
/**
* Get the appropriate default reasoning effort value for a given model
+ * Always returns the first option as the default
*/
private getDefaultReasoningEffortForModel(
model: string,
@@ -1560,27 +1568,8 @@ export class GenAILLM extends Component {
): string {
if (options.length === 0) return '';
- const modelLower = model.toLowerCase();
-
- // GPT-5-pro only supports 'high' reasoning effort
- if (modelLower.includes('gpt-5-pro')) {
- return 'high';
- }
-
- // Default values for different model types
- if (
- modelLower.includes('gpt') ||
- modelLower.includes('openai') ||
- modelLower.includes('smythos/gpt')
- ) {
- // For other GPT models, prefer 'medium' as a balanced default
- return options.find((opt) => opt.value === 'medium')?.value || options[0].value;
- } else if (modelLower.includes('qwen')) {
- // For Qwen models, prefer 'default' over 'none'
- return options.find((opt) => opt.value === 'default')?.value || options[0].value;
- }
-
- // For any other models, use the first available option
+ // Always use the first available option as the default
+ // Because with higher reasoning effort, GPT-5 models cannot provide the expected output if the maximum output tokens are insufficient for the reasoning process.
return options[0].value;
}