Please do a quick search on GitHub issues first, the feature you are about to request might have already been requested.

Expected Behavior

var options=OpenAiChatOptions.builder()
    .withModel("gpt-4o")
    .withTemperature(1.0)
    .build();

Current Behavior

Right now, you have to specify the value as being specifically a float, as javac won't coerce a double to a Float, for use with both temperature and topP. However, in the serialized form being sent to the LLMs, the granularity and format aren't different; the options object is slightly larger with the use of Double instead of Float but that's unlikely to be significant, and it's less confusing for programmers to use the natural syntax for doubles over the syntax for floats. The following code is what one has to do now, if one sets the temperature, for example:

var options=OpenAiChatOptions.builder()
    .withModel("gpt-4o")
    .withTemperature(1.0f)
    .build();

Context

It hasn't really affected me - I mean, I guess I have to type that f or use a Float reference instead, oh the humanity, etc.. but I think it's a relatively appropriate change for quality of life for users of the APIs, and the impact for current users would be minimal since it's a widening operation and not a narrowing one.

Comment From: ThomasVitale

Duplicate of https://github.com/spring-projects/spring-ai/issues/712

Comment From: ThomasVitale

This was solved in https://github.com/spring-projects/spring-ai/issues/712. The issue can be closed.