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 😄

Comment From: apappascs

FYI: The parameter for reasoning effort is available only for use with the ‘full’ o1 model which is currently being rolled-out to Tier 5 users. You may have to wait a bit longer before you can access it.

source: https://community.openai.com/t/o1s-reasoning-effort-parameter/1062308

Comment From: ilayaperumalg

This is addressed via 35101e75ae3fe0fd14efd0909ffa8d1e7ca7459e Thanks to @apappascs

Comment From: kevindai007

guys, anyone has any idea that how can i output the reasoning process when using openai starter?