Skip to content

Embedding API returns List<Double> instead of List<Float> #456

New issue

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

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

Already on GitHub? Sign in to your account

Open
npe2023 opened this issue Apr 28, 2025 · 2 comments
Open

Embedding API returns List<Double> instead of List<Float> #456

npe2023 opened this issue Apr 28, 2025 · 2 comments

Comments

@npe2023
Copy link

npe2023 commented Apr 28, 2025

I check the official api doc, it says return List<Float>, but the SDK source code returns List<Double>, which can't insert into milvus, i have to convert to float manully.

https://platform.openai.com/docs/api-reference/embeddings

Image
@TomerAberbach TomerAberbach changed the title why does the Embedding api returns List<Double>, not List<Float> Embedding API returns List<Double> instead of List<Float> Apr 28, 2025
@KerwinAusten
Copy link

Image

Does the official document refer to a list of floats shown in this image? I think that here "floats" means floating-point numbers, not the type being float.

官方文档是指这张图中的a list of floats么?我认为这里的floats指的是浮点数,而不是类型是float。

In Java, the decimal precision of a float is about 6-7 digits, but the number of decimal places in the figure below clearly exceeds this precision, so Double must be used.

在Java中float的小数精度为6~7位,但是下图中的小数位数明显超出了这个精度,因此必须用Double。

Image

My understanding of the Milvus SDK is limited, but from my impression, since Java applications don't particularly care about memory usage, all parameter types tend to be written as larger ones. There's almost no need to use the float type; it's either double or BigDecimal.

我对milvus的sdk了解不多,但是在我印象中,因为Java应用并不是很在乎内存占用,所有参数类型都是往大了写,几乎没有使用float类型的必要,要么double、要么BigDecimal

@TomerAberbach
Copy link
Collaborator

OpenAI's OpenAPI spec defines an embedding like so:

embedding:
  type: array
  items:
    type: number

There is no format: float so it's purposefully a List<Double>

@kwhinnery-openai is this intentional?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants