fix(openai): Avoid consuming iterables passed to the Embeddings API#5491
fix(openai): Avoid consuming iterables passed to the Embeddings API#5491alexander-alderman-webb merged 5 commits intomasterfrom
Conversation
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Bug Fixes 🐛
Documentation 📚
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Codecov Results 📊✅ 13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 4.46s 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ❌ Patch coverage is 0.00%. Project has 13682 uncovered lines. Files with missing lines (180)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 25.70% 30.83% +5.13%
==========================================
Files 189 189 —
Lines 19767 19779 +12
Branches 6408 6412 +4
==========================================
+ Hits 5080 6097 +1017
- Misses 14687 13682 -1005
- Partials 420 467 +47Generated by Codecov Action |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
ericapisani
left a comment
There was a problem hiding this comment.
Marking as approved so as not to block since the things I mentioned earlier are cleanups
Description
Avoid consuming single-use iterators passed to the Embeddings API.
Consumable iterables nested inside the
inputobject are out of scope for this PR.All iterables that are not dictionaries or strings are transformed to lists in the internals of
openaibefore they are passed to the API call:https://github.com/openai/openai-python/blob/3e0c05b84a2056870abf3bd6a5e7849020209cc3/src/openai/_utils/_transform.py#L154
Issues
Reminders
tox -e linters.feat:,fix:,ref:,meta:)