Using the Python library provided by OpenAI, embeddings requests return floats with up to 18 decimal places of precision. Using other methods (curl, hyper/reqwest) only returns floats with half the level of precision.
Anyone should be able to reproduce this by simply copy/pasting the example request provided in the documentation:
curl https://api.openai.com/v1/embeddings \
-X POST \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"input": "The food was delicious and the waiter...",
"model": "text-embedding-ada-002"}'
vs
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.Embedding.create(
model="text-embedding-ada-002",
input="The food was delicious and the waiter..."
)
Unless there is something that I’m missing (quite possible), this would seem to be a pretty big problem for anyone interested in using or building a library outside of the one provided in Python.