-
Notifications
You must be signed in to change notification settings - Fork 781
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
[Executor] Convert sync generator to async generator #3144
Conversation
promptflow SDK CLI Azure E2E Test Result heta/sync-to-async 4 files 4 suites 4m 10s ⏱️ Results for commit b80d729. ♻️ This comment has been updated with latest results. |
promptflow-core test result0 tests 0 ✅ 0s ⏱️ Results for commit b80d729. ♻️ This comment has been updated with latest results. |
SDK CLI Global Config Test Result heta/sync-to-async6 tests 6 ✅ 1m 17s ⏱️ Results for commit b80d729. ♻️ This comment has been updated with latest results. |
Executor Unit Test Result heta/sync-to-async796 tests 796 ✅ 3m 44s ⏱️ Results for commit b80d729. ♻️ This comment has been updated with latest results. |
Executor E2E Test Result heta/sync-to-async243 tests 238 ✅ 5m 38s ⏱️ Results for commit b80d729. ♻️ This comment has been updated with latest results. |
SDK CLI Test Result heta/sync-to-async 4 files 4 suites 1h 3m 35s ⏱️ Results for commit b80d729. ♻️ This comment has been updated with latest results. |
Description
Quick fix for the issue #3069
This pull request primarily focuses on changes to the
promptflow-core
package to improve handling of synchronous and asynchronous iterators. The most significant changes include the creation of a new functionsync_iterator_to_async
inasync_utils.py
and its subsequent integration into theflow_executor.py
module.Here are the key changes, grouped by theme:
Addition of new utility function:
src/promptflow-core/promptflow/_utils/async_utils.py
: A new functionsync_iterator_to_async
has been added. This function converts a synchronous iterator to an asynchronous one using a thread pool executor.Changes to the
flow_executor.py
module:src/promptflow-core/promptflow/executor/flow_executor.py
: Thesync_iterator_to_async
function has been imported fromasync_utils.py
and integrated into several methods. [1] [2] [3] [4] [5]src/promptflow-core/promptflow/executor/flow_executor.py
: The typeGeneratorType
has been replaced withIterator
andAsyncGeneratorType
withAsyncIterator
in several methods. This change reflects the shift towards using the more generalIterator
andAsyncIterator
types. [1] [2] [3] [4]These changes enhance the flexibility of the
promptflow-core
package by allowing it to handle both synchronous and asynchronous iterators effectively.All Promptflow Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines