diff --git a/application/src/main/java/org/togetherjava/tjbot/features/chatgpt/ChatGptModel.java b/application/src/main/java/org/togetherjava/tjbot/features/chatgpt/ChatGptModel.java index e08951f4b3..c2f11704f4 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/chatgpt/ChatGptModel.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/chatgpt/ChatGptModel.java @@ -1,34 +1,39 @@ package org.togetherjava.tjbot.features.chatgpt; import com.openai.models.ChatModel; +import com.openai.models.Reasoning; +import com.openai.models.ReasoningEffort; /** * Logical abstraction over OpenAI chat models. *

- * This enum allows the application to select models based on performance/quality intent rather than - * hard-coding specific OpenAI model versions throughout the codebase. + * This enum allows the application to select models and reasoning efforts based on + * performance/quality intent rather than hard-coding specific OpenAI model versions throughout the + * codebase. * */ public enum ChatGptModel { /** * Fastest response time with the lowest computational cost. */ - FASTEST(ChatModel.GPT_3_5_TURBO), + FASTEST(ChatModel.GPT_6_LUNA, ReasoningEffort.NONE), /** * Balanced option between speed and quality. */ - FAST(ChatModel.GPT_4_1_MINI), + FAST(ChatModel.GPT_6_LUNA, ReasoningEffort.LOW), /** * Highest quality responses with increased reasoning capability. */ - HIGH_QUALITY(ChatModel.GPT_5_MINI); + HIGH_QUALITY(ChatModel.GPT_6_LUNA, ReasoningEffort.MEDIUM); private final ChatModel chatModel; + private final ReasoningEffort reasoningEffort; - ChatGptModel(ChatModel chatModel) { + ChatGptModel(ChatModel chatModel, ReasoningEffort reasoningEffort) { this.chatModel = chatModel; + this.reasoningEffort = reasoningEffort; } /** @@ -38,6 +43,20 @@ public ChatModel toChatModel() { return chatModel; } + /** + * @return the reasoning effort used by this enum. + */ + public ReasoningEffort toReasoningEffort() { + return reasoningEffort; + } + + /** + * @return the reasoning used by this enum. + */ + public Reasoning toReasoning() { + return Reasoning.builder().effort(reasoningEffort).build(); + } + @Override public String toString() { return chatModel.toString(); diff --git a/application/src/main/java/org/togetherjava/tjbot/features/chatgpt/ChatGptService.java b/application/src/main/java/org/togetherjava/tjbot/features/chatgpt/ChatGptService.java index 04788c3b7a..82f0cbaf0c 100644 --- a/application/src/main/java/org/togetherjava/tjbot/features/chatgpt/ChatGptService.java +++ b/application/src/main/java/org/togetherjava/tjbot/features/chatgpt/ChatGptService.java @@ -156,6 +156,7 @@ private Optional sendPrompt(String prompt, ChatGptModel chatModel, try { ResponseCreateParams.Builder paramsBuilder = ResponseCreateParams.builder() .model(chatModel.toChatModel()) + .reasoning(chatModel.toReasoning()) .input(prompt) .maxOutputTokens(MAX_TOKENS); diff --git a/build.gradle b/build.gradle index 19b1a82bc4..0866e6632b 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ version '1.0-SNAPSHOT' ext { jooqVersion = '3.21.2' jacksonVersion = '2.19.1' - chatGPTVersion = '4.58.0' + chatGPTVersion = '4.109.0' junitVersion = '6.1.0' }