diff --git a/src/promptflow-core/promptflow/core/_connection_provider/_utils.py b/src/promptflow-core/promptflow/core/_connection_provider/_utils.py index 6594c2dd1d1..97dd00029b6 100644 --- a/src/promptflow-core/promptflow/core/_connection_provider/_utils.py +++ b/src/promptflow-core/promptflow/core/_connection_provider/_utils.py @@ -3,9 +3,9 @@ # --------------------------------------------------------- import os -from promptflow._constants import PF_NO_INTERACTIVE_LOGIN, AzureWorkspaceKind +from promptflow._constants import PF_NO_INTERACTIVE_LOGIN from promptflow._utils.user_agent_utils import ClientUserAgentUtil -from promptflow.core._errors import MissingRequiredPackage, UnsupportedWorkspaceKind +from promptflow.core._errors import MissingRequiredPackage from promptflow.exceptions import ValidationException @@ -67,14 +67,3 @@ def interactive_credential_disabled(): def is_from_cli(): """Check if the current execution is from promptflow-cli.""" return "promptflow-cli" in ClientUserAgentUtil.get_user_agent() - - -def check_connection_provider_resource(resource_id: str, credential, pkg_name): - from .._utils import get_workspace_from_resource_id - - workspace = get_workspace_from_resource_id(resource_id, credential, pkg_name) - if workspace._kind not in [AzureWorkspaceKind.DEFAULT, AzureWorkspaceKind.PROJECT]: - raise UnsupportedWorkspaceKind( - message=f"Workspace kind {workspace._kind!r} is not supported. " - f"Please use either an azure machine learning workspace or an azure ai project." - ) diff --git a/src/promptflow-core/promptflow/core/_connection_provider/_workspace_connection_provider.py b/src/promptflow-core/promptflow/core/_connection_provider/_workspace_connection_provider.py index b8c16b23a46..4e038f93819 100644 --- a/src/promptflow-core/promptflow/core/_connection_provider/_workspace_connection_provider.py +++ b/src/promptflow-core/promptflow/core/_connection_provider/_workspace_connection_provider.py @@ -26,12 +26,7 @@ from ..._utils.credential_utils import get_default_azure_credential from ._connection_provider import ConnectionProvider -from ._utils import ( - check_connection_provider_resource, - interactive_credential_disabled, - is_from_cli, - is_github_codespaces, -) +from ._utils import interactive_credential_disabled, is_from_cli, is_github_codespaces GET_CONNECTION_URL = ( "/subscriptions/{sub}/resourcegroups/{rg}/providers/Microsoft.MachineLearningServices" @@ -86,7 +81,6 @@ def __init__( self.resource_id = AML_WORKSPACE_TEMPLATE.format( self.subscription_id, self.resource_group_name, self.workspace_name ) - self._workspace_checked = False @property def credential(self): @@ -441,12 +435,6 @@ def _build_list_connection_dict( return rest_list_connection_dict def list(self) -> List[_Connection]: - if not self._workspace_checked: - # Check workspace not 'hub' - check_connection_provider_resource( - resource_id=self.resource_id, credential=self.credential, pkg_name="promptflow-core[azureml-serving]" - ) - self._workspace_checked = True rest_list_connection_dict = self._build_list_connection_dict( subscription_id=self.subscription_id, resource_group_name=self.resource_group_name, @@ -462,12 +450,6 @@ def list(self) -> List[_Connection]: return connection_list def get(self, name: str, **kwargs) -> _Connection: - if not self._workspace_checked: - # Check workspace not 'hub' - check_connection_provider_resource( - resource_id=self.resource_id, credential=self.credential, pkg_name="promptflow-core[azureml-serving]" - ) - self._workspace_checked = True connection_dict = self._build_connection_dict( name, subscription_id=self.subscription_id,