From 125f0de76923d481b4669e125a18e414ed145451 Mon Sep 17 00:00:00 2001 From: cs_lucky Date: Fri, 20 Oct 2023 16:18:15 +0800 Subject: [PATCH 1/7] add schema --- src/promptflow/promptflow/_utils/connection_utils.py | 1 + 1 file changed, 1 insertion(+) 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 }} From ef9de8c22e5d45e9cc9de34f64c198762b29fc42 Mon Sep 17 00:00:00 2001 From: cs_lucky Date: Fri, 20 Oct 2023 16:37:28 +0800 Subject: [PATCH 2/7] fix uts --- .../tests/executor/unittests/_core/test_tools_manager.py | 2 ++ 1 file changed, 2 insertions(+) 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..29cb124485e 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", @@ -183,6 +184,7 @@ def test_collect_package_tools_and_connections(self, install_custom_tool_pkg): tools, specs, templates = collect_package_tools_and_connections(keys) assert len(templates) == 1 expected_template = """ + $schema: https://azuremlschemas.azureedge.net/promptflow/latest/CustomStrongTypeConnection.schema.json, name: "to_replace_with_connection_name" type: custom custom_type: MyCustomConnection From 05d9088211babc4ffb6b410ea3d252618d0aa0c2 Mon Sep 17 00:00:00 2001 From: cs_lucky Date: Fri, 20 Oct 2023 17:08:42 +0800 Subject: [PATCH 3/7] fix tests --- .../tests/executor/unittests/_core/test_tools_manager.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 29cb124485e..57ae5f7776c 100644 --- a/src/promptflow/tests/executor/unittests/_core/test_tools_manager.py +++ b/src/promptflow/tests/executor/unittests/_core/test_tools_manager.py @@ -167,7 +167,6 @@ 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", @@ -184,7 +183,7 @@ def test_collect_package_tools_and_connections(self, install_custom_tool_pkg): tools, specs, templates = collect_package_tools_and_connections(keys) assert len(templates) == 1 expected_template = """ - $schema: https://azuremlschemas.azureedge.net/promptflow/latest/CustomStrongTypeConnection.schema.json, + $schema: https://azuremlschemas.azureedge.net/promptflow/latest/CustomStrongTypeConnection.schema.json name: "to_replace_with_connection_name" type: custom custom_type: MyCustomConnection From 6004aa4e744b59d39a3c90372e44cf242508dcfb Mon Sep 17 00:00:00 2001 From: cs_lucky Date: Mon, 23 Oct 2023 09:34:42 +0800 Subject: [PATCH 4/7] fix schema --- .../tests/executor/unittests/_core/test_tools_manager.py | 1 + 1 file changed, 1 insertion(+) 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 57ae5f7776c..aa7b15481f6 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", From 76610f29ab654193daa6b0727889dac41d9725eb Mon Sep 17 00:00:00 2001 From: cs_lucky Date: Mon, 23 Oct 2023 09:39:08 +0800 Subject: [PATCH 5/7] fix schema --- .../tests/executor/unittests/_core/test_tools_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 aa7b15481f6..74b3ac63ee6 100644 --- a/src/promptflow/tests/executor/unittests/_core/test_tools_manager.py +++ b/src/promptflow/tests/executor/unittests/_core/test_tools_manager.py @@ -167,7 +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", + "$schema": "https://azuremlschemas.azureedge.net/promptflow/latest/CustomStrongTypeConnection.schema.json", "name": "to_replace_with_connection_name", "type": "custom", "custom_type": "MyFirstConnection", From c7db086a11b2a3e4f125f2ad653a81b2d02d391d Mon Sep 17 00:00:00 2001 From: cs_lucky Date: Mon, 23 Oct 2023 10:03:26 +0800 Subject: [PATCH 6/7] fix uts --- .../tests/executor/unittests/_core/test_tools_manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 74b3ac63ee6..f9e676a3efb 100644 --- a/src/promptflow/tests/executor/unittests/_core/test_tools_manager.py +++ b/src/promptflow/tests/executor/unittests/_core/test_tools_manager.py @@ -184,7 +184,8 @@ def test_collect_package_tools_and_connections(self, install_custom_tool_pkg): tools, specs, templates = collect_package_tools_and_connections(keys) assert len(templates) == 1 expected_template = """ - $schema: https://azuremlschemas.azureedge.net/promptflow/latest/CustomStrongTypeConnection.schema.json + $schema: + https://azuremlschemas.azureedge.net/promptflow/latest/CustomStrongTypeConnection.schema.json name: "to_replace_with_connection_name" type: custom custom_type: MyCustomConnection @@ -199,5 +200,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 From ac3d1f666cc17781551101d15085f8f0a84a4fdb Mon Sep 17 00:00:00 2001 From: cs_lucky Date: Mon, 23 Oct 2023 10:07:32 +0800 Subject: [PATCH 7/7] fix uts --- .../tests/executor/unittests/_core/test_tools_manager.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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 f9e676a3efb..2ea8e5ec6b5 100644 --- a/src/promptflow/tests/executor/unittests/_core/test_tools_manager.py +++ b/src/promptflow/tests/executor/unittests/_core/test_tools_manager.py @@ -184,8 +184,6 @@ def test_collect_package_tools_and_connections(self, install_custom_tool_pkg): tools, specs, templates = collect_package_tools_and_connections(keys) assert len(templates) == 1 expected_template = """ - $schema: - https://azuremlschemas.azureedge.net/promptflow/latest/CustomStrongTypeConnection.schema.json name: "to_replace_with_connection_name" type: custom custom_type: MyCustomConnection @@ -200,4 +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