Repository navigation
Conversation
Signed-off-by: Liu Hao <169072815+lll-hhh@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EmbeddingClient.get_embedding([a, b, c])returns vectors in response-array order, ignoring each embedding'sindex. An OpenAI-compatible endpoint returning indices[2, 0, 1]therefore associates every vector with the wrong input.Sort batch response entries by their input index before extracting vectors. Single-string requests and the existing failure fallback retain their behavior. The regression uses a real OpenAI SDK
CreateEmbeddingResponsewith shuffled entries; the ordered-response fixture now also supplies the SDK's index field.Validation on Windows / Python 3.12:
main(0fa8c4d); the eight existing embedding tests pass there.OPENAI_API_KEY=test-key-for-unit-tests python -m unittest tests.test_embedding tests.test_embedding_api_base tests.test_novelty_rejection tests.test_novelty_response_parsing -v: 23 passed.isort,black) andgit diff --checkpass.python -m unittest discover testson both head and untouched base in the same environment. Head ran 1,075 tests and base ran 1,074. Both reported 24 failures, 94 errors and 8 skips; the 118 failing test/subtest identities are identical after normalizing generated temporary-directory names. The added regression passes on head. The complete suite is not green locally; no new failing tests were introduced in that comparison.No real embedding requests or model inference were used. AI assistance: Codex investigated, implemented and validated this change.