Skip to content
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

feat: tool meta generation perf optimization #1250

Merged
merged 4 commits into from
Nov 28, 2023

Conversation

elliotzh
Copy link
Contributor

@elliotzh elliotzh commented Nov 23, 2023

This pull request includes various changes to improve the functionality and structure of the codebase. The most important changes include adding a new test method to test the behavior of a specific method, updating a method to use a new type and adding a new parameter, and adding a new Python file with a function for parsing JSON.

Perf change:

  • e2e time for pfutil command: ~10.10s => 5.74s (cut for 44%)
  • Measure-Command { C:\Users\yangtongxu\AppData\Local\miniconda3\envs\py39_promptflow\python.exe c:\Users\yangtongxu.vscode\extensions\prompt-flow.prompt-flow-1.5.0\pfutil\pfutil.py tool -f hello.py -wd c:\Users\yangtongxu\code\promptflow\examples\flows\standard\basic-with-connection -o c:\Users\yangtongxu\code\promptflow\examples\flows\standard\basic-with-connection.promptflow\flow.tools.json }

Main code changes:

  • src/promptflow/promptflow/_sdk/_utils.py: Various changes to the _utils.py file, including adding a new function, updating import statements, improving print statements, removing unused imports, and adding new parameters to existing functions. [1] [2] [3] [4] [5] [6] [7]
  • src/promptflow/promptflow/_sdk/operations/_flow_operations.py: Updating the _generate_tools_meta method to use the ProtectedFlow type, adding a new parameter timeout to the method, updating import statements, renaming and specifying the type of the flow parameter in the validate function, and adding a new decorator and default parameter to the _generate_tools_meta function. [1] [2] [3] [4] [5] [6]

Testing improvements:

  • src/promptflow/tests/sdk_cli_test/e2etests/test_flow_local_operations.py: Added a new test method test_flow_generate_tools_meta_timeout to test the behavior of the _generate_tools_meta method when a timeout occurs.

Configuration changes:

  • src/promptflow/tests/test_configs/flows/web_classification_invalid/flow.dag.yaml: Removed the line - ../external_files/convert_to_dict.py from the additional_includes section in web_classification_invalid/flow.dag.yaml.

New file addition:

  • src/promptflow/tests/test_configs/flows/web_classification_invalid/convert_to_dict.py: Added a new Python file convert_to_dict.py in the web_classification_invalid directory, which contains a function convert_to_dict that parses a string as JSON and returns the parsed JSON object or a default dictionary if parsing fails.# 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.
  • 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.

Copy link

github-actions bot commented Nov 23, 2023

SDK CLI Global Config Test Result zhangxingzhi/tool-meta-generation-perf-optimization

2 tests   2 ✔️  49s ⏱️
1 suites  0 💤
1 files    0

Results for commit b443065.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Nov 23, 2023

Executor Unit Test Result zhangxingzhi/tool-meta-generation-perf-optimization

573 tests   572 ✔️  48s ⏱️
    1 suites      1 💤
    1 files        0

Results for commit b443065.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Nov 23, 2023

Executor E2E Test Result zhangxingzhi/tool-meta-generation-perf-optimization

141 tests   137 ✔️  1m 43s ⏱️
    1 suites      4 💤
    1 files        0

Results for commit b443065.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Nov 23, 2023

promptflow SDK CLI Azure E2E Test Result zhangxingzhi/tool-meta-generation-perf-optimization

    2 files      2 suites   1m 46s ⏱️
105 tests   87 ✔️ 18 💤 0
210 runs  174 ✔️ 36 💤 0

Results for commit b443065.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Nov 23, 2023

SDK PFS E2E Test Result zhangxingzhi/tool-meta-generation-perf-optimization

  2 files    2 suites   1m 14s ⏱️
15 tests 15 ✔️ 0 💤 0
30 runs  30 ✔️ 0 💤 0

Results for commit b443065.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Nov 23, 2023

SDK CLI Test Result zhangxingzhi/tool-meta-generation-perf-optimization

2 files  2 suites   17s ⏱️
1 tests 1 ✔️ 0 💤 0
2 runs  2 ✔️ 0 💤 0

Results for commit b443065.

♻️ This comment has been updated with latest results.

@elliotzh elliotzh force-pushed the zhangxingzhi/tool-meta-generation-perf-optimization branch from 1764ba8 to 0112855 Compare November 24, 2023 06:55
wangchao1230
wangchao1230 previously approved these changes Nov 24, 2023
@elliotzh elliotzh force-pushed the zhangxingzhi/tool-meta-generation-perf-optimization branch from b527dff to b443065 Compare November 28, 2023 09:13
@elliotzh elliotzh merged commit 33c23b3 into main Nov 28, 2023
33 checks passed
@elliotzh elliotzh deleted the zhangxingzhi/tool-meta-generation-perf-optimization branch November 28, 2023 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
promptflow sdk prompt flow SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants