diff --git a/src/promptflow-devkit/promptflow/_sdk/operations/_local_azure_connection_operations.py b/src/promptflow-devkit/promptflow/_sdk/operations/_local_azure_connection_operations.py index d676d2a9661..df771dd3b92 100644 --- a/src/promptflow-devkit/promptflow/_sdk/operations/_local_azure_connection_operations.py +++ b/src/promptflow-devkit/promptflow/_sdk/operations/_local_azure_connection_operations.py @@ -105,7 +105,17 @@ def get(self, name: str, **kwargs) -> _Connection: :param name: Name of the connection. :type name: str - :return: connection object retrieved from the database. + :return: connection object retrieved from Azure. + :rtype: ~promptflow.sdk.entities._connection._Connection + """ + return self._get(name, **kwargs) + + def _get(self, name: str, **kwargs) -> _Connection: + """Get a connection entity. + + :param name: Name of the connection. + :type name: str + :return: connection object retrieved from Azure. :rtype: ~promptflow.sdk.entities._connection._Connection """ with_secrets = kwargs.get("with_secrets", False) diff --git a/src/promptflow-devkit/tests/sdk_cli_global_config_test/e2etests/test_global_config.py b/src/promptflow-devkit/tests/sdk_cli_global_config_test/e2etests/test_global_config.py index b7553962944..f0d0dee59a4 100644 --- a/src/promptflow-devkit/tests/sdk_cli_global_config_test/e2etests/test_global_config.py +++ b/src/promptflow-devkit/tests/sdk_cli_global_config_test/e2etests/test_global_config.py @@ -4,10 +4,13 @@ from promptflow._sdk._load_functions import load_flow from promptflow._sdk.entities._flows._flow_context_resolver import FlowContextResolver +from promptflow.core import Prompty from promptflow.core._connection_provider._workspace_connection_provider import WorkspaceConnectionProvider -FLOWS_DIR = PROMPTFLOW_ROOT / "tests" / "test_configs" / "flows" -DATAS_DIR = PROMPTFLOW_ROOT / "tests" / "test_configs" / "datas" +TEST_CONFIG_DIR = PROMPTFLOW_ROOT / "tests" / "test_configs" +FLOWS_DIR = TEST_CONFIG_DIR / "flows" +DATAS_DIR = TEST_CONFIG_DIR / "datas" +PROMPTY_DIR = TEST_CONFIG_DIR / "prompty" @pytest.mark.usefixtures("global_config") @@ -45,3 +48,9 @@ def assert_client(mock_self, provider, **kwargs): flow = load_flow(source=f"{FLOWS_DIR}/web_classification") with mock.patch("promptflow.core._serving.flow_invoker.FlowInvoker.resolve_connections", assert_client): FlowContextResolver.resolve(flow=flow) + + def test_prompty_callable(self, pf): + # Test prompty callable with global config ws connection + prompty = Prompty.load(source=f"{PROMPTY_DIR}/prompty_example.prompty") + result = prompty(question="what is the result of 1+1?") + assert "2" in result