-
Notifications
You must be signed in to change notification settings - Fork 918
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
Enable executor recording mode #1754
Closed
Closed
Conversation
This file contains 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
# Description enable test_collect_package_tools_if_node_source_tool_is_legacy # All Promptflow Contribution checklist: - [X] **The pull request does not introduce [breaking changes].** - [ ] **CHANGELOG is updated for new features, bug fixes or other significant changes.** - [X] **I have read the [contribution guidelines](../CONTRIBUTING.md).** - [ ] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#suggested-workflow).** ## General Guidelines and Best Practices - [X] Title of the pull request is clear and informative. - [X] 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](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [X] Pull request includes test coverage for the included changes.
…1350) # Description This pull request introduces changes to the CODEOWNERS file to designate promptflow-execution as the required code reviewer for specific folders within the repository. This change aims to streamline the review process by automatically involving the promptflow-execution team when changes are made to the areas they own. By enforcing this, we ensure that any modifications to these parts of the codebase are thoroughly reviewed by the appropriate experts. The folders for which promptflow-execution has been added as code owner are: - src/promptflow/promptflow/_core - src/promptflow/promptflow/_internal - src/promptflow/promptflow/batch - src/promptflow/promptflow/executor - src/promptflow/promptflow/integrations - src/promptflow/promptflow/storage - src/promptflow/tests/executor # All Promptflow Contribution checklist: - [X] **The pull request does not introduce [breaking changes].** - [X] **CHANGELOG is updated for new features, bug fixes or other significant changes.** - [X] **I have read the [contribution guidelines](../CONTRIBUTING.md).** - [X] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#suggested-workflow).** ## General Guidelines and Best Practices - [X] Title of the pull request is clear and informative. - [X] 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](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [X] Pull request includes test coverage for the included changes.
This pull request includes changes related to adding telemetry logging with custom dimensions for workspace information in the PromptFlow Azure CLI. The most important changes include adding a new function `_get_workspace_info(args)` and modifying the `entry` function in `_pf_azure/entry.py` to support telemetry logging, as well as adding an import statement for the `contextlib` module and a new test method `test_cli_telemetry` in `test_cli_with_azure.py` to verify the correctness of telemetry logging. Main changes: * <a href="diffhunk://#diff-3f1dd7459115086f5d3af3d298744079416aebf0a0a99d19883591e7e053cf19R91-R102">`src/promptflow/promptflow/_cli/_pf_azure/entry.py`</a>: Added a new function `_get_workspace_info(args)` and modified the `entry` function to support telemetry logging with custom dimensions related to the workspace information. <a href="diffhunk://#diff-3f1dd7459115086f5d3af3d298744079416aebf0a0a99d19883591e7e053cf19R91-R102">[1]</a> <a href="diffhunk://#diff-3f1dd7459115086f5d3af3d298744079416aebf0a0a99d19883591e7e053cf19L99-R117">[2]</a> * <a href="diffhunk://#diff-d5a4a429f9ab76787a5800c3c679ac45e94ca9b5193e3f726ab9d528397ee339L4-R11">`src/promptflow/tests/sdk_cli_azure_test/e2etests/test_cli_with_azure.py`</a>: Added an import statement for the `contextlib` module and a new test method `test_cli_telemetry` to verify that telemetry logging with workspace information is working correctly. <a href="diffhunk://#diff-d5a4a429f9ab76787a5800c3c679ac45e94ca9b5193e3f726ab9d528397ee339L4-R11">[1]</a> <a href="diffhunk://#diff-d5a4a429f9ab76787a5800c3c679ac45e94ca9b5193e3f726ab9d528397ee339R172-R196">[2]</a># Description Please add an informative description that covers that changes made by the pull request and link all relevant issues. # 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](../CONTRIBUTING.md).** - [ ] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#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](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [ ] Pull request includes test coverage for the included changes.
…1333) # Description Fix the gap between pf-tools and the openai api when `max_tokens` is 0. OpenAI only supports `max_tokens` is larger than 0. # All Promptflow Contribution checklist: - [x] **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](../CONTRIBUTING.md).** - [ ] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#suggested-workflow).** ## General Guidelines and Best Practices - [x] Title of the pull request is clear and informative. - [x] 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](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [x] Pull request includes test coverage for the included changes. --------- Co-authored-by: cs_lucky <[email protected]>
# Description Add PR check-in criteria for promptflow-tools: - Maintain code quality - Ensure high test coverage - Add Documents # All Promptflow Contribution checklist: - [x] **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](../CONTRIBUTING.md).** - [ ] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#suggested-workflow).** ## General Guidelines and Best Practices - [x] Title of the pull request is clear and informative. - [x] 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](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [ ] Pull request includes test coverage for the included changes. --------- Co-authored-by: cs_lucky <[email protected]>
#1330) This pull request includes changes to the codebase related to request ID handling and logging. The most important changes include adding a new test method to verify the request ID in the headers of the HTTP request, updating the request ID generation and handling in the `flow_service_caller.py` file, and removing a TODO comment related to request ID usage in the `activity.py` file. Request ID handling and logging changes: * <a href="diffhunk://#diff-b63fdccdd1a3a293abe7799c0a231a7226614f726b6de1298f7e0233af26f128R788-R845">`src/promptflow/tests/sdk_cli_azure_test/e2etests/test_run_operations.py`</a>: Added a new test method to verify the request ID in the headers of the HTTP request and its inclusion in the collected logs. * <a href="diffhunk://#diff-b86393accf01fe91e85a51b2064db3f006ebaf7b1a680f67ca282f73fb7e40f2L48-R49">`src/promptflow/promptflow/azure/_restclient/flow_service_caller.py`</a>: Updated the request ID handling by using the `request_id_context` and generating a new UUID if the context is empty. Also updated the `__init__` method of the `RequestTelemetryMixin` class to update the request ID and set the `from_cli` attribute to `False`. * <a href="diffhunk://#diff-e8775c719ab4ac2bb3aef826ea48211abc031f3d56c8a630893fde2c4a577c02L65">`src/promptflow/promptflow/_telemetry/activity.py`</a>: Removed a TODO comment related to request ID usage in the `log_activity` function.# Description Please add an informative description that covers that changes made by the pull request and link all relevant issues. # 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](../CONTRIBUTING.md).** - [ ] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#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](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [ ] Pull request includes test coverage for the included changes.
# Description Please add an informative description that covers that changes made by the pull request and link all relevant issues. https://ms.portal.azure.com/#@microsoft.onmicrosoft.com/resource/subscriptions/96aede12-2f73-41cb-b983-6d11a904839b/resourceGroups/chenyin-test-eastus/providers/Microsoft.Web/sites/chenyin-app-23d8m/appServices ![image](https://github.com/microsoft/promptflow/assets/26239730/a3c63d09-10c9-40e6-8cb0-d04dbd348ed6) # 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](../CONTRIBUTING.md).** - [ ] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#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](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [ ] Pull request includes test coverage for the included changes. --------- Co-authored-by: Ying Chen <[email protected]>
# Description Please add an informative description that covers that changes made by the pull request and link all relevant issues. # All Promptflow Contribution checklist: - [x] **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](../CONTRIBUTING.md).** - [ ] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#suggested-workflow).** ## General Guidelines and Best Practices - [x] 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](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [ ] Pull request includes test coverage for the included changes.
# Description Add e2e tests for executor proxy # All Promptflow Contribution checklist: - [x] **The pull request does not introduce [breaking changes].** - [ ] **CHANGELOG is updated for new features, bug fixes or other significant changes.** - [x] **I have read the [contribution guidelines](../CONTRIBUTING.md).** - [ ] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#suggested-workflow).** ## General Guidelines and Best Practices - [x] Title of the pull request is clear and informative. - [x] 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](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [x] Pull request includes test coverage for the included changes.
# Description Please add an informative description that covers that changes made by the pull request and link all relevant issues. # All Promptflow Contribution checklist: - [x] **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](../CONTRIBUTING.md).** - [ ] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#suggested-workflow).** ## General Guidelines and Best Practices - [x] 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](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [x] Pull request includes test coverage for the included changes.
…hw/pf/executor_recording
crazygao
reviewed
Feb 6, 2024
crazygao
reviewed
Feb 6, 2024
crazygao
reviewed
Feb 6, 2024
crazygao
reviewed
Feb 6, 2024
crazygao
reviewed
Feb 6, 2024
crazygao
reviewed
Feb 6, 2024
chw-microsoft
temporarily deployed
to
internal
February 6, 2024 05:32 — with
GitHub Actions
Inactive
chw-microsoft
temporarily deployed
to
internal
February 6, 2024 05:32 — with
GitHub Actions
Inactive
chw-microsoft
temporarily deployed
to
internal
February 6, 2024 05:32 — with
GitHub Actions
Inactive
chw-microsoft
temporarily deployed
to
internal
February 6, 2024 07:03 — with
GitHub Actions
Inactive
chw-microsoft
temporarily deployed
to
internal
February 6, 2024 07:03 — with
GitHub Actions
Inactive
chw-microsoft
temporarily deployed
to
internal
February 6, 2024 07:03 — with
GitHub Actions
Inactive
crazygao
previously approved these changes
Feb 6, 2024
Executor Unit Test Result705 tests 705 ✅ 50s ⏱️ Results for commit 30b4dd2. |
chw-microsoft
temporarily deployed
to
internal
February 6, 2024 08:42 — with
GitHub Actions
Inactive
chw-microsoft
temporarily deployed
to
internal
February 6, 2024 08:42 — with
GitHub Actions
Inactive
chw-microsoft
temporarily deployed
to
internal
February 6, 2024 08:42 — with
GitHub Actions
Inactive
…hw/pf/executor_recording2
…hw/pf/executor_recording2
chw-microsoft
temporarily deployed
to
internal
February 6, 2024 10:54 — with
GitHub Actions
Inactive
chw-microsoft
temporarily deployed
to
internal
February 6, 2024 10:54 — with
GitHub Actions
Inactive
chw-microsoft
temporarily deployed
to
internal
February 6, 2024 10:54 — with
GitHub Actions
Inactive
Hi, thank you for your interest in helping to improve the prompt flow experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. |
github-actions
bot
added
the
no-recent-activity
There has been no recent activity on this issue/pull request
label
Feb 20, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
executor
The changes related to the execution of the flow
fundamental
no-recent-activity
There has been no recent activity on this issue/pull request
promptflow
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.
Description
This PR is focused on enabling the recording injection mode for CI/tests in the execution environment. The recording mode provides a mechanism to record and replay end-to-end tests, enhancing the reliability and efficiency of our testing process.
For detailed information on the recording mode, please refer to our documentation.
Key Features of This PR:
Generation of Test Records
The generation of records for execution tests when they are missing in the shelve database, to make it work under recording mode.
Multi-Process Compatibility
Resolves issues related to the recording injection mode in a multi-process environment, particularly with processes spawned/forkserver.
What is the issue under multi/new Process(spawn/forkserver)?
Spawn/forkserver mode will not replicate the resources/setups from main Process, including the recording setup. This would make the recording not working anymore.
How you resolved this issue?
There are multiple ways to pass the recording setup in new Process, like environment variable, serializable object as argument etc. But these might incur interface change or too complex to squeeze into simple state object.
We choose to re-import the state into new Process.
Example: For new Process target method _process_wrapper, for define another wrapper method outside and inject the recording state
Enable this new target method whenever new Process spawned/forkservered
Override context.Process or multiprocess.Process class
or
We have implemented above logic in codes and integrated as part of recording injection fixture for testing.
So all the tests under executor/sdk would intercept the third-party call like this as default in CI?
Yes, all the CI is enable with "PROMPT_FLOW_TEST_MODE=replay". All the openai/aoai related calls would be mocked to do recording result retrieval rather than real api request.
Sometimes we might have necessity to customize the openai/AOAI call in tests. How shall we do instead of using the default recording mock?
Yes,
Sample Tests: test_executor_openai_telemetry
In which scope the recording mode is enabled?
The recording mode is enabled per requiriment. If the test are involved with 3rd party service with connection, like openai/aoai etc, it is required to enable recording mode. If not, your PR will fail at the CI tests since the connections info are not configured.
To enable recording mode, just make sure the fixture "recording_injection" is required in your test class level or method level.
Why not make recording mode a session-level fixture or required fixture for all tests?
Note:
Above logic resolved this issue for one layer of new Processing. If you have nested new Processing action , you need to repeat above logic at each layer.
Todos and Ongoing Work[updated]:
[Done]Metrics Mocks
Currently, this openai_injector is skipped as it does not involve actual openai/aoai requests. This omission leads to potential inaccuracies in metrics calculation, especially token usage, in recording mode. Future work will focus on integrating openai_injector.py into the recording mode.
--- this fixed already by [fundamental] Recording support metrics by crazygao · Pull Request #1762 · microsoft/promptflow (github.com)
[Todo]Consolidation of Configuration
Efforts are underway to consolidate the configuration settings for recording injection in both the execution environment and the SDK, aiming for a more unified and streamlined setup.
[Done]Record error info
Record not only regular tool execution result, but also error response if exception ocurr
----- have fixed this in this PR, sample tests: test_executor_node_overrides
[Done]Test langchain
Support langchain test with agent
---- fixed by [fundamental] Recording support metrics by crazygao · Pull Request #1762 · microsoft/promptflow (github.com)
All Promptflow Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines