Current Behavior
OpenAI has introduced since a while now the reasoning_effort
parameter, which allows users to control the depth of reasoning a model applies when generating responses. This is particularly useful for optimizing inference costs by adjusting how much computational effort is spent on reasoning-intensive tasks.
Currently, the OpenAiApi.ChatCompletionRequest
class allows for setting various options, but there does not appear to be a way to specify the reasoning_effort
parameter when using the ChatClient
or ChatModel
interfaces in SpringAI.
Expected Behavior
It would be beneficial for the OpenAiChatOptions
class to support the reasoning_effort
parameter, enabling users to configure it directly when making requests.
Example usage:
var promptOptions = OpenAiChatOptions.builder()
.reasoningEffort("low") // Set reasoning effort level - available values are: "low", "medium", "high"
.build();
chatClient.prompt()
.messages(userMessage)
.options(promptOptions)
.call()
.content();
OpenAI documentation: https://platform.openai.com/docs/api-reference/chat/create#chat-create-reasoning_effort
Context
Adding this functionality would improve flexibility and allow users to optimize their use of OpenAI o1/o3 models based on their needs 😄