CapabilityHostsOperations Class
CapabilityHostsOperations.
You should not instantiate this class directly. Instead, you should create an MLClient instance that instantiates it for you and attaches it as an attribute.
Constructor of CapabilityHostsOperations class.
- Inheritance
-
azure.ai.ml._scope_dependent_operations._ScopeDependentOperationsCapabilityHostsOperations
Constructor
CapabilityHostsOperations(operation_scope: OperationScope, operation_config: OperationConfig, service_client_10_2024: AzureMachineLearningWorkspaces, all_operations: OperationsContainer, credentials: TokenCredential, **kwargs: Any)
Parameters
Name | Description |
---|---|
operation_scope
Required
|
<xref:azure.ai.ml._scope_dependent_operations.OperationScope>
Scope variables for the operations classes of an MLClient object. |
operation_config
Required
|
<xref:azure.ai.ml._scope_dependent_operations.OperationConfig>
Common configuration for operations classes of an MLClient object. |
service_client_10_2024
Required
|
<xref:azure.ai.ml._restclient.v2024_10_01_preview._azure_machine_learning_workspaces.AzureMachineLearningWorkspaces >
Service client to allow end users to operate on Azure Machine Learning Workspace resources (ServiceClient102024Preview). |
all_operations
Required
|
<xref:azure.ai.ml._scope_dependent_operations.OperationsContainer>
All operations classes of an MLClient object. |
credentials
Required
|
Credential to use for authentication. |
kwargs
Required
|
Additional keyword arguments. |
operation_scope
Required
|
<xref:azure.ai.ml._scope_dependent_operations.OperationScope>
Scope variables for the operations classes of an MLClient object. |
operation_config
Required
|
<xref:azure.ai.ml._scope_dependent_operations.OperationConfig>
Common configuration for operations classes of an MLClient object. |
service_client_10_2024
Required
|
<xref:azure.ai.ml._restclient.v2024_10_01_preview._azure_machine_learning_workspaces.AzureMachineLearningWorkspaces >
Service client to allow end users to operate on Azure Machine Learning Workspace resources (ServiceClient102024Preview). |
all_operations
Required
|
<xref:azure.ai.ml._scope_dependent_operations.OperationsContainer>
All operations classes of an MLClient object. |
credentials
Required
|
Credential to use for authentication. |
kwargs
Required
|
Additional keyword arguments. |
Methods
begin_create_or_update |
Note This is an experimental method, and may change at any time. Please see https://aka.ms/azuremlexperimental for more information. Begin the creation of a capability host in a Hub or Project workspace. Note that currently this method can only accept the create operation request and not update operation request. |
begin_delete |
Note This is an experimental method, and may change at any time. Please see https://aka.ms/azuremlexperimental for more information. Delete capability host. |
get |
Note This is an experimental method, and may change at any time. Please see https://aka.ms/azuremlexperimental for more information. Retrieve a capability host resource. |
begin_create_or_update
Note
This is an experimental method, and may change at any time. Please see https://aka.ms/azuremlexperimental for more information.
Begin the creation of a capability host in a Hub or Project workspace. Note that currently this method can only accept the create operation request and not update operation request.
begin_create_or_update(capability_host: CapabilityHost, **kwargs: Any) -> LROPoller[CapabilityHost]
Parameters
Name | Description |
---|---|
capability_host
Required
|
The CapabilityHost object containing the details of the capability host to create. |
Returns
Type | Description |
---|---|
An LROPoller object that can be used to track the long-running operation that is creation of capability host. |
Examples
Create example.
from azure.ai.ml import MLClient
from azure.identity import DefaultAzureCredential
from azure.ai.ml.entities._workspace._ai_workspaces.capability_host import (
CapabilityHost,
)
from azure.ai.ml.constants._workspace import CapabilityHostKind
subscription_id = os.environ["AZURE_SUBSCRIPTION_ID"]
resource_group = os.environ["RESOURCE_GROUP_NAME"]
hub_name = "test-hub"
project_name = "test-project"
# Create a CapabilityHost in Hub
ml_client = MLClient(
DefaultAzureCredential(),
subscription_id,
resource_group,
workspace_name=hub_name,
)
capability_host = CapabilityHost(
name="test-capability-host",
description="some description",
capability_host_kind=CapabilityHostKind.AGENTS,
)
result = ml_client.capability_hosts.begin_create_or_update(capability_host).result()
# Create a CapabilityHost in Project
ml_client = MLClient(
DefaultAzureCredential(),
subscription_id,
resource_group,
workspace_name=project_name,
)
capability_host = CapabilityHost(
name="test-capability-host",
description="some description",
capability_host_kind=CapabilityHostKind.AGENTS,
ai_services_connections=["connection1"],
storage_connections=["projectname/workspaceblobstore"],
vector_store_connections=["connection1"],
)
result = ml_client.capability_hosts.begin_create_or_update(capability_host).result()
begin_delete
Note
This is an experimental method, and may change at any time. Please see https://aka.ms/azuremlexperimental for more information.
Delete capability host.
begin_delete(name: str, **kwargs: Any) -> LROPoller[None]
Parameters
Name | Description |
---|---|
name
Required
|
capability host name. |
Returns
Type | Description |
---|---|
A poller for deletion status |
Examples
Delete example.
from azure.ai.ml import MLClient
from azure.identity import DefaultAzureCredential
subscription_id = os.environ["AZURE_SUBSCRIPTION_ID"]
resource_group = os.environ["RESOURCE_GROUP_NAME"]
hub_name = "test-hub"
project_name = "test-project"
# Delete CapabilityHost created in Hub
ml_client = MLClient(
DefaultAzureCredential(),
subscription_id,
resource_group,
workspace_name=hub_name,
)
capability_host = ml_client.capability_hosts.begin_delete(name="test-capability-host")
# Delete CapabilityHost created in Project
ml_client = MLClient(
DefaultAzureCredential(),
subscription_id,
resource_group,
workspace_name=project_name,
)
capability_host = ml_client.capability_hosts.begin_delete(name="test-capability-host")
get
Note
This is an experimental method, and may change at any time. Please see https://aka.ms/azuremlexperimental for more information.
Retrieve a capability host resource.
get(name: str, **kwargs: Any) -> CapabilityHost
Parameters
Name | Description |
---|---|
name
Required
|
The name of the capability host to retrieve. |
Returns
Type | Description |
---|---|
CapabilityHost object. |
Exceptions
Type | Description |
---|---|
Raised if project name or hub name not provided while creation of MLClient object in workspacename param. Details will be provided in the error message. |
|
Raised if Capabilityhost name is not provided. Details will be provided in the error message. |
Examples
Get example.
from azure.ai.ml import MLClient
from azure.identity import DefaultAzureCredential
subscription_id = os.environ["AZURE_SUBSCRIPTION_ID"]
resource_group = os.environ["RESOURCE_GROUP_NAME"]
hub_name = "test-hub"
project_name = "test-project"
# Get CapabilityHost created in Hub
ml_client = MLClient(
DefaultAzureCredential(),
subscription_id,
resource_group,
workspace_name=hub_name,
)
capability_host = ml_client.capability_hosts.get(name="test-capability-host")
# Get CapabilityHost created in Project
ml_client = MLClient(
DefaultAzureCredential(),
subscription_id,
resource_group,
workspace_name=project_name,
)
capability_host = ml_client.capability_hosts.get(name="test-capability-host")
Azure SDK for Python