diff --git a/front_end/panels/ai_chat/LLM/OpenAIProvider.ts b/front_end/panels/ai_chat/LLM/OpenAIProvider.ts index ace7cfac2be..b8c30ad3239 100644 --- a/front_end/panels/ai_chat/LLM/OpenAIProvider.ts +++ b/front_end/panels/ai_chat/LLM/OpenAIProvider.ts @@ -54,6 +54,10 @@ export class OpenAIProvider extends LLMBaseProvider { if (modelName.startsWith('o')) { return ModelFamily.O; } + // GPT-5 models also don't support temperature parameter, treat them like O-series + if (modelName.includes('gpt-5')) { + return ModelFamily.O; // Treat GPT-5 like O-series for parameter compatibility + } // Otherwise, assume it's a GPT model (gpt-3.5-turbo, gpt-4, etc.) return ModelFamily.GPT; } @@ -470,6 +474,39 @@ export class OpenAIProvider extends LLMBaseProvider { vision: false, structured: true } + }, + { + id: 'gpt-5-2025-08-07', + name: 'GPT-5', + provider: 'openai', + capabilities: { + functionCalling: true, + reasoning: true, + vision: true, + structured: true + } + }, + { + id: 'gpt-5-mini-2025-08-07', + name: 'GPT-5 Mini', + provider: 'openai', + capabilities: { + functionCalling: true, + reasoning: true, + vision: true, + structured: true + } + }, + { + id: 'gpt-5-nano-2025-08-07', + name: 'GPT-5 Nano', + provider: 'openai', + capabilities: { + functionCalling: true, + reasoning: true, + vision: true, + structured: true + } } ]; } diff --git a/front_end/panels/ai_chat/LLM/OpenRouterProvider.ts b/front_end/panels/ai_chat/LLM/OpenRouterProvider.ts index f161d55fd72..7acb066e224 100644 --- a/front_end/panels/ai_chat/LLM/OpenRouterProvider.ts +++ b/front_end/panels/ai_chat/LLM/OpenRouterProvider.ts @@ -63,6 +63,22 @@ export class OpenRouterProvider extends LLMBaseProvider { super(); } + /** + * Check if a model doesn't support temperature parameter + * OpenAI's GPT-5, O3, and O4 models accessed through OpenRouter don't support temperature + */ + private shouldExcludeTemperature(modelName: string): boolean { + // OpenAI models that don't support temperature parameter + // These are accessed through OpenRouter as 'openai/model-name' + const noTemperatureModels = [ + 'openai/gpt-5', + 'openai/o3', + 'openai/o4' + ]; + + return noTemperatureModels.some(pattern => modelName.includes(pattern)); + } + /** * Get the chat completions endpoint URL */ @@ -231,8 +247,8 @@ export class OpenRouterProvider extends LLMBaseProvider { messages: this.convertMessagesToOpenRouter(messages), }; - // Add temperature if provided - if (options?.temperature !== undefined) { + // Add temperature if provided and model supports it + if (options?.temperature !== undefined && !this.shouldExcludeTemperature(modelName)) { payloadBody.temperature = options.temperature; } @@ -571,9 +587,13 @@ export class OpenRouterProvider extends LLMBaseProvider { try { const testPrompt = 'Please respond with "Connection successful!" to confirm the connection is working.'; - const response = await this.call(modelName, testPrompt, '', { - temperature: 0.1, - }); + // Only add temperature if the model supports it + const callOptions: LLMCallOptions = {}; + if (!this.shouldExcludeTemperature(modelName)) { + callOptions.temperature = 0.1; + } + + const response = await this.call(modelName, testPrompt, '', callOptions); if (response.text?.toLowerCase().includes('connection')) { return { diff --git a/front_end/panels/ai_chat/core/Version.ts b/front_end/panels/ai_chat/core/Version.ts index fc354cd7101..d2bcc5f2142 100644 --- a/front_end/panels/ai_chat/core/Version.ts +++ b/front_end/panels/ai_chat/core/Version.ts @@ -3,7 +3,7 @@ // found in the LICENSE file. export const VERSION_INFO = { - version: '0.3.0', + version: '0.3.1', buildDate: '2025-08-07', channel: 'stable' } as const; diff --git a/front_end/panels/ai_chat/ui/AIChatPanel.ts b/front_end/panels/ai_chat/ui/AIChatPanel.ts index c5b76e3c2ab..97e412ae9f6 100644 --- a/front_end/panels/ai_chat/ui/AIChatPanel.ts +++ b/front_end/panels/ai_chat/ui/AIChatPanel.ts @@ -100,9 +100,13 @@ export interface ModelOption { // Add model options constant - these are the default OpenAI models const DEFAULT_OPENAI_MODELS: ModelOption[] = [ {value: 'o4-mini-2025-04-16', label: 'O4 Mini', type: 'openai'}, + {value: 'o3-mini-2025-01-31', label: 'O3 Mini', type: 'openai'}, + {value: 'gpt-5-2025-08-07', label: 'GPT-5', type: 'openai'}, + {value: 'gpt-5-mini-2025-08-07', label: 'GPT-5 Mini', type: 'openai'}, + {value: 'gpt-5-nano-2025-08-07', label: 'GPT-5 Nano', type: 'openai'}, + {value: 'gpt-4.1-2025-04-14', label: 'GPT-4.1', type: 'openai'}, {value: 'gpt-4.1-mini-2025-04-14', label: 'GPT-4.1 Mini', type: 'openai'}, {value: 'gpt-4.1-nano-2025-04-14', label: 'GPT-4.1 Nano', type: 'openai'}, - {value: 'gpt-4.1-2025-04-14', label: 'GPT-4.1', type: 'openai'}, ]; // Default model selections for each provider @@ -516,7 +520,8 @@ export class AIChatPanel extends UI.Panel.Panel { const existingOpenRouterModels = existingAllModels.filter((m: ModelOption) => m.type === 'openrouter'); // Update models based on what type of models we're adding - let updatedOpenAIModels = existingOpenAIModels.length > 0 ? existingOpenAIModels : DEFAULT_OPENAI_MODELS; + // Always use DEFAULT_OPENAI_MODELS for OpenAI to ensure we have the latest hardcoded list + let updatedOpenAIModels = DEFAULT_OPENAI_MODELS; let updatedLiteLLMModels = existingLiteLLMModels; let updatedGroqModels = existingGroqModels; let updatedOpenRouterModels = existingOpenRouterModels; @@ -651,6 +656,15 @@ export class AIChatPanel extends UI.Panel.Panel { return updatedOptions; } + /** + * Clears cached model data to force refresh from defaults + */ + static clearModelCache(): void { + localStorage.removeItem('ai_chat_all_model_options'); + localStorage.removeItem('ai_chat_model_options'); + logger.info('Cleared model cache - will use DEFAULT_OPENAI_MODELS on next refresh'); + } + /** * Removes a custom model from the options * @param modelName Name of the model to remove