chroma
chroma copied to clipboard
[bugfix] Ensure Openai batch embeddings are sorted by index
Description of changes
The OpenAI documentation warns that "the response object may not return completions in the order of the prompts, so always remember to match responses back to prompts using the index field."
This PR sorts the returned embeddings by index so that they are guaranteed to be in order.
Test plan
I apologize but I was in a hurry and haven't tested this yet, so hopefully a kind maintainer will run a test for me. I wanted to get the PR in because this could be a silent but deadly bug.
Documentation Changes
Bug fix, no user facing changes