-
[Executor] Refine the logic of updating operation context (#1848)
发布于
2024-01-30 06:23:29 +00:00 Description
This pull request primarily focuses on refactoring the operation context
handling in thepromptflowpackage. The changes are spread across
multiple files, with the main modifications being the removal of direct
OperationContextusage and the addition of the
_update_operation_contextmethod in several places. The test suite was
also updated to reflect these changes and to improve the testing of
telemetry information.Refactoring of operation context handling:
src/promptflow/promptflow/_core/flow_execution_context.py:
Removed direct usage ofOperationContextand removed the
_update_operation_contextmethod. Instead, the operation context is
updated in theinvoke_toolmethod.
[1]
[2]
[3]
*
src/promptflow/promptflow/executor/_script_executor.py:
Removed direct usage ofOperationContextand updated theexec_line
method to call_update_operation_context.
[1]
[2]
*
src/promptflow/promptflow/executor/flow_executor.py:
Updated theexec_lineand_execmethods to call
_update_operation_contextand added the_update_operation_context
method.
[1]
[2]
[3]Updates to test suite:
src/promptflow/tests/executor/e2etests/test_telemetry.py:
Added new methods to setup mocks and updated the
test_executor_openai_telemetrymethod to use these mocks and to test
the telemetry information in more detail. A new test method
test_executor_openai_telemetry_with_batch_runwas also added.
[1]
[2]
[3]
*
src/promptflow/tests/executor/process_utils.py:
Added a new file to handle mocking in processes.
*
src/promptflow/tests/test_configs/flows/openai_chat_api_flow/stream_inputs.jsonl:
Added new test inputs.All Promptflow Contribution checklist:
- The pull request does not introduce [breaking changes].
- CHANGELOG is updated for new features, bug fixes or other
significant changes. - I have read the contribution guidelines.
- Create an issue and link to the pull request to get dedicated
review from promptflow team. Learn more: suggested
workflow.
General Guidelines and Best Practices
- Title of the pull request is clear and informative.
- There are a small number of commits, each of which have an
informative message. This means that previously merged commits do not
appear in the history of the PR. For more information on cleaning up the
commits in your PR, see this
page.
Testing Guidelines
- Pull request includes test coverage for the included changes.
Co-authored-by: Lina Tang linatang@microsoft.com
下载附件