azure.ai.resources.entities package

class azure.ai.resources.entities.AIResource(*, name: str, description: str | None = None, tags: Dict[str, str] | None = None, display_name: str | None = None, location: str | None = None, resource_group: str | None = None, managed_network: ManagedNetwork | None = None, storage_account: str | None = None, customer_managed_key: CustomerManagedKey | None = None, public_network_access: str | None = None, identity: IdentityConfiguration | None = None, container_registry: str | None = None, primary_user_assigned_identity: str | None = None, default_project_resource_group: str | None = None, **kwargs)[source]

An AI Resource, which serves as a container for projects and other AI-related objects

Parameters:
  • name (str) – The name for the AI resource.

  • description (Optional[str]) – The description of the AI resource.

  • tags (Optional[Dict[str, str]]) – The tags for the AI resource.

  • display_name (Optional[str]) – The display name for the AI resource.

  • location (Optional[str]) – The location for the AI resource.

  • resource_group (Optional[str]) – The resource group associated with the AI resource.

  • managed_network (Optional[ManagedNetwork]) – The managed network associated with the AI resource.

  • storage_account (Optional[str]) – The storage account associated with the AI resource.

  • customer_managed_key (Optional[CustomerManagedKey]) – The customer managed key associated with the AI resource.

  • public_network_access (Optional[str]) – The public network access associated with the AI resource.

  • identity (Optional[IdentityConfiguration]) – The identity associated with the AI resource.

  • container_registry (Optional[str]) – The container registry associated with the AI resource.

  • primary_user_assigned_identity (Optional[str]) – The primary user assigned identity associated with the AI resource.

  • default_project_resource_group (Optional[str]) – The default project’s resource group.

property container_registry: str

The container registry associated with the workspace hub.

Returns:

The container registry associated with the workspace hub.

Return type:

str

property customer_managed_key: CustomerManagedKey | None

The customer managed key associated with the workspace hub.

Returns:

The customer managed key associated with the workspace hub.

Return type:

Optional[CustomerManagedKey]

property default_project_resource_group: str

The default project’s resource group.

Returns:

The name of the default project’s resource group.

Return type:

str

property description: str

The workspace hub description.

Returns:

The workspace hub description.

Return type:

str

property display_name: str

The workspace hub’s display name.

Returns:

The display name of the workspace hub.

Return type:

str

property enable_data_isolation: bool

Whether or not data isolation is enabled for the workspace hub.

Returns:

Boolean value indicating whether or not data isolation is enabled for the workspace hub.

Return type:

bool

property existing_workspaces: List[str]

The existing workspaces related to the workspace hub.

Returns:

The names of the existing workspaces related to the workspace hub.

Return type:

List[str]

property id: str

The workspace hub ID. Read-only, set by the backend.

Returns:

The workspace hub ID.

Return type:

str

property identity: IdentityConfiguration | None

The identity associated with the workspace hub.

Returns:

The identity associated with the workspace hub.

Return type:

Optional[IdentityConfiguration]

property location: str

The workspace hub location.

Returns:

The location of the workspace hub.

Return type:

str

property managed_network: ManagedNetwork | None

The managed network to which the workspace hub is connected.

Returns:

The name of the managed network associated with the workspace hub.

Return type:

Optional[ManagedNetwork]

property name: str

The workspace hub name.

Returns:

The workspace hub name.

Return type:

str

property primary_user_assigned_identity: str

The primary user assigned identity associated with the workspace hub.

Returns:

The primary user assigned identity associated with the workspace hub.

Return type:

str

property public_network_access: str

The public network access to assign to the workspace hub.

Returns:

The public network access to assign to the workspace hub.

Return type:

str

property resource_group: str

The workspace hub’s resource group.

Returns:

The name of the resource group associated with the workspace hub.

Return type:

str

property storage_account: str

The storage account for the workspace hub.

Returns:

The name of the storage account associated with the workspace hub.

Return type:

str

property tags: Dict[str, str] | None

Tags for the workspace hub.

Returns:

The tags of the workspace hub.

Return type:

str

class azure.ai.resources.entities.ApiKeyConfiguration(*, key: str)[source]

Note

This is an experimental class, and may change at any time. Please see https://aka.ms/azuremlexperimental for more information.

Api Key Credentials.

Parameters:

key (str) – API key id

get(key: Any, default: Any | None = None) Any
has_key(k: Any) bool
items() list
keys() list
update(*args: Any, **kwargs: Any) None
values() list
class azure.ai.resources.entities.AzureAISearchConnection(*, target: str, credentials: ApiKeyConfiguration, api_version: str | None = None, **kwargs)[source]

A Connection for Azure AI Search

Parameters:
  • name (str) – Name of the connection.

  • target (str) – The URL or ARM resource ID of the external resource.

  • credentials (ApiKeyConfiguration) – The credentials for authenticating the external resource.

  • api_version (Optional[str]) – The api version that this connection was created for. Only applies to certain connection types.

  • is_shared (bool) – For connections created for a project, this determines if the connection is shared amongst other connections with that project’s parent AI resource. Defaults to True.

  • tags (dict) – Tag dictionary. Tags can be added, removed, and updated.

set_current_environment(credential: TokenCredential | None = None)[source]

Sets the current environment to use the connection. To use AAD auth for AzureOpenAI connetion, pass in a credential object. As a Cognitive Search Connection, this sets two environment variables: AZURE_AI_SEARCH_(ENDPOINT|KEY).

Parameters:

credential (TokenCredential) – Optional credential to use for the connection. If not provided, the connection’s credentials will be used.

property api_version: str | None

The API version of the connection.

Returns:

the API version of the connection.

Return type:

Optional[str]

property credentials: ApiKeyConfiguration

Get the credentials for the connection.

Returns:

This connection’s credentials.

Return type:

ApiKeyConfiguration

property id: str | None

The resource ID.

Returns:

The global ID of the resource, an Azure Resource Manager (ARM) ID.

Return type:

Optional[str]

property is_shared: bool

Get the Boolean describing if this connection is shared amongst its cohort within a workspace hub. Only applicable for connections that are project-scoped on creation.

Return type:

bool

property metadata: Dict[str, Any]

Deprecated. Use tags.

Returns:

This connection’s tags/metadata.

Return type:

Dict[str, Any]

property name: str

The name of the connection.

Returns:

Name of the connection.

Return type:

str

property tags: Dict[str, Any]

Tags for the connection.

Returns:

This connection’s tags.

Return type:

Dict[str, Any]

property target: str

Target url for the connection.

Returns:

The target of the connection.

Return type:

str

property type: str

Get the type of the connection.

Returns:

Type of the connection.

Return type:

str

class azure.ai.resources.entities.AzureAIServiceConnection(*, target: str, credentials: ApiKeyConfiguration, api_version: str | None = None, kind: str, **kwargs)[source]

A Connection for an Azure Cognitive Service. Note: This object usually shouldn’t be created manually by users. To get the default AzureOpenAIConnection for an AI Resource, use an AIClient object to call the ‘get_default_content_safety_connection’ function.

Parameters:
  • name (str) – Name of the connection.

  • target (str) – The URL or ARM resource ID of the external resource.

  • credentials (ApiKeyConfiguration) – The credentials for authenticating the external resource.

  • api_version (Optional[str]) – The api version that this connection was created for.

  • kind (str) – The kind of ai service that this connection points to. Valid inputs include: “AzureOpenAI”, “ContentSafety”, and “Speech”.

  • is_shared (bool) – For connections created for a project, this determines if the connection is shared amongst other connections with that project’s parent AI resource. Defaults to True.

  • tags (dict) – Tag dictionary. Tags can be added, removed, and updated.

set_current_environment(credential: TokenCredential | None = None)

Sets the current environment to use the connection. To use AAD auth for AzureOpenAI connection, pass in a credential object. Only certain types of connections make use of this function. Those that don’t will raise an error if this is called.

Parameters:

credential (TokenCredential) – Optional credential to use for the connection. If not provided, the connection’s credentials will be used.

property api_version: str | None

The API version of the connection.

Returns:

The API version of the connection.

Return type:

Optional[str]

property credentials: ApiKeyConfiguration

Get the credentials for the connection.

Returns:

This connection’s credentials.

Return type:

ApiKeyConfiguration

property id: str | None

The resource ID.

Returns:

The global ID of the resource, an Azure Resource Manager (ARM) ID.

Return type:

Optional[str]

property is_shared: bool

Get the Boolean describing if this connection is shared amongst its cohort within a workspace hub. Only applicable for connections that are project-scoped on creation.

Return type:

bool

property kind: str | None

The kind of the connection.

Returns:

the kind of the connection.

Return type:

Optional[str]

property metadata: Dict[str, Any]

Deprecated. Use tags.

Returns:

This connection’s tags/metadata.

Return type:

Dict[str, Any]

property name: str

The name of the connection.

Returns:

Name of the connection.

Return type:

str

property tags: Dict[str, Any]

Tags for the connection.

Returns:

This connection’s tags.

Return type:

Dict[str, Any]

property target: str

Target url for the connection.

Returns:

The target of the connection.

Return type:

str

property type: str

Get the type of the connection.

Returns:

Type of the connection.

Return type:

str

class azure.ai.resources.entities.AzureBlobStoreConnection(*, target: str, container_name: str, account_name: str, **kwargs)[source]

A Connection to an Azure Blob Datastore. Unlike other connection objects, this subclass has no credentials. NOTE: This connection type is currently READ-ONLY via the LIST operation. Attempts to create or update a connection of this type will result in an error.

Parameters:
  • name (str) – Name of the connection.

  • target (str) – The URL or ARM resource ID of the resource.

  • container_name (str) – The container name of the connection.

  • account_name (str) – The account name of the connection.

  • is_shared (bool) – For connections created for a project, this determines if the connection is shared amongst other connections with that project’s parent AI resource. Defaults to True.

  • tags (dict) – Tag dictionary. Tags can be added, removed, and updated.

set_current_environment(credential: TokenCredential | None = None)

Sets the current environment to use the connection. To use AAD auth for AzureOpenAI connection, pass in a credential object. Only certain types of connections make use of this function. Those that don’t will raise an error if this is called.

Parameters:

credential (TokenCredential) – Optional credential to use for the connection. If not provided, the connection’s credentials will be used.

property account_name: str | None

The account name of the connection.

Returns:

the account name of the connection.

Return type:

Optional[str]

property container_name: str | None

The container name of the connection.

Returns:

the container name of the connection.

Return type:

Optional[str]

property credentials: ApiKeyConfiguration

Get the credentials for the connection.

Returns:

This connection’s credentials.

Return type:

ApiKeyConfiguration

property id: str | None

The resource ID.

Returns:

The global ID of the resource, an Azure Resource Manager (ARM) ID.

Return type:

Optional[str]

property is_shared: bool

Get the Boolean describing if this connection is shared amongst its cohort within a workspace hub. Only applicable for connections that are project-scoped on creation.

Return type:

bool

property metadata: Dict[str, Any]

Deprecated. Use tags.

Returns:

This connection’s tags/metadata.

Return type:

Dict[str, Any]

property name: str

The name of the connection.

Returns:

Name of the connection.

Return type:

str

property tags: Dict[str, Any]

Tags for the connection.

Returns:

This connection’s tags.

Return type:

Dict[str, Any]

property target: str

Target url for the connection.

Returns:

The target of the connection.

Return type:

str

property type: str

Get the type of the connection.

Returns:

Type of the connection.

Return type:

str

class azure.ai.resources.entities.AzureOpenAIConnection(*, target: str, credentials: ApiKeyConfiguration, api_version: str | None = None, api_type: str = 'Azure', **kwargs)[source]

A Connection for Azure Open AI. Note: This object usually shouldn’t be created manually by users. To get the default AzureOpenAIConnection for an AI Resource, use an AIClient object to call the ‘get_default_aoai_connection’ function.

Parameters:
  • name (str) – Name of the connection.

  • target (str) – The URL or ARM resource ID of the external resource.

  • credentials (ApiKeyConfiguration) – The credentials for authenticating the external resource.

  • api_version (Optional[str]) – The api version that this connection was created for.

  • api_type (str) – The api type that this connection was created for. Defaults to “Azure” and currently rarely changes.

  • is_shared (bool) – For connections created for a project, this determines if the connection is shared amongst other connections with that project’s parent AI resource. Defaults to True.

  • tags (dict) – Tag dictionary. Tags can be added, removed, and updated.

set_current_environment(credential: TokenCredential | None = None)[source]

Sets the current environment to use the connection. To use AAD auth for AzureOpenAI connetion, pass in a credential object. As an Azure Open AI connection, this sets 4 environment variables: OPEN_API_(TYPE|KEY|BASE|VERSION).

Parameters:

credential (TokenCredential) – Optional credential to use for the connection. If not provided, the connection’s credentials will be used.

property api_type: str | None

The API type of the connection.

Returns:

The API type of the connection.

Return type:

Optional[str]

property api_version: str | None

The API version of the connection.

Returns:

the API version of the connection.

Return type:

Optional[str]

property credentials: ApiKeyConfiguration

Get the credentials for the connection.

Returns:

This connection’s credentials.

Return type:

ApiKeyConfiguration

property id: str | None

The resource ID.

Returns:

The global ID of the resource, an Azure Resource Manager (ARM) ID.

Return type:

Optional[str]

property is_shared: bool

Get the Boolean describing if this connection is shared amongst its cohort within a workspace hub. Only applicable for connections that are project-scoped on creation.

Return type:

bool

property metadata: Dict[str, Any]

Deprecated. Use tags.

Returns:

This connection’s tags/metadata.

Return type:

Dict[str, Any]

property name: str

The name of the connection.

Returns:

Name of the connection.

Return type:

str

property tags: Dict[str, Any]

Tags for the connection.

Returns:

This connection’s tags.

Return type:

Dict[str, Any]

property target: str

Target url for the connection.

Returns:

The target of the connection.

Return type:

str

property type: str

Get the type of the connection.

Returns:

Type of the connection.

Return type:

str

class azure.ai.resources.entities.AzureOpenAIDeployment(*, sku: _models.AzureOpenAISku, properties: _models.AzureOpenAIDeploymentProperties | None = None, **kwargs: Any)[source]

Concrete proxy resource types can be created by aliasing this type using a specific property type.

Variables are only populated by the server, and will be ignored when sending a request.

All required parameters must be populated in order to send to server.

Variables:
  • id (str) – Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long Required.

  • type (str) – The type of the resource. E.g. “Microsoft.Compute/virtualMachines” or “Microsoft.Storage/storageAccounts”. Required.

  • system_data (SystemData) – Azure Resource Manager metadata containing createdBy and modifiedBy information.

  • properties (AzureOpenAIDeploymentProperties) – The resource-specific properties for this resource.

  • name (str) – The name of the deployment. Required.

  • sku (AzureOpenAISku) – SKU information for deployment. Required.

Keyword Arguments:
  • id (str) – Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long Required.

  • type (str) – The type of the resource. E.g. “Microsoft.Compute/virtualMachines” or “Microsoft.Storage/storageAccounts”. Required.

  • system_data (SystemData) – Azure Resource Manager metadata containing createdBy and modifiedBy information.

  • properties (AzureOpenAIDeploymentProperties) – The resource-specific properties for this resource.

  • name (str) – The name of the deployment. Required.

as_dict(keep_readonly: bool = True, key_transformer: ~typing.Callable[[str, ~typing.Dict[str, ~typing.Any], ~typing.Any], ~typing.Any] = <function attribute_transformer>, **kwargs: ~typing.Any) MutableMapping[str, Any]

Return a dict that can be serialized using json.dump.

Advanced usage might optionally use a callback as parameter:

Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.

The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.

See the three examples in this file:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters:

key_transformer (function) – A key transformer function.

Returns:

A dict JSON compatible object

Return type:

dict

classmethod deserialize(data: Any, content_type: str | None = None) ModelType

Parse a str using the RestAPI syntax and return a model.

Parameters:
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns:

An instance of this model

Raises:

DeserializationError if something went wrong

classmethod enable_additional_properties_sending() None
classmethod from_dict(data: Any, key_extractors: Callable[[str, Dict[str, Any], Any], Any] | None = None, content_type: str | None = None) ModelType

Parse a dict using given key extractor return a model.

By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)

Parameters:
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns:

An instance of this model

Raises:

DeserializationError if something went wrong

classmethod is_xml_model() bool
serialize(keep_readonly: bool = False, **kwargs: Any) MutableMapping[str, Any]

Return the JSON that would be sent to server from this model.

This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters:

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns:

A dict JSON compatible object

Return type:

dict

class azure.ai.resources.entities.AzureOpenAIDeploymentProperties(*, model: _models.AzureOpenAIModel, **kwargs: Any)[source]

Deployment properties.

Variables are only populated by the server, and will be ignored when sending a request.

All required parameters must be populated in order to send to server.

Variables:
  • type (str) – Type of the deployment, defaults to Azure.OpenAI. Required.

  • provisioning_state (str) – provisioning state of deployment. Required.

  • model (AzureOpenAIModel) – Model information for deployment. Required.

Keyword Arguments:
  • type (str) – Type of the deployment, defaults to Azure.OpenAI. Required.

  • provisioning_state (str) – provisioning state of deployment. Required.

  • model (AzureOpenAIModel) – Model information for deployment. Required.

as_dict(keep_readonly: bool = True, key_transformer: ~typing.Callable[[str, ~typing.Dict[str, ~typing.Any], ~typing.Any], ~typing.Any] = <function attribute_transformer>, **kwargs: ~typing.Any) MutableMapping[str, Any]

Return a dict that can be serialized using json.dump.

Advanced usage might optionally use a callback as parameter:

Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.

The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.

See the three examples in this file:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters:

key_transformer (function) – A key transformer function.

Returns:

A dict JSON compatible object

Return type:

dict

classmethod deserialize(data: Any, content_type: str | None = None) ModelType

Parse a str using the RestAPI syntax and return a model.

Parameters:
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns:

An instance of this model

Raises:

DeserializationError if something went wrong

classmethod enable_additional_properties_sending() None
classmethod from_dict(data: Any, key_extractors: Callable[[str, Dict[str, Any], Any], Any] | None = None, content_type: str | None = None) ModelType

Parse a dict using given key extractor return a model.

By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)

Parameters:
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns:

An instance of this model

Raises:

DeserializationError if something went wrong

classmethod is_xml_model() bool
serialize(keep_readonly: bool = False, **kwargs: Any) MutableMapping[str, Any]

Return the JSON that would be sent to server from this model.

This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters:

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns:

A dict JSON compatible object

Return type:

dict

class azure.ai.resources.entities.AzureOpenAIModel(*, name: str, version: str, **kwargs: Any)[source]

Model information for Azure OpenAI Deployment.

All required parameters must be populated in order to send to server.

Variables:
  • format (str) – Format of the model, defaults to OpenAI. Required.

  • name (str) – Name of the model, eg. gpt-35-turbo, gpt-4. Required.

  • version (str) – Version of the model. Required.

Keyword Arguments:
  • format (str) – Format of the model, defaults to OpenAI. Required.

  • name (str) – Name of the model, eg. gpt-35-turbo, gpt-4. Required.

  • version (str) – Version of the model. Required.

as_dict(keep_readonly: bool = True, key_transformer: ~typing.Callable[[str, ~typing.Dict[str, ~typing.Any], ~typing.Any], ~typing.Any] = <function attribute_transformer>, **kwargs: ~typing.Any) MutableMapping[str, Any]

Return a dict that can be serialized using json.dump.

Advanced usage might optionally use a callback as parameter:

Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.

The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.

See the three examples in this file:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters:

key_transformer (function) – A key transformer function.

Returns:

A dict JSON compatible object

Return type:

dict

classmethod deserialize(data: Any, content_type: str | None = None) ModelType

Parse a str using the RestAPI syntax and return a model.

Parameters:
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns:

An instance of this model

Raises:

DeserializationError if something went wrong

classmethod enable_additional_properties_sending() None
classmethod from_dict(data: Any, key_extractors: Callable[[str, Dict[str, Any], Any], Any] | None = None, content_type: str | None = None) ModelType

Parse a dict using given key extractor return a model.

By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)

Parameters:
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns:

An instance of this model

Raises:

DeserializationError if something went wrong

classmethod is_xml_model() bool
serialize(keep_readonly: bool = False, **kwargs: Any) MutableMapping[str, Any]

Return the JSON that would be sent to server from this model.

This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters:

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns:

A dict JSON compatible object

Return type:

dict

class azure.ai.resources.entities.AzureOpenAIModelConfiguration(api_base: str, api_key: str, api_version: str | None, model_name: str, deployment_name: str, model_kwargs: Dict[str, Any])[source]

Configuration for an Azure OpenAI model.

Parameters:
  • api_base (str) – The base URL for the OpenAI API.

  • api_key (str) – The OpenAI API key.

  • api_version (Optional[str]) – The OpenAI API version.

  • model_name (str) – The name of the model.

  • deployment_name (str) – The name of the deployment.

  • model_kwargs (Dict[str, Any]) – Additional keyword arguments for the model.

static from_connection(connection: AzureOpenAIConnection, model_name: str, deployment_name: str, **model_kwargs) AzureOpenAIModelConfiguration[source]

Create an Azure OpenAI model configuration from an Azure OpenAI Connection.

Parameters:
  • connection (AzureOpenAIConnection) – The Azure OpenAI Connection object.

  • model_name (str) – The name of the model.

  • deployment_name (str) – The name of the deployment.

  • model_kwargs (Dict[str, Any]) – Additional keyword arguments for the model.

Returns:

The Azure OpenAI model configuration.

Return type:

AzureOpenAIModelConfiguration

Raises:
  • TypeError – If the connection is not an AzureOpenAIConnection.

  • ValueError – If the connection does not contain an OpenAI key.

api_base: str
api_key: str
api_version: str | None
deployment_name: str
model_kwargs: Dict[str, Any]
model_name: str
class azure.ai.resources.entities.AzureOpenAISku(*, capacity: int, **kwargs: Any)[source]

Sku informatioin for Azure OpenAI Deployment.

Variables are only populated by the server, and will be ignored when sending a request.

All required parameters must be populated in order to send to server.

Variables:
  • name (str) – name of the SKU, defaults to ‘standard’. Required.

  • capacity (int) – Token RPM of the deployment. Required.

Keyword Arguments:
  • name (str) – name of the SKU, defaults to ‘standard’. Required.

  • capacity (int) – Token RPM of the deployment. Required.

as_dict(keep_readonly: bool = True, key_transformer: ~typing.Callable[[str, ~typing.Dict[str, ~typing.Any], ~typing.Any], ~typing.Any] = <function attribute_transformer>, **kwargs: ~typing.Any) MutableMapping[str, Any]

Return a dict that can be serialized using json.dump.

Advanced usage might optionally use a callback as parameter:

Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.

The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.

See the three examples in this file:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters:

key_transformer (function) – A key transformer function.

Returns:

A dict JSON compatible object

Return type:

dict

classmethod deserialize(data: Any, content_type: str | None = None) ModelType

Parse a str using the RestAPI syntax and return a model.

Parameters:
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns:

An instance of this model

Raises:

DeserializationError if something went wrong

classmethod enable_additional_properties_sending() None
classmethod from_dict(data: Any, key_extractors: Callable[[str, Dict[str, Any], Any], Any] | None = None, content_type: str | None = None) ModelType

Parse a dict using given key extractor return a model.

By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)

Parameters:
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns:

An instance of this model

Raises:

DeserializationError if something went wrong

classmethod is_xml_model() bool
serialize(keep_readonly: bool = False, **kwargs: Any) MutableMapping[str, Any]

Return the JSON that would be sent to server from this model.

This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters:

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns:

A dict JSON compatible object

Return type:

dict

class azure.ai.resources.entities.BaseConnection(*, target: str, type: str, credentials: ApiKeyConfiguration, is_shared: bool = True, **kwargs)[source]

A connection to a another system or service. This is a base class and should only be directly used to cover the simplest of connection types that don’t merit their own subclass.

Parameters:
  • name (str) – The name of the connection

  • target (str) – The URL or ARM resource ID of the external resource.

  • type (str) – The type of connection this represents. Acceptable values include: “azure_open_ai”, “cognitive_service”, “cognitive_search”, “git”, “azure_blob”, and “custom”.

  • credentials (ApiKeyConfiguration) – The credentials for authenticating to the external resource.

  • description (str) – A description of the connection.

  • tags (dict) – Tag dictionary. Tags can be added, removed, and updated.

  • id (str) – The connection’s resource id.

  • is_shared (bool) – For connections created for a project, this determines if the connection is shared amongst other connections with that project’s parent AI resource. Defaults to True.

set_current_environment(credential: TokenCredential | None = None)[source]

Sets the current environment to use the connection. To use AAD auth for AzureOpenAI connection, pass in a credential object. Only certain types of connections make use of this function. Those that don’t will raise an error if this is called.

Parameters:

credential (TokenCredential) – Optional credential to use for the connection. If not provided, the connection’s credentials will be used.

property credentials: ApiKeyConfiguration

Get the credentials for the connection.

Returns:

This connection’s credentials.

Return type:

ApiKeyConfiguration

property id: str | None

The resource ID.

Returns:

The global ID of the resource, an Azure Resource Manager (ARM) ID.

Return type:

Optional[str]

property is_shared: bool

Get the Boolean describing if this connection is shared amongst its cohort within a workspace hub. Only applicable for connections that are project-scoped on creation.

Return type:

bool

property metadata: Dict[str, Any]

Deprecated. Use tags.

Returns:

This connection’s tags/metadata.

Return type:

Dict[str, Any]

property name: str

The name of the connection.

Returns:

Name of the connection.

Return type:

str

property tags: Dict[str, Any]

Tags for the connection.

Returns:

This connection’s tags.

Return type:

Dict[str, Any]

property target: str

Target url for the connection.

Returns:

The target of the connection.

Return type:

str

property type: str

Get the type of the connection.

Returns:

Type of the connection.

Return type:

str

class azure.ai.resources.entities.CustomConnection(*, target: str, credentials: ApiKeyConfiguration, **kwargs)[source]

A Connection to system that’s not encapsulated by other connection types.

Parameters:
  • name (str) – Name of the connection.

  • target (str) – The URL or ARM resource ID of the external resource.

  • credentials (ApiKeyConfiguration) – The credentials for authenticating the external resource.

  • is_shared (bool) – For connections created for a project, this determines if the connection is shared amongst other connections with that project’s parent AI resource. Defaults to True.

  • tags (dict) – Tag dictionary. Tags can be added, removed, and updated.

set_current_environment(credential: TokenCredential | None = None)

Sets the current environment to use the connection. To use AAD auth for AzureOpenAI connection, pass in a credential object. Only certain types of connections make use of this function. Those that don’t will raise an error if this is called.

Parameters:

credential (TokenCredential) – Optional credential to use for the connection. If not provided, the connection’s credentials will be used.

property credentials: ApiKeyConfiguration

Get the credentials for the connection.

Returns:

This connection’s credentials.

Return type:

ApiKeyConfiguration

property id: str | None

The resource ID.

Returns:

The global ID of the resource, an Azure Resource Manager (ARM) ID.

Return type:

Optional[str]

property is_shared: bool

Get the Boolean describing if this connection is shared amongst its cohort within a workspace hub. Only applicable for connections that are project-scoped on creation.

Return type:

bool

property metadata: Dict[str, Any]

Deprecated. Use tags.

Returns:

This connection’s tags/metadata.

Return type:

Dict[str, Any]

property name: str

The name of the connection.

Returns:

Name of the connection.

Return type:

str

property tags: Dict[str, Any]

Tags for the connection.

Returns:

This connection’s tags.

Return type:

Dict[str, Any]

property target: str

Target url for the connection.

Returns:

The target of the connection.

Return type:

str

property type: str

Get the type of the connection.

Returns:

Type of the connection.

Return type:

str

class azure.ai.resources.entities.Data(name: str, path: str, version: str | None = None, type: str = 'folder', description: str | None = None, tags: Dict[str, str] | None = None, properties: Dict[str, str] | None = None)[source]

Data asset

Parameters:
  • name (str) – The name of the data asset.

  • path (str) – The path to the data asset.

  • version (Optional[str]) – The version of the data asset.

  • type (str) – The type of the data asset. Defaults to ~azure.ai.resources.constants.AssetTypes.FOLDER. Accepted values include: ~azure.ai.resources.constants.AssetTypes.FILE, ~azure.ai.resources.constants.AssetTypes.FOLDER, and ~azure.ai.resources.constants.AssetTypes.TABLE.

  • description (Optional[str]) – The description of the data asset.

  • tags (Optional[Dict[str, str]]) – The tags of the data asset.

  • properties (Optional[Dict[str, str]]) – The properties of the data asset.

description: str | None = None
name: str
path: str
properties: Dict[str, str] | None = None
tags: Dict[str, str] | None = None
type: str = 'folder'
version: str | None = None
class azure.ai.resources.entities.GitHubConnection(*, target: str, credentials: ApiKeyConfiguration, **kwargs)[source]

A Connection to GitHub.

Parameters:
  • name (str) – Name of the connection.

  • target (str) – The URL or ARM resource ID of the external resource.

  • credentials (ApiKeyConfiguration) – The credentials for authenticating the external resource.

  • is_shared (bool) – For connections created for a project, this determines if the connection is shared amongst other connections with that project’s parent AI resource. Defaults to True.

  • tags (dict) – Tag dictionary. Tags can be added, removed, and updated.

set_current_environment(credential: TokenCredential | None = None)

Sets the current environment to use the connection. To use AAD auth for AzureOpenAI connection, pass in a credential object. Only certain types of connections make use of this function. Those that don’t will raise an error if this is called.

Parameters:

credential (TokenCredential) – Optional credential to use for the connection. If not provided, the connection’s credentials will be used.

property credentials: ApiKeyConfiguration

Get the credentials for the connection.

Returns:

This connection’s credentials.

Return type:

ApiKeyConfiguration

property id: str | None

The resource ID.

Returns:

The global ID of the resource, an Azure Resource Manager (ARM) ID.

Return type:

Optional[str]

property is_shared: bool

Get the Boolean describing if this connection is shared amongst its cohort within a workspace hub. Only applicable for connections that are project-scoped on creation.

Return type:

bool

property metadata: Dict[str, Any]

Deprecated. Use tags.

Returns:

This connection’s tags/metadata.

Return type:

Dict[str, Any]

property name: str

The name of the connection.

Returns:

Name of the connection.

Return type:

str

property tags: Dict[str, Any]

Tags for the connection.

Returns:

This connection’s tags.

Return type:

Dict[str, Any]

property target: str

Target url for the connection.

Returns:

The target of the connection.

Return type:

str

property type: str

Get the type of the connection.

Returns:

Type of the connection.

Return type:

str

class azure.ai.resources.entities.Index(name: str, path: str | Path, version: str | None = None, description: str | None = None, tags: Dict[str, str] | None = None, properties: Dict[str, str] | None = None)[source]

A search index for queries

Parameters:
  • name (str) – The name of the index.

  • path (str) – The path to the index files.

  • version (Optional[str]) – The version of the index.

  • description (Optional[str]) – The description of the index.

  • tags (Optional[Dict[str, str]]) – Tags associated with the index.

  • properties (Optional[Dict[str, str]]) – The properties of the index.

override_connections(aoai_connection: AzureOpenAIConnection | None = None, acs_connection: AzureAISearchConnection | None = None) None[source]

Override the connections in the index with the provided connections

Parameters:
  • aoai_connection (Optional[AzureOpenAIConnection]) – The AzureOpenAIConnection to override the index’s connection with.

  • acs_connection (Optional[AzureAISearchConnection]) – The AzureAISearchConnection to override the index’s connection with.

query(text: str) List[Document][source]

Query the index with the provided text

Parameters:

text (str) – The text to query the index with.

Returns:

A list of documents relevant to the query.

Return type:

List[azure.ai.resources._index._langchain.vendor.schema.document.Document]

Raises:

ImportError – If the azure-ai-generative[index] package is not installed

description: str | None = None
name: str
path: str | Path
properties: Dict[str, str] | None = None
tags: Dict[str, str] | None = None
version: str | None = None
class azure.ai.resources.entities.Project(*, name: str, ai_resource: str, description: str | None = None, tags: Dict[str, str] | None = None, display_name: str | None = None, location: str | None = None, resource_group: str | None = None, **kwargs)[source]

A Project is a lightweight object for orchestrating AI applications, and is parented by an AI resource.

Parameters:
  • name (str) – The name of the project.

  • ai_resource (str) – The AI resource parent of the project.

  • description (Optional[str]) – The description of the project.

  • tags (Optional[Dict[str, str]]) – Tags associated with the project.

  • display_name (Optional[str]) – The display name of the project.

  • location (Optional[str]) – The location of the project.

  • resource_group (Optional[str]) – The project’s resource group name.

property ai_resource: str

The AI resource parent of the project.

Returns:

Name of the AI resource.

Return type:

str

property description: str

The description of the project.

Returns:

Name of the project.

Return type:

str

property display_name: str

The project display name

Returns:

The project display name

Return type:

str

property location: str

The location of the project.

Returns:

The location of the project.

Return type:

str

property name: str

The name of the project.

Returns:

Name of the project.

Return type:

str

property resource_group: str

The resource group associated with the project.

Returns:

The name of the resource group associated with the project.

Return type:

str

property tags: str

The project’s tags.

Returns:

The tags associated with the project.

Return type:

str

class azure.ai.resources.entities.SystemData(*, created_by: str | None = None, created_by_type: str | _models.CreatedByType | None = None, created_at: str | None = None, last_modified_by: str | None = None, last_modified_by_type: str | _models.CreatedByType | None = None, last_modified_at: str | None = None, **kwargs: Any)[source]

Metadata pertaining to creation and last modification of the resource.

Variables are only populated by the server, and will be ignored when sending a request.

Variables:
  • created_by (str) – The identity that created the resource.

  • created_by_type (str or CreatedByType) – The type of identity that created the resource. Known values are: “User”, “Application”, “ManagedIdentity”, and “Key”.

  • created_at (str) – The type of identity that created the resource.

  • last_modified_by (str) – The identity that last modified the resource.

  • last_modified_by_type (str or CreatedByType) – The type of identity that last modified the resource. Known values are: “User”, “Application”, “ManagedIdentity”, and “Key”.

  • last_modified_at (str) – The timestamp of resource last modification (UTC).

Keyword Arguments:
  • created_by (str) – The identity that created the resource.

  • created_by_type (str or CreatedByType) – The type of identity that created the resource. Known values are: “User”, “Application”, “ManagedIdentity”, and “Key”.

  • created_at (str) – The type of identity that created the resource.

  • last_modified_by (str) – The identity that last modified the resource.

  • last_modified_by_type (str or CreatedByType) – The type of identity that last modified the resource. Known values are: “User”, “Application”, “ManagedIdentity”, and “Key”.

  • last_modified_at (str) – The timestamp of resource last modification (UTC).

as_dict(keep_readonly: bool = True, key_transformer: ~typing.Callable[[str, ~typing.Dict[str, ~typing.Any], ~typing.Any], ~typing.Any] = <function attribute_transformer>, **kwargs: ~typing.Any) MutableMapping[str, Any]

Return a dict that can be serialized using json.dump.

Advanced usage might optionally use a callback as parameter:

Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.

The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.

See the three examples in this file:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters:

key_transformer (function) – A key transformer function.

Returns:

A dict JSON compatible object

Return type:

dict

classmethod deserialize(data: Any, content_type: str | None = None) ModelType

Parse a str using the RestAPI syntax and return a model.

Parameters:
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns:

An instance of this model

Raises:

DeserializationError if something went wrong

classmethod enable_additional_properties_sending() None
classmethod from_dict(data: Any, key_extractors: Callable[[str, Dict[str, Any], Any], Any] | None = None, content_type: str | None = None) ModelType

Parse a dict using given key extractor return a model.

By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)

Parameters:
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns:

An instance of this model

Raises:

DeserializationError if something went wrong

classmethod is_xml_model() bool
serialize(keep_readonly: bool = False, **kwargs: Any) MutableMapping[str, Any]

Return the JSON that would be sent to server from this model.

This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters:

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns:

A dict JSON compatible object

Return type:

dict

Submodules

azure.ai.resources.entities.ai_resource module

class azure.ai.resources.entities.ai_resource.AIResource(*, name: str, description: str | None = None, tags: Dict[str, str] | None = None, display_name: str | None = None, location: str | None = None, resource_group: str | None = None, managed_network: ManagedNetwork | None = None, storage_account: str | None = None, customer_managed_key: CustomerManagedKey | None = None, public_network_access: str | None = None, identity: IdentityConfiguration | None = None, container_registry: str | None = None, primary_user_assigned_identity: str | None = None, default_project_resource_group: str | None = None, **kwargs)[source]

An AI Resource, which serves as a container for projects and other AI-related objects

Parameters:
  • name (str) – The name for the AI resource.

  • description (Optional[str]) – The description of the AI resource.

  • tags (Optional[Dict[str, str]]) – The tags for the AI resource.

  • display_name (Optional[str]) – The display name for the AI resource.

  • location (Optional[str]) – The location for the AI resource.

  • resource_group (Optional[str]) – The resource group associated with the AI resource.

  • managed_network (Optional[ManagedNetwork]) – The managed network associated with the AI resource.

  • storage_account (Optional[str]) – The storage account associated with the AI resource.

  • customer_managed_key (Optional[CustomerManagedKey]) – The customer managed key associated with the AI resource.

  • public_network_access (Optional[str]) – The public network access associated with the AI resource.

  • identity (Optional[IdentityConfiguration]) – The identity associated with the AI resource.

  • container_registry (Optional[str]) – The container registry associated with the AI resource.

  • primary_user_assigned_identity (Optional[str]) – The primary user assigned identity associated with the AI resource.

  • default_project_resource_group (Optional[str]) – The default project’s resource group.

property container_registry: str

The container registry associated with the workspace hub.

Returns:

The container registry associated with the workspace hub.

Return type:

str

property customer_managed_key: CustomerManagedKey | None

The customer managed key associated with the workspace hub.

Returns:

The customer managed key associated with the workspace hub.

Return type:

Optional[CustomerManagedKey]

property default_project_resource_group: str

The default project’s resource group.

Returns:

The name of the default project’s resource group.

Return type:

str

property description: str

The workspace hub description.

Returns:

The workspace hub description.

Return type:

str

property display_name: str

The workspace hub’s display name.

Returns:

The display name of the workspace hub.

Return type:

str

property enable_data_isolation: bool

Whether or not data isolation is enabled for the workspace hub.

Returns:

Boolean value indicating whether or not data isolation is enabled for the workspace hub.

Return type:

bool

property existing_workspaces: List[str]

The existing workspaces related to the workspace hub.

Returns:

The names of the existing workspaces related to the workspace hub.

Return type:

List[str]

property id: str

The workspace hub ID. Read-only, set by the backend.

Returns:

The workspace hub ID.

Return type:

str

property identity: IdentityConfiguration | None

The identity associated with the workspace hub.

Returns:

The identity associated with the workspace hub.

Return type:

Optional[IdentityConfiguration]

property location: str

The workspace hub location.

Returns:

The location of the workspace hub.

Return type:

str

property managed_network: ManagedNetwork | None

The managed network to which the workspace hub is connected.

Returns:

The name of the managed network associated with the workspace hub.

Return type:

Optional[ManagedNetwork]

property name: str

The workspace hub name.

Returns:

The workspace hub name.

Return type:

str

property primary_user_assigned_identity: str

The primary user assigned identity associated with the workspace hub.

Returns:

The primary user assigned identity associated with the workspace hub.

Return type:

str

property public_network_access: str

The public network access to assign to the workspace hub.

Returns:

The public network access to assign to the workspace hub.

Return type:

str

property resource_group: str

The workspace hub’s resource group.

Returns:

The name of the resource group associated with the workspace hub.

Return type:

str

property storage_account: str

The storage account for the workspace hub.

Returns:

The name of the storage account associated with the workspace hub.

Return type:

str

property tags: Dict[str, str] | None

Tags for the workspace hub.

Returns:

The tags of the workspace hub.

Return type:

str

azure.ai.resources.entities.base_connection module

class azure.ai.resources.entities.base_connection.BaseConnection(*, target: str, type: str, credentials: ApiKeyConfiguration, is_shared: bool = True, **kwargs)[source]

A connection to a another system or service. This is a base class and should only be directly used to cover the simplest of connection types that don’t merit their own subclass.

Parameters:
  • name (str) – The name of the connection

  • target (str) – The URL or ARM resource ID of the external resource.

  • type (str) – The type of connection this represents. Acceptable values include: “azure_open_ai”, “cognitive_service”, “cognitive_search”, “git”, “azure_blob”, and “custom”.

  • credentials (ApiKeyConfiguration) – The credentials for authenticating to the external resource.

  • description (str) – A description of the connection.

  • tags (dict) – Tag dictionary. Tags can be added, removed, and updated.

  • id (str) – The connection’s resource id.

  • is_shared (bool) – For connections created for a project, this determines if the connection is shared amongst other connections with that project’s parent AI resource. Defaults to True.

set_current_environment(credential: TokenCredential | None = None)[source]

Sets the current environment to use the connection. To use AAD auth for AzureOpenAI connection, pass in a credential object. Only certain types of connections make use of this function. Those that don’t will raise an error if this is called.

Parameters:

credential (TokenCredential) – Optional credential to use for the connection. If not provided, the connection’s credentials will be used.

property credentials: ApiKeyConfiguration

Get the credentials for the connection.

Returns:

This connection’s credentials.

Return type:

ApiKeyConfiguration

property id: str | None

The resource ID.

Returns:

The global ID of the resource, an Azure Resource Manager (ARM) ID.

Return type:

Optional[str]

property is_shared: bool

Get the Boolean describing if this connection is shared amongst its cohort within a workspace hub. Only applicable for connections that are project-scoped on creation.

Return type:

bool

property metadata: Dict[str, Any]

Deprecated. Use tags.

Returns:

This connection’s tags/metadata.

Return type:

Dict[str, Any]

property name: str

The name of the connection.

Returns:

Name of the connection.

Return type:

str

property tags: Dict[str, Any]

Tags for the connection.

Returns:

This connection’s tags.

Return type:

Dict[str, Any]

property target: str

Target url for the connection.

Returns:

The target of the connection.

Return type:

str

property type: str

Get the type of the connection.

Returns:

Type of the connection.

Return type:

str

azure.ai.resources.entities.configs module

class azure.ai.resources.entities.configs.AzureOpenAIModelConfiguration(api_base: str, api_key: str, api_version: str | None, model_name: str, deployment_name: str, model_kwargs: Dict[str, Any])[source]

Configuration for an Azure OpenAI model.

Parameters:
  • api_base (str) – The base URL for the OpenAI API.

  • api_key (str) – The OpenAI API key.

  • api_version (Optional[str]) – The OpenAI API version.

  • model_name (str) – The name of the model.

  • deployment_name (str) – The name of the deployment.

  • model_kwargs (Dict[str, Any]) – Additional keyword arguments for the model.

static from_connection(connection: AzureOpenAIConnection, model_name: str, deployment_name: str, **model_kwargs) AzureOpenAIModelConfiguration[source]

Create an Azure OpenAI model configuration from an Azure OpenAI Connection.

Parameters:
  • connection (AzureOpenAIConnection) – The Azure OpenAI Connection object.

  • model_name (str) – The name of the model.

  • deployment_name (str) – The name of the deployment.

  • model_kwargs (Dict[str, Any]) – Additional keyword arguments for the model.

Returns:

The Azure OpenAI model configuration.

Return type:

AzureOpenAIModelConfiguration

Raises:
  • TypeError – If the connection is not an AzureOpenAIConnection.

  • ValueError – If the connection does not contain an OpenAI key.

api_base: str
api_key: str
api_version: str | None
deployment_name: str
model_kwargs: Dict[str, Any]
model_name: str

azure.ai.resources.entities.connection_subtypes module

class azure.ai.resources.entities.connection_subtypes.AzureAISearchConnection(*, target: str, credentials: ApiKeyConfiguration, api_version: str | None = None, **kwargs)[source]

A Connection for Azure AI Search

Parameters:
  • name (str) – Name of the connection.

  • target (str) – The URL or ARM resource ID of the external resource.

  • credentials (ApiKeyConfiguration) – The credentials for authenticating the external resource.

  • api_version (Optional[str]) – The api version that this connection was created for. Only applies to certain connection types.

  • is_shared (bool) – For connections created for a project, this determines if the connection is shared amongst other connections with that project’s parent AI resource. Defaults to True.

  • tags (dict) – Tag dictionary. Tags can be added, removed, and updated.

set_current_environment(credential: TokenCredential | None = None)[source]

Sets the current environment to use the connection. To use AAD auth for AzureOpenAI connetion, pass in a credential object. As a Cognitive Search Connection, this sets two environment variables: AZURE_AI_SEARCH_(ENDPOINT|KEY).

Parameters:

credential (TokenCredential) – Optional credential to use for the connection. If not provided, the connection’s credentials will be used.

property api_version: str | None

The API version of the connection.

Returns:

the API version of the connection.

Return type:

Optional[str]

property credentials: ApiKeyConfiguration

Get the credentials for the connection.

Returns:

This connection’s credentials.

Return type:

ApiKeyConfiguration

property id: str | None

The resource ID.

Returns:

The global ID of the resource, an Azure Resource Manager (ARM) ID.

Return type:

Optional[str]

property is_shared: bool

Get the Boolean describing if this connection is shared amongst its cohort within a workspace hub. Only applicable for connections that are project-scoped on creation.

Return type:

bool

property metadata: Dict[str, Any]

Deprecated. Use tags.

Returns:

This connection’s tags/metadata.

Return type:

Dict[str, Any]

property name: str

The name of the connection.

Returns:

Name of the connection.

Return type:

str

property tags: Dict[str, Any]

Tags for the connection.

Returns:

This connection’s tags.

Return type:

Dict[str, Any]

property target: str

Target url for the connection.

Returns:

The target of the connection.

Return type:

str

property type: str

Get the type of the connection.

Returns:

Type of the connection.

Return type:

str

class azure.ai.resources.entities.connection_subtypes.AzureAIServiceConnection(*, target: str, credentials: ApiKeyConfiguration, api_version: str | None = None, kind: str, **kwargs)[source]

A Connection for an Azure Cognitive Service. Note: This object usually shouldn’t be created manually by users. To get the default AzureOpenAIConnection for an AI Resource, use an AIClient object to call the ‘get_default_content_safety_connection’ function.

Parameters:
  • name (str) – Name of the connection.

  • target (str) – The URL or ARM resource ID of the external resource.

  • credentials (ApiKeyConfiguration) – The credentials for authenticating the external resource.

  • api_version (Optional[str]) – The api version that this connection was created for.

  • kind (str) – The kind of ai service that this connection points to. Valid inputs include: “AzureOpenAI”, “ContentSafety”, and “Speech”.

  • is_shared (bool) – For connections created for a project, this determines if the connection is shared amongst other connections with that project’s parent AI resource. Defaults to True.

  • tags (dict) – Tag dictionary. Tags can be added, removed, and updated.

set_current_environment(credential: TokenCredential | None = None)

Sets the current environment to use the connection. To use AAD auth for AzureOpenAI connection, pass in a credential object. Only certain types of connections make use of this function. Those that don’t will raise an error if this is called.

Parameters:

credential (TokenCredential) – Optional credential to use for the connection. If not provided, the connection’s credentials will be used.

property api_version: str | None

The API version of the connection.

Returns:

The API version of the connection.

Return type:

Optional[str]

property credentials: ApiKeyConfiguration

Get the credentials for the connection.

Returns:

This connection’s credentials.

Return type:

ApiKeyConfiguration

property id: str | None

The resource ID.

Returns:

The global ID of the resource, an Azure Resource Manager (ARM) ID.

Return type:

Optional[str]

property is_shared: bool

Get the Boolean describing if this connection is shared amongst its cohort within a workspace hub. Only applicable for connections that are project-scoped on creation.

Return type:

bool

property kind: str | None

The kind of the connection.

Returns:

the kind of the connection.

Return type:

Optional[str]

property metadata: Dict[str, Any]

Deprecated. Use tags.

Returns:

This connection’s tags/metadata.

Return type:

Dict[str, Any]

property name: str

The name of the connection.

Returns:

Name of the connection.

Return type:

str

property tags: Dict[str, Any]

Tags for the connection.

Returns:

This connection’s tags.

Return type:

Dict[str, Any]

property target: str

Target url for the connection.

Returns:

The target of the connection.

Return type:

str

property type: str

Get the type of the connection.

Returns:

Type of the connection.

Return type:

str

class azure.ai.resources.entities.connection_subtypes.AzureBlobStoreConnection(*, target: str, container_name: str, account_name: str, **kwargs)[source]

A Connection to an Azure Blob Datastore. Unlike other connection objects, this subclass has no credentials. NOTE: This connection type is currently READ-ONLY via the LIST operation. Attempts to create or update a connection of this type will result in an error.

Parameters:
  • name (str) – Name of the connection.

  • target (str) – The URL or ARM resource ID of the resource.

  • container_name (str) – The container name of the connection.

  • account_name (str) – The account name of the connection.

  • is_shared (bool) – For connections created for a project, this determines if the connection is shared amongst other connections with that project’s parent AI resource. Defaults to True.

  • tags (dict) – Tag dictionary. Tags can be added, removed, and updated.

set_current_environment(credential: TokenCredential | None = None)

Sets the current environment to use the connection. To use AAD auth for AzureOpenAI connection, pass in a credential object. Only certain types of connections make use of this function. Those that don’t will raise an error if this is called.

Parameters:

credential (TokenCredential) – Optional credential to use for the connection. If not provided, the connection’s credentials will be used.

property account_name: str | None

The account name of the connection.

Returns:

the account name of the connection.

Return type:

Optional[str]

property container_name: str | None

The container name of the connection.

Returns:

the container name of the connection.

Return type:

Optional[str]

property credentials: ApiKeyConfiguration

Get the credentials for the connection.

Returns:

This connection’s credentials.

Return type:

ApiKeyConfiguration

property id: str | None

The resource ID.

Returns:

The global ID of the resource, an Azure Resource Manager (ARM) ID.

Return type:

Optional[str]

property is_shared: bool

Get the Boolean describing if this connection is shared amongst its cohort within a workspace hub. Only applicable for connections that are project-scoped on creation.

Return type:

bool

property metadata: Dict[str, Any]

Deprecated. Use tags.

Returns:

This connection’s tags/metadata.

Return type:

Dict[str, Any]

property name: str

The name of the connection.

Returns:

Name of the connection.

Return type:

str

property tags: Dict[str, Any]

Tags for the connection.

Returns:

This connection’s tags.

Return type:

Dict[str, Any]

property target: str

Target url for the connection.

Returns:

The target of the connection.

Return type:

str

property type: str

Get the type of the connection.

Returns:

Type of the connection.

Return type:

str

class azure.ai.resources.entities.connection_subtypes.AzureOpenAIConnection(*, target: str, credentials: ApiKeyConfiguration, api_version: str | None = None, api_type: str = 'Azure', **kwargs)[source]

A Connection for Azure Open AI. Note: This object usually shouldn’t be created manually by users. To get the default AzureOpenAIConnection for an AI Resource, use an AIClient object to call the ‘get_default_aoai_connection’ function.

Parameters:
  • name (str) – Name of the connection.

  • target (str) – The URL or ARM resource ID of the external resource.

  • credentials (ApiKeyConfiguration) – The credentials for authenticating the external resource.

  • api_version (Optional[str]) – The api version that this connection was created for.

  • api_type (str) – The api type that this connection was created for. Defaults to “Azure” and currently rarely changes.

  • is_shared (bool) – For connections created for a project, this determines if the connection is shared amongst other connections with that project’s parent AI resource. Defaults to True.

  • tags (dict) – Tag dictionary. Tags can be added, removed, and updated.

set_current_environment(credential: TokenCredential | None = None)[source]

Sets the current environment to use the connection. To use AAD auth for AzureOpenAI connetion, pass in a credential object. As an Azure Open AI connection, this sets 4 environment variables: OPEN_API_(TYPE|KEY|BASE|VERSION).

Parameters:

credential (TokenCredential) – Optional credential to use for the connection. If not provided, the connection’s credentials will be used.

property api_type: str | None

The API type of the connection.

Returns:

The API type of the connection.

Return type:

Optional[str]

property api_version: str | None

The API version of the connection.

Returns:

the API version of the connection.

Return type:

Optional[str]

property credentials: ApiKeyConfiguration

Get the credentials for the connection.

Returns:

This connection’s credentials.

Return type:

ApiKeyConfiguration

property id: str | None

The resource ID.

Returns:

The global ID of the resource, an Azure Resource Manager (ARM) ID.

Return type:

Optional[str]

property is_shared: bool

Get the Boolean describing if this connection is shared amongst its cohort within a workspace hub. Only applicable for connections that are project-scoped on creation.

Return type:

bool

property metadata: Dict[str, Any]

Deprecated. Use tags.

Returns:

This connection’s tags/metadata.

Return type:

Dict[str, Any]

property name: str

The name of the connection.

Returns:

Name of the connection.

Return type:

str

property tags: Dict[str, Any]

Tags for the connection.

Returns:

This connection’s tags.

Return type:

Dict[str, Any]

property target: str

Target url for the connection.

Returns:

The target of the connection.

Return type:

str

property type: str

Get the type of the connection.

Returns:

Type of the connection.

Return type:

str

class azure.ai.resources.entities.connection_subtypes.CustomConnection(*, target: str, credentials: ApiKeyConfiguration, **kwargs)[source]

A Connection to system that’s not encapsulated by other connection types.

Parameters:
  • name (str) – Name of the connection.

  • target (str) – The URL or ARM resource ID of the external resource.

  • credentials (ApiKeyConfiguration) – The credentials for authenticating the external resource.

  • is_shared (bool) – For connections created for a project, this determines if the connection is shared amongst other connections with that project’s parent AI resource. Defaults to True.

  • tags (dict) – Tag dictionary. Tags can be added, removed, and updated.

set_current_environment(credential: TokenCredential | None = None)

Sets the current environment to use the connection. To use AAD auth for AzureOpenAI connection, pass in a credential object. Only certain types of connections make use of this function. Those that don’t will raise an error if this is called.

Parameters:

credential (TokenCredential) – Optional credential to use for the connection. If not provided, the connection’s credentials will be used.

property credentials: ApiKeyConfiguration

Get the credentials for the connection.

Returns:

This connection’s credentials.

Return type:

ApiKeyConfiguration

property id: str | None

The resource ID.

Returns:

The global ID of the resource, an Azure Resource Manager (ARM) ID.

Return type:

Optional[str]

property is_shared: bool

Get the Boolean describing if this connection is shared amongst its cohort within a workspace hub. Only applicable for connections that are project-scoped on creation.

Return type:

bool

property metadata: Dict[str, Any]

Deprecated. Use tags.

Returns:

This connection’s tags/metadata.

Return type:

Dict[str, Any]

property name: str

The name of the connection.

Returns:

Name of the connection.

Return type:

str

property tags: Dict[str, Any]

Tags for the connection.

Returns:

This connection’s tags.

Return type:

Dict[str, Any]

property target: str

Target url for the connection.

Returns:

The target of the connection.

Return type:

str

property type: str

Get the type of the connection.

Returns:

Type of the connection.

Return type:

str

class azure.ai.resources.entities.connection_subtypes.GitHubConnection(*, target: str, credentials: ApiKeyConfiguration, **kwargs)[source]

A Connection to GitHub.

Parameters:
  • name (str) – Name of the connection.

  • target (str) – The URL or ARM resource ID of the external resource.

  • credentials (ApiKeyConfiguration) – The credentials for authenticating the external resource.

  • is_shared (bool) – For connections created for a project, this determines if the connection is shared amongst other connections with that project’s parent AI resource. Defaults to True.

  • tags (dict) – Tag dictionary. Tags can be added, removed, and updated.

set_current_environment(credential: TokenCredential | None = None)

Sets the current environment to use the connection. To use AAD auth for AzureOpenAI connection, pass in a credential object. Only certain types of connections make use of this function. Those that don’t will raise an error if this is called.

Parameters:

credential (TokenCredential) – Optional credential to use for the connection. If not provided, the connection’s credentials will be used.

property credentials: ApiKeyConfiguration

Get the credentials for the connection.

Returns:

This connection’s credentials.

Return type:

ApiKeyConfiguration

property id: str | None

The resource ID.

Returns:

The global ID of the resource, an Azure Resource Manager (ARM) ID.

Return type:

Optional[str]

property is_shared: bool

Get the Boolean describing if this connection is shared amongst its cohort within a workspace hub. Only applicable for connections that are project-scoped on creation.

Return type:

bool

property metadata: Dict[str, Any]

Deprecated. Use tags.

Returns:

This connection’s tags/metadata.

Return type:

Dict[str, Any]

property name: str

The name of the connection.

Returns:

Name of the connection.

Return type:

str

property tags: Dict[str, Any]

Tags for the connection.

Returns:

This connection’s tags.

Return type:

Dict[str, Any]

property target: str

Target url for the connection.

Returns:

The target of the connection.

Return type:

str

property type: str

Get the type of the connection.

Returns:

Type of the connection.

Return type:

str

azure.ai.resources.entities.data module

class azure.ai.resources.entities.data.Data(name: str, path: str, version: str | None = None, type: str = 'folder', description: str | None = None, tags: Dict[str, str] | None = None, properties: Dict[str, str] | None = None)[source]

Data asset

Parameters:
  • name (str) – The name of the data asset.

  • path (str) – The path to the data asset.

  • version (Optional[str]) – The version of the data asset.

  • type (str) – The type of the data asset. Defaults to ~azure.ai.resources.constants.AssetTypes.FOLDER. Accepted values include: ~azure.ai.resources.constants.AssetTypes.FILE, ~azure.ai.resources.constants.AssetTypes.FOLDER, and ~azure.ai.resources.constants.AssetTypes.TABLE.

  • description (Optional[str]) – The description of the data asset.

  • tags (Optional[Dict[str, str]]) – The tags of the data asset.

  • properties (Optional[Dict[str, str]]) – The properties of the data asset.

description: str | None = None
name: str
path: str
properties: Dict[str, str] | None = None
tags: Dict[str, str] | None = None
type: str = 'folder'
version: str | None = None

azure.ai.resources.entities.deployment_keys module

class azure.ai.resources.entities.deployment_keys.DeploymentKeys(primary_key: str, secondary_key: str)[source]

Keys for model deployments

Parameters:
  • primary_key (str) – The primary key for the deployment.

  • secondary_key (str) – The secondary key for the deployment.

primary_key: str
secondary_key: str

azure.ai.resources.entities.mlindex module

class azure.ai.resources.entities.mlindex.Index(name: str, path: str | Path, version: str | None = None, description: str | None = None, tags: Dict[str, str] | None = None, properties: Dict[str, str] | None = None)[source]

A search index for queries

Parameters:
  • name (str) – The name of the index.

  • path (str) – The path to the index files.

  • version (Optional[str]) – The version of the index.

  • description (Optional[str]) – The description of the index.

  • tags (Optional[Dict[str, str]]) – Tags associated with the index.

  • properties (Optional[Dict[str, str]]) – The properties of the index.

override_connections(aoai_connection: AzureOpenAIConnection | None = None, acs_connection: AzureAISearchConnection | None = None) None[source]

Override the connections in the index with the provided connections

Parameters:
  • aoai_connection (Optional[AzureOpenAIConnection]) – The AzureOpenAIConnection to override the index’s connection with.

  • acs_connection (Optional[AzureAISearchConnection]) – The AzureAISearchConnection to override the index’s connection with.

query(text: str) List[Document][source]

Query the index with the provided text

Parameters:

text (str) – The text to query the index with.

Returns:

A list of documents relevant to the query.

Return type:

List[azure.ai.resources._index._langchain.vendor.schema.document.Document]

Raises:

ImportError – If the azure-ai-generative[index] package is not installed

description: str | None = None
name: str
path: str | Path
properties: Dict[str, str] | None = None
tags: Dict[str, str] | None = None
version: str | None = None

azure.ai.resources.entities.models module

class azure.ai.resources.entities.models.Model(path: str | PathLike, conda_file: str | PathLike | None = None, loader_module: str | None = None, chat_module: str | None = None)[source]

A model asset

Parameters:
  • path (Union[str, os.PathLike]) – The path to the model.

  • conda_file (Optional[Union[str, os.PathLike]]) – The path to the conda file for the model.

  • loader_module (Optional[str]) – The loader module for the model.

  • chat_module (Optional[str]) – The chat module for the model.

chat_module: str | None = None
conda_file: str | PathLike | None = None
loader_module: str | None = None
path: str | PathLike
class azure.ai.resources.entities.models.PromptflowModel(path: str | PathLike, base_image: str | None = None)[source]

A promptflow model

Parameters:
  • path (Union[str, os.PathLike]) – The path to the model.

  • base_image (Optional[str]) – The base image for the model.

base_image: str | None = None
path: str | PathLike

azure.ai.resources.entities.project module

class azure.ai.resources.entities.project.Project(*, name: str, ai_resource: str, description: str | None = None, tags: Dict[str, str] | None = None, display_name: str | None = None, location: str | None = None, resource_group: str | None = None, **kwargs)[source]

A Project is a lightweight object for orchestrating AI applications, and is parented by an AI resource.

Parameters:
  • name (str) – The name of the project.

  • ai_resource (str) – The AI resource parent of the project.

  • description (Optional[str]) – The description of the project.

  • tags (Optional[Dict[str, str]]) – Tags associated with the project.

  • display_name (Optional[str]) – The display name of the project.

  • location (Optional[str]) – The location of the project.

  • resource_group (Optional[str]) – The project’s resource group name.

property ai_resource: str

The AI resource parent of the project.

Returns:

Name of the AI resource.

Return type:

str

property description: str

The description of the project.

Returns:

Name of the project.

Return type:

str

property display_name: str

The project display name

Returns:

The project display name

Return type:

str

property location: str

The location of the project.

Returns:

The location of the project.

Return type:

str

property name: str

The name of the project.

Returns:

Name of the project.

Return type:

str

property resource_group: str

The resource group associated with the project.

Returns:

The name of the resource group associated with the project.

Return type:

str

property tags: str

The project’s tags.

Returns:

The tags associated with the project.

Return type:

str

azure.ai.resources.entities.single_deployment module

class azure.ai.resources.entities.single_deployment.SingleDeployment(name: str, model: str | Model | PromptflowModel, app_insights_enabled: bool = True, data_collector_enabled: bool = True, endpoint_name: str | None = None, environment_variables: Dict[str, str] | None = None, instance_type: str | None = None, instance_count: str = '1', scoring_uri: str | None = None, properties: Dict[str, str] | None = None, tags: Dict[str, str] | None = None)[source]

A model deployment.

Parameters:
  • name (str) – The name of the deployment.

  • model (Union[str, Model, PromptflowModel]) – The model to be deployed. This can be a model ID, a Model object, or a promptflow model.

  • app_insights_enabled (bool) – Whether to enable application insights. Defaults to True.

  • data_collector_enabled (bool) – Whether to enable data collection. Defaults to True.

  • endpoint_name (Optional[str]) – The name of the endpoint to deploy to.

  • environment_variables (Optional[Dict[str, str]]) – The environment variables for the deployment.

  • instance_type (Optional[str]) – The instance type for the deployment.

  • instance_count (str) – The number of instances for the deployment. Defaults to “1”.

  • scoring_uri (Optional[str]) – The scoring URI for the deployment.

  • properties (Optional[Dict[str, str]]) – The properties of the deployment.

  • tags (Optional[Dict[str, str]]) – The tags of the deployment.

app_insights_enabled: bool = True
data_collector_enabled: bool = True
endpoint_name: str | None = None
environment_variables: Dict[str, str] | None = None
instance_count: str = '1'
instance_type: str | None = None
model: str | Model | PromptflowModel
name: str
properties: Dict[str, str] | None = None
scoring_uri: str | None = None
tags: Dict[str, str] | None = None