-
Notifications
You must be signed in to change notification settings - Fork 904
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
[SDK] Support streaming in eager mode #2248
Conversation
SDK CLI Global Config Test Result wanhan/eager_flow_steaming2 tests 2 ✅ 47s ⏱️ Results for commit 0158ae2. ♻️ This comment has been updated with latest results. |
promptflow-tracing unit test result wanhan/eager_flow_steaming 4 files 4 suites 22s ⏱️ Results for commit 0158ae2. ♻️ This comment has been updated with latest results. |
Executor Unit Test Result wanhan/eager_flow_steaming754 tests 754 ✅ 3m 49s ⏱️ Results for commit 0158ae2. ♻️ This comment has been updated with latest results. |
promptflow SDK CLI Azure E2E Test Result wanhan/eager_flow_steaming 4 files 4 suites 3m 47s ⏱️ Results for commit 0158ae2. ♻️ This comment has been updated with latest results. |
Executor E2E Test Result wanhan/eager_flow_steaming211 tests 209 ✅ 6m 52s ⏱️ Results for commit 0158ae2. ♻️ This comment has been updated with latest results. |
SDK CLI Test Result wanhan/eager_flow_steaming 12 files 12 suites 40m 56s ⏱️ Results for commit 0158ae2. ♻️ This comment has been updated with latest results. |
promptflow-tracing e2e test result wanhan/eager_flow_steaming 4 files 4 suites 1m 51s ⏱️ Results for commit 0158ae2. ♻️ This comment has been updated with latest results. |
Description
Please add an informative description that covers that changes made by the pull request and link all relevant issues.
This pull request involves changes across multiple files in the
src/promptflow
directory, primarily focusing on improving generator output handling and testing. The main changes include the introduction of generator output handling intest_submitter.py
and_script_executor.py
, addition of new test cases for generator outputs, and modification of existing methods to support generator outputs.Generator output handling:
src/promptflow/promptflow/_sdk/_submitter/test_submitter.py
: Theflow_test
method has been simplified to always call_get_generator_outputs
online_result.output
[1]. The_get_generator_outputs
method has been expanded to handle both dictionary and generator type outputs [2].src/promptflow/promptflow/executor/_script_executor.py
: ImportedGeneratorType
from thetypes
module [1]. Updated theexec_line
and_exec_line
methods to accept a newallow_generator_output
parameter [2]. Depending on the value ofallow_generator_output
, the output is either stringified or left as is [3]. Added a new_stringify_generator_output
method to convert generator output to a string [4].Test case additions and modifications:
src/promptflow/tests/sdk_cli_test/conftest.py
: Added a new fixturestream_output
for testing generator outputs.src/promptflow/tests/sdk_cli_test/e2etests/test_flow_serve.py
: Added a new test casetest_eager_flow_stream_output
to test different response types for generator outputs.src/promptflow/tests/sdk_cli_test/e2etests/test_flow_test.py
: Added two new test casestest_eager_flow_stream_output
andtest_stream_output_with_builtin_llm
to test generator outputs in eager flows and with built-in language models respectively.Additional changes:
src/promptflow/promptflow/_sdk/operations/_flow_operations.py
: A comment has been added in the_test
method to indicate thatis_chat_flow
is set to True to allow generator output.src/promptflow/tests/test_configs/eager_flows/builtin_llm/builtin_call.py
: Theflow_entry
function has been updated to pass astream
parameter to thechat
function.src/promptflow/tests/test_configs/eager_flows/stream_output/stream_output.py
: A new Python file has been added that defines a generator functionmy_flow
.All Promptflow Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines