Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Reconsider the Type float/Float in the API #712

Closed
ullenboom opened this issue May 11, 2024 · 5 comments
Closed

Reconsider the Type float/Float in the API #712

ullenboom opened this issue May 11, 2024 · 5 comments

Comments

@ullenboom
Copy link

A floating-point number with limited precision is commonly used in AI. However, using float or Float as a data type in the API might be impractical, and it could be worth reevaluating this decision.

For instance, your own example in the reference documentation (https://docs.spring.io/spring-ai/reference/api/clients/ollama-chat.html) results in a compiler error, guess why :)

ChatResponse response = chatClient.call(
    new Prompt(
        "Generate the names of 5 famous pirates.",
        OllamaOptions.create()
            .withModel("llama2")
            .withTemperature(0.4)
    ));
@ThomasVitale
Copy link
Contributor

It would be nice to use Double instead of Float in all the ModelOptions implementations. It would make the API more convenient to work with and the code more readable.

@markpollack markpollack added this to the 1.0.0-M2 milestone Aug 14, 2024
@markpollack
Copy link
Member

I agree, thanks for raising the issue. I will aim to fix this for the M2 release that is coming up shortly.

@csterwa
Copy link

csterwa commented Sep 4, 2024

@markpollack should this be moved to next milestone or release candidate?

@markpollack markpollack modified the milestones: 1.0.0-M2, 1.0.0-RC1 Sep 4, 2024
@ThomasVitale
Copy link
Contributor

I'm available to submit a PR on this. I had already done some preliminary analysis when working on the observability features. I should have the PR ready by the end of this week.

ThomasVitale added a commit to ThomasVitale/spring-ai that referenced this issue Sep 8, 2024
* The type of the portable chat options (frequencyPenalty, presencePenalty, temperature, topP) has been changed from Float to Double.
* APIs, test, and documentation have been updated accordingly.

Fixes spring-projectsgh-712

Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
@ThomasVitale
Copy link
Contributor

The PR is ready for review: #1325

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants