From 6df5507b84884b08f8fed52f1f4c591d9db5ec32 Mon Sep 17 00:00:00 2001 From: chenslucky <75061414+chenslucky@users.noreply.github.com> Date: Mon, 23 Oct 2023 14:32:30 +0800 Subject: [PATCH] Add schema link for custom strong type connection (#835) # Description Add schema link for custom strong type connection. **vscode extension create connection test:** ![image](https://github.com/microsoft/promptflow/assets/75061414/1f1acd44-b803-4b92-b23f-f93763049bfa) **flow test with connection:** ![image](https://github.com/microsoft/promptflow/assets/75061414/07150c90-dc0a-40b1-9ea3-a0defe464381) # 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 - [ ] Pull request includes test coverage for the included changes. --------- Co-authored-by: cs_lucky --- src/promptflow/promptflow/_utils/connection_utils.py | 1 + .../tests/executor/unittests/_core/test_tools_manager.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/promptflow/promptflow/_utils/connection_utils.py b/src/promptflow/promptflow/_utils/connection_utils.py index be16b1d64a3..5ea3cb6ff4d 100644 --- a/src/promptflow/promptflow/_utils/connection_utils.py +++ b/src/promptflow/promptflow/_utils/connection_utils.py @@ -37,6 +37,7 @@ def generate_custom_strong_type_connection_spec(cls, package, package_version): def generate_custom_strong_type_connection_template(cls, connection_spec, package, package_version): connection_template_str = """ + $schema: https://azuremlschemas.azureedge.net/promptflow/latest/CustomStrongTypeConnection.schema.json name: "to_replace_with_connection_name" type: custom custom_type: {{ custom_type }} diff --git a/src/promptflow/tests/executor/unittests/_core/test_tools_manager.py b/src/promptflow/tests/executor/unittests/_core/test_tools_manager.py index 36a5ebe6559..2ea8e5ec6b5 100644 --- a/src/promptflow/tests/executor/unittests/_core/test_tools_manager.py +++ b/src/promptflow/tests/executor/unittests/_core/test_tools_manager.py @@ -167,6 +167,7 @@ def test_collect_package_tools_and_connections(self, install_custom_tool_pkg): } expected_template = { + "$schema": "https://azuremlschemas.azureedge.net/promptflow/latest/CustomStrongTypeConnection.schema.json", "name": "to_replace_with_connection_name", "type": "custom", "custom_type": "MyFirstConnection", @@ -197,5 +198,4 @@ def test_collect_package_tools_and_connections(self, install_custom_tool_pkg): content = templates["my_tool_package.tools.my_tool_with_custom_strong_type_connection.MyCustomConnection"] expected_template_str = textwrap.dedent(expected_template) - - assert content in expected_template_str + assert expected_template_str in content