# packages

pkgId: c313688af244a44481869ac8629bff2e568021d29a1a2f9ef89e87fd8ce82f1a
name: python-azure-ai-generative
arch: src
version: 1.0.0b11
epoch: 0
release: 1
summary: Microsoft Azure Machine Learning Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-generative-1.0.0b11-1.src.rpm
checksum_type: sha256
description:
  This package has been deprecated and will no longer be maintained.

  Please refer to new package [Azure AI Evaluation](https://pypi.org/project/azure-ai-evaluation/) for evaluating Generative AI applications that leverage Azure AI services.







  - Deprecation message added.





  - Bug fixes





  - Bug fixes




  - Bug fixes





  - Bug fixes





  - Recursive Text Splitter is now enabled by default for local index builds which mimics behavior of cloud index builds
  - Bug fixes





  - Supports evaluate() on chat



  - Fix promptflow evaluation bugs



  - Duplicate cleanup





  - Support custom metrics for evaluation



  - Switched evaluate() function to run on promptflow engine
  - Use openai v1 environment variable





  - Support for Python 3.12





  - Added new format to export data to in qa generator.



  - Dependency improvements.





  - Try use langchain VectorStore and fallback to vendor.
  - Add azure-search-documents 11.4.0b11 and above support.
  - Invoke OpenAI with dynamic batch size.
  - Fix LangChain importing path
  - First preview.


pkgId: aa67f3f022beaae87448f8fb1a9851e8c332b86b7611227b06a291af2bbce76f
name: python-azure-ai-inference
arch: src
version: 1.0.0b4
epoch: 0
release: 1
summary: Microsoft Azure Ai Inference Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-inference-1.0.0b4-1.src.rpm
checksum_type: sha256
description:
  Use the Inference client library (in preview) to:

  * Authenticate against the service
  * Get information about the AI model
  * Do chat completions
  * Get text embeddings
  <!-- * Get image embeddings -->

  The Inference client library supports AI models deployed to the following services:

  * [GitHub Models](https://github.com/marketplace/models) - Free-tier endpoint for AI models from different providers
  * Serverless API endpoints and Managed Compute endpoints - AI models from different providers deployed from [Azure AI Studio](https://ai.azure.com). See [Overview: Deploy models, flows, and web apps with Azure AI Studio](https://learn.microsoft.com/azure/ai-studio/concepts/deployments-overview).
  * Azure OpenAI Service - OpenAI models deployed from [Azure OpenAI Studio](https://oai.azure.com/). See [What is Azure OpenAI Service?](https://learn.microsoft.com/azure/ai-services/openai/overview). Although we recomendation you use the official [OpenAI client library](https://pypi.org/project/openai/) in your production code for this service, you can use the Azure AI Inference client library to easily compare the performance of OpenAI models to other models, using the same client library and Python code.

  The Inference client library makes services calls using REST API version `2024-05-01-preview`, as documented in [Azure AI Model Inference API](https://aka.ms/azureai/modelinference).

  [Product documentation](https://aka.ms/azureai/modelinference)
  | [Samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-inference/samples)
  | [API reference documentation](https://aka.ms/azsdk/azure-ai-inference/python/reference)
  | [Package (Pypi)](https://aka.ms/azsdk/azure-ai-inference/python/package)
  | [SDK source code](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-inference/azure/ai/inference)





  * [Python 3.8](https://www.python.org/) or later installed, including [pip](https://pip.pypa.io/en/stable/).
  Studio.
  * For GitHub models
    * The AI model name, such as "gpt-4o" or "mistral-large"
    * A GitHub personal access token. [Create one here](https://github.com/settings/tokens). You do not need to give any permissions to the token. The token is a string that starts with `github_pat_`.
  * For Serverless API endpoints or Managed Compute endpoints
    * An [Azure subscription](https://azure.microsoft.com/free).
    * An [AI Model from the catalog](https://ai.azure.com/explore/models) deployed through Azure AI Studio.
    * The endpoint URL of your model, in of the form `https://<your-host-name>.<your-azure-region>.models.ai.azure.com`, where `your-host-name` is your unique model deployment host name and `your-azure-region` is the Azure region where the model is deployed (e.g. `eastus2`).
    * Depending on your authentication preference, you either need an API key to authenticate against the service, or Entra ID credentials. The API key is a 32-character string.
  * For Azure OpenAI (AOAI) service
    * An [Azure subscription](https://azure.microsoft.com/free).
    * An [OpenAI Model from the catalog](https://oai.azure.com/resource/models) deployed through Azure OpenAI Studio.
    * The endpoint URL of your model, in the form `https://<your-resouce-name>.openai.azure.com/openai/deployments/<your-deployment-name>`, where `your-resource-name` is your globally unique AOAI resource name, and `your-deployment-name` is your AI Model deployment name.
    * Depending on your authentication preference, you either need an API key to authenticate against the service, or Entra ID credentials. The API key is a 32-character string.
    * An api-version. Latest preview or GA version listed in the `Data plane - inference` row in [the API Specs table](https://learn.microsoft.com/azure/ai-services/openai/reference#api-specs). At the time of writing, latest GA version was "2024-06-01".



  To install the Azure AI Inferencing package use the following command:

  ```bash
  pip install azure-ai-inference
  ```

  To update an existing installation of the package, use:

  ```bash
  pip install --upgrade azure-ai-inference
  ```





  The package includes two clients `ChatCompletionsClient` and `EmbeddingsClient`<!-- and `ImageGenerationClients`-->. Both can be created in the similar manner. For example, assuming `endpoint`, `key` and `github_token` are strings holding your endpoint URL, API key or GitHub token, this Python code will create and authenticate a synchronous `ChatCompletionsClient`:

  ```python
  from azure.ai.inference import ChatCompletionsClient
  from azure.core.credentials import AzureKeyCredential


  client = ChatCompletionsClient(
      endpoint="https://models.inference.ai.azure.com",
      credential=AzureKeyCredential(github_token),
      model="mistral-large" # Update as needed. Alternatively, you can include this is the `complete` call.
  )


  client = ChatCompletionsClient(
      endpoint=endpoint,  # Of the form https://<your-host-name>.<your-azure-region>.models.ai.azure.com
      credential=AzureKeyCredential(key)
  )


  client = ChatCompletionsClient(
      endpoint=endpoint,  # Of the form https://<your-resouce-name>.openai.azure.com/openai/deployments/<your-deployment-name>
      credential=AzureKeyCredential(""),  # Pass in an empty value.
      headers={"api-key": key},
      api_version="2024-06-01",  # AOAI api-version. Update as needed.
  )
  ```

  A synchronous client supports synchronous inference methods, meaning they will block until the service responds with inference results. For simplicity the code snippets below all use synchronous methods. The client offers equivalent asynchronous methods which are more commonly used in production.

  To create an asynchronous client, Install the additional package [aiohttp](https://pypi.org/project/aiohttp/):

  ```bash
  pip install aiohttp
  ```

  and update the code above to import `asyncio`, and import `ChatCompletionsClient` from the `azure.ai.inference.aio` namespace instead of `azure.ai.inference`. For example:

  ```python
  import asyncio
  from azure.ai.inference.aio import ChatCompletionsClient
  from azure.core.credentials import AzureKeyCredential


  client = ChatCompletionsClient(
      endpoint=endpoint,
      credential=AzureKeyCredential(key)
  )
  ```



  _Note: At the time of writing, only Managed Compute endpoints and Azure OpenAI endpoints support Entra ID authentication.

  To use an Entra ID token credential, first install the [azure-identity](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity) package:

  ```python
  pip install azure.identity
  ```

  You will need to provide the desired credential type obtained from that package. A common selection is [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential) and it can be used as follows:

  ```python
  from azure.ai.inference import ChatCompletionsClient
  from azure.identity import DefaultAzureCredential


  client = ChatCompletionsClient(
      endpoint=endpoint,
      credential=DefaultAzureCredential(exclude_interactive_browser_credential=False)
  )


  client = ChatCompletionsClient(
      endpoint=endpoint,
      credential=DefaultAzureCredential(exclude_interactive_browser_credential=False),
      credential_scopes=["https://cognitiveservices.azure.com/.default"],
      api_version="2024-06-01",  # AOAI api-version. Update as needed.
  )
  ```

  During application development, you would typically set up the environment for authentication using Entra ID by first [Installing the Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli), running `az login` in your console window, then entering your credentials in the browser window that was opened. The call to `DefaultAzureCredential()` will then succeed. Setting `exclude_interactive_browser_credential=False` in that call will enable launching a browser window if the user isn't already logged in.



  You can define default chat completions or embeddings configurations while constructing the relevant client. These configurations will be applied to all future service calls.

  For example, here we create a `ChatCompletionsClient` using API key authentication, and apply two settings, `temperature` and `max_tokens`:

  ```python
  from azure.ai.inference import ChatCompletionsClient
  from azure.core.credentials import AzureKeyCredential


  client = ChatCompletionsClient(
      endpoint=endpoint,
      credential=AzureKeyCredential(key)
      temperature=0.5,
      max_tokens=1000
  )
  ```

  Default settings can be overridden in individual service calls.



  If you are using Serverless API or Managed Compute endpoints, there is an alternative to creating a specific client directly. You can instead use the function `load_client` to return the relevant client (of types `ChatCompletionsClient` or `EmbeddingsClient`) based on the provided endpoint:

  ```python
  from azure.ai.inference import load_client
  from azure.core.credentials import AzureKeyCredential



  client = load_client(
      endpoint=endpoint,
      credential=AzureKeyCredential(key)
  )

  print(f"Created client of type `{type(client).__name__}`.")
  ```

  To load an asynchronous client, import the `load_client` function from `azure.ai.inference.aio` instead.

  Entra ID authentication is also supported by the `load_client` function. Replace the key authentication above with `credential=DefaultAzureCredential(exclude_interactive_browser_credential=False)` for example.



  If you are using Serverless API or Managed Compute endpoints, you can call the client method `get_model_info` to retrive AI model information. This makes a REST call to the `/info` route on the provided endpoint, as documented in [the REST API reference](https://learn.microsoft.com/azure/ai-studio/reference/reference-model-inference-info). This call will not work for GitHub Models or Azure OpenAI endpoints.

  <!-- SNIPPET:sample_get_model_info.get_model_info -->

  ```python
  model_info = client.get_model_info()

  print(f"Model name: {model_info.model_name}")
  print(f"Model provider name: {model_info.model_provider_name}")
  print(f"Model type: {model_info.model_type}")
  ```

  <!-- END SNIPPET -->

  AI model information is cached in the client, and futher calls to `get_model_info` will access the cached value and wil not result in a REST API call. Note that if you created the client using `load_client` function, model information will already be cached in the client.

  AI model information is displayed (if available) when you `print(client)`.



  The `ChatCompletionsClient` has a method named `complete`. The method makes a REST API call to the `/chat/completions` route on the provided endpoint, as documented in [the REST API reference](https://learn.microsoft.com/azure/ai-studio/reference/reference-model-inference-chat-completions).

  See simple chat completion examples below. More can be found in the [samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-inference/samples) folder.



  The `EmbeddingsClient` has a method named `embedding`. The method makes a REST API call to the `/embeddings` route on the provided endpoint, as documented in [the REST API reference](https://learn.microsoft.com/azure/ai-studio/reference/reference-model-inference-embeddings).

  See simple text embedding example below. More can be found in the [samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-inference/samples) folder.

  <!--


  TODO: Add overview and link to explain image embeddings.

  Embeddings operations target the URL route `images/embeddings` on the provided endpoint.
  -->



  In the following sections you will find simple examples of:

  * [Chat completions](#chat-completions-example)
  * [Streaming chat completions](#streaming-chat-completions-example)
  * [Chat completions with additional model-specific parameters](#chat-completions-with-additional-model-specific-parameters)
  * [Text Embeddings](#text-embeddings-example)
  <!-- * [Image Embeddings](#image-embeddings-example) -->

  The examples create a synchronous client assuming a Serverless API or Managed Compute endpoint. Modify client
  construction code as descirbed in [Key concepts](#key-concepts) to have it work with GitHub Models endpoint or Azure OpenAI
  endpoint. Only mandatory input settings are shown for simplicity.

  See the [Samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-inference/samples) folder for full working samples for synchronous and asynchronous clients.



  This example demonstrates how to generate a single chat completions, for a Serverless API or Managed Compute endpoint, with key authentication, assuming `endpoint` and `key` are already defined. For Entra ID authentication, GitHub models endpoint or Azure OpenAI endpoint, modify the code to create the client as specified in the above sections.

  <!-- SNIPPET:sample_chat_completions.chat_completions -->

  ```python
  from azure.ai.inference import ChatCompletionsClient
  from azure.ai.inference.models import SystemMessage, UserMessage
  from azure.core.credentials import AzureKeyCredential

  client = ChatCompletionsClient(endpoint=endpoint, credential=AzureKeyCredential(key))

  response = client.complete(
      messages=[
          SystemMessage(content="You are a helpful assistant."),
          UserMessage(content="How many feet are in a mile?"),
      ]
  )

  print(response.choices[0].message.content)
  ```

  <!-- END SNIPPET -->

  The following types or messages are supported: `SystemMessage`,`UserMessage`, `AssistantMessage`, `ToolMessage`. See also samples:

  * [sample_chat_completions_with_tools.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_with_tools.py) for usage of `ToolMessage`.
  * [sample_chat_completions_with_image_url.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_with_image_url.py) for usage of `UserMessage` that
  includes sending an image URL.
  * [sample_chat_completions_with_image_data.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_with_image_data.py) for usage of `UserMessage` that
  includes sending image data read from a local file.

  Alternatively, you can provide the messages as dictionary instead of using the strongly typed classes like `SystemMessage` and `UserMessage`:

  <!-- SNIPPET:sample_chat_completions_from_input_json.chat_completions -->

  ```python
  response = client.complete(
      {
          "messages": [
              {
                  "role": "system",
                  "content": "You are an AI assistant that helps people find information. Your replies are short, no more than two sentences.",
              },
              {
                  "role": "user",
                  "content": "What year was construction of the International Space Station mostly done?",
              },
              {
                  "role": "assistant",
                  "content": "The main construction of the International Space Station (ISS) was completed between 1998 and 2011. During this period, more than 30 flights by US space shuttles and 40 by Russian rockets were conducted to transport components and modules to the station.",
              },
              {
                  "role": "user",
                  "content": "And what was the estimated cost to build it?"
              },
          ]
      }
  )
  ```

  <!-- END SNIPPET -->

  To generate completions for additional messages, simply call `client.complete` multiple times using the same `client`.



  This example demonstrates how to generate a single chat completions with streaming response, for a Serverless API or Managed Compute endpoint, with key authentication, assuming `endpoint` and `key` are already defined. You simply need to add `stream=True` to the `complete` call to enable streaming.

  For Entra ID authentication, GitHub models endpoint or Azure OpenAI endpoint, modify the code to create the client as specified in the above sections.

  <!-- SNIPPET:sample_chat_completions_streaming.chat_completions_streaming -->

  ```python
  from azure.ai.inference import ChatCompletionsClient
  from azure.ai.inference.models import SystemMessage, UserMessage
  from azure.core.credentials import AzureKeyCredential

  client = ChatCompletionsClient(endpoint=endpoint, credential=AzureKeyCredential(key))

  response = client.complete(
      stream=True,
      messages=[
          SystemMessage(content="You are a helpful assistant."),
          UserMessage(content="Give me 5 good reasons why I should exercise every day."),
      ],
  )

  for update in response:
      print(update.choices[0].delta.content or "", end="", flush=True)

  client.close()
  ```

  <!-- END SNIPPET -->

  In the above `for` loop that prints the results you should see the answer progressively get longer as updates get streamed to the client.

  To generate completions for additional messages, simply call `client.complete` multiple times using the same `client`.



  In this example, extra JSON elements are inserted at the root of the request body by setting `model_extras` when calling the `complete` method. These are intended for AI models that require additional model-specific parameters beyond what is defined in the REST API [Request Body table](https://learn.microsoft.com/azure/ai-studio/reference/reference-model-inference-chat-completions#request-body).

  <!-- SNIPPET:sample_chat_completions_with_model_extras.model_extras -->

  ```python
  response = client.complete(
      messages=[
          SystemMessage(content="You are a helpful assistant."),
          UserMessage(content="How many feet are in a mile?"),
      ],
      model_extras={"key1": "value1", "key2": "value2"},  # Optional. Additional parameters to pass to the model.
  )
  ```

  <!-- END SNIPPET -->
  In the above example, this will be the JSON payload in the HTTP request:

  ```json
  {
      "messages":
      [
          {"role":"system","content":"You are a helpful assistant."},
          {"role":"user","content":"How many feet are in a mile?"}
      ],
      "key1": "value1",
      "key2": "value2"
  }
  ```

  Note that by default, the service will reject any request payload that includes extra parameters. In order to change the default service behaviour, when the `complete` method includes `model_extras`, the client library will automatically add the HTTP request header `"extra-parameters": "pass-through"`.



  This example demonstrates how to get text embeddings, for a Serverless API or Managed Compute endpoint, with key authentication, assuming `endpoint` and `key` are already defined. For Entra ID authentication, GitHub models endpoint or Azure OpenAI endpoint, modify the code to create the client as specified in the above sections.

  <!-- SNIPPET:sample_embeddings.embeddings -->

  ```python
  from azure.ai.inference import EmbeddingsClient
  from azure.core.credentials import AzureKeyCredential

  client = EmbeddingsClient(endpoint=endpoint, credential=AzureKeyCredential(key))

  response = client.embed(input=["first phrase", "second phrase", "third phrase"])

  for item in response.data:
      length = len(item.embedding)
      print(
          f"data[{item.index}]: length={length}, [{item.embedding[0]}, {item.embedding[1]}, "
          f"..., {item.embedding[length-2]}, {item.embedding[length-1]}]"
      )
  ```

  <!-- END SNIPPET -->

  The length of the embedding vector depends on the model, but you should see something like this:

  ```text
  data[0]: length=1024, [0.0013399124, -0.01576233, ..., 0.007843018, 0.000238657]
  data[1]: length=1024, [0.036590576, -0.0059547424, ..., 0.011405945, 0.004863739]
  data[2]: length=1024, [0.04196167, 0.029083252, ..., -0.0027484894, 0.0073127747]
  ```

  To generate embeddings for additional phrases, simply call `client.embed` multiple times using the same `client`.

  <!--


  This example demonstrates how to get image embeddings.

   <! -- SNIPPET:sample_image_embeddings.image_embeddings -- >

  ```python
  from azure.ai.inference import ImageEmbeddingsClient
  from azure.ai.inference.models import EmbeddingInput
  from azure.core.credentials import AzureKeyCredential

  with open("sample1.png", "rb") as f:
      image1: str = base64.b64encode(f.read()).decode("utf-8")
  with open("sample2.png", "rb") as f:
      image2: str = base64.b64encode(f.read()).decode("utf-8")

  client = ImageEmbeddingsClient(endpoint=endpoint, credential=AzureKeyCredential(key))

  response = client.embed(input=[EmbeddingInput(image=image1), EmbeddingInput(image=image2)])

  for item in response.data:
      length = len(item.embedding)
      print(
          f"data[{item.index}]: length={length}, [{item.embedding[0]}, {item.embedding[1]}, "
          f"..., {item.embedding[length-2]}, {item.embedding[length-1]}]"
      )
  ```

  -- END SNIPPET --

  The printed result of course depends on the model, but you should see something like this:

  ```txt
  TBD
  ```

  To generate embeddings for additional phrases, simply call `client.embed` multiple times using the same `client`.
  -->





  The `complete`, `embed` and `get_model_info` methods on the clients raise an [HttpResponseError](https://learn.microsoft.com/python/api/azure-core/azure.core.exceptions.httpresponseerror) exception for a non-success HTTP status code response from the service. The exception's `status_code` will hold the HTTP response status code (with `reason` showing the friendly name). The exception's `error.message` contains a detailed message that may be helpful in diagnosing the issue:

  ```python
  from azure.core.exceptions import HttpResponseError

  ...

  try:
      result = client.complete( ... )
  except HttpResponseError as e:
      print(f"Status code: {e.status_code} ({e.reason})")
      print(e.message)
  ```

  For example, when you provide a wrong authentication key:

  ```text
  Status code: 401 (Unauthorized)
  Operation returned an invalid status 'Unauthorized'
  ```

  Or when you create an `EmbeddingsClient` and call `embed` on the client, but the endpoint does not
  support the `/embeddings` route:

  ```text
  Status code: 405 (Method Not Allowed)
  Operation returned an invalid status 'Method Not Allowed'
  ```



  The client uses the standard [Python logging library](https://docs.python.org/3/library/logging.html). The SDK logs HTTP request and response details, which may be useful in troubleshooting. To log to stdout, add the following:

  ```python
  import sys
  import logging



  logger = logging.getLogger("azure")


  logger.setLevel(logging.DEBUG)


  handler = logging.StreamHandler(stream=sys.stdout)


  logger.addHandler(handler)


  formatter = logging.Formatter("s:s:s:s")
  handler.setFormatter(formatter)
  ```

  By default logs redact the values of URL query strings, the values of some HTTP request and response headers (including `Authorization` which holds the key or token), and the request and response payloads. To create logs without redaction, do these two things:

  1. Set the method argument `logging_enable = True` when you construct the client library, or when you call the client's `complete` or `embed`  methods.
      ```python
      client = ChatCompletionsClient(
          endpoint=endpoint,
          credential=AzureKeyCredential(key),
          logging_enable=True
      )
      ```
  1. Set the log level to `logging.DEBUG`. Logs will be redacted with any other log level.

  Be sure to protect non redacted logs to avoid compromising security.

  For more information, see [Configure logging in the Azure libraries for Python](https://aka.ms/azsdk/python/logging)



  To report issues with the client library, or request additional features, please open a GitHub issue [here](https://github.com/Azure/azure-sdk-for-python/issues)



  * Have a look at the [Samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-inference/samples) folder, containing fully runnable Python code for doing inference using synchronous and asynchronous clients.



  This project welcomes contributions and suggestions. Most contributions require
  you to agree to a Contributor License Agreement (CLA) declaring that you have
  the right to, and actually do, grant us the rights to use your contribution.
  For details, visit [https://cla.microsoft.com](https://cla.microsoft.com).

  When you submit a pull request, a CLA-bot will automatically determine whether
  you need to provide a CLA and decorate the PR appropriately (e.g., label,
  comment). Simply follow the instructions provided by the bot. You will only
  need to do this once across all repos using our CLA.

  This project has adopted the
  [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct). For more information,
  see the Code of Conduct FAQ or contact opencode@microsoft.com with any
  additional questions or comments.


  <!-- Note: I did not use LINKS section here with a list of `[link-label](link-url)` because these
  links don't work in the Sphinx generated documentation. The index.html page of these docs
  include this README, but with broken links.-->


pkgId: e9ec834334662269f8fdf6e17541d4ea4433cdf455a7455b5a6d87af5e745cb7
name: python-azure-ai-inference
arch: src
version: 1.0.0b5
epoch: 0
release: 1
summary: Microsoft Azure Ai Inference Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-inference
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-inference-1.0.0b5-1.src.rpm
checksum_type: sha256
description:
  Use the Inference client library (in preview) to:

  * Authenticate against the service
  * Get information about the AI model
  * Do chat completions
  * Get text embeddings
  <!-- * Get image embeddings -->

  The Inference client library supports AI models deployed to the following services:

  * [GitHub Models](https://github.com/marketplace/models) - Free-tier endpoint for AI models from different providers
  * Serverless API endpoints and Managed Compute endpoints - AI models from different providers deployed from [Azure AI Studio](https://ai.azure.com). See [Overview: Deploy models, flows, and web apps with Azure AI Studio](https://learn.microsoft.com/azure/ai-studio/concepts/deployments-overview).
  * Azure OpenAI Service - OpenAI models deployed from [Azure OpenAI Studio](https://oai.azure.com/). See [What is Azure OpenAI Service?](https://learn.microsoft.com/azure/ai-services/openai/overview). Although we recommend you use the official [OpenAI client library](https://pypi.org/project/openai/) in your production code for this service, you can use the Azure AI Inference client library to easily compare the performance of OpenAI models to other models, using the same client library and Python code.

  The Inference client library makes services calls using REST API version `2024-05-01-preview`, as documented in [Azure AI Model Inference API](https://aka.ms/azureai/modelinference).

  [Product documentation](https://aka.ms/azureai/modelinference)
  | [Samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-inference/samples)
  | [API reference documentation](https://aka.ms/azsdk/azure-ai-inference/python/reference)
  | [Package (Pypi)](https://aka.ms/azsdk/azure-ai-inference/python/package)
  | [SDK source code](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-inference/azure/ai/inference)





  * [Python 3.8](https://www.python.org/) or later installed, including [pip](https://pip.pypa.io/en/stable/).
  Studio.
  * For GitHub models
    * The AI model name, such as "gpt-4o" or "mistral-large"
    * A GitHub personal access token. [Create one here](https://github.com/settings/tokens). You do not need to give any permissions to the token. The token is a string that starts with `github_pat_`.
  * For Serverless API endpoints or Managed Compute endpoints
    * An [Azure subscription](https://azure.microsoft.com/free).
    * An [AI Model from the catalog](https://ai.azure.com/explore/models) deployed through Azure AI Studio.
    * The endpoint URL of your model, in of the form `https://<your-host-name>.<your-azure-region>.models.ai.azure.com`, where `your-host-name` is your unique model deployment host name and `your-azure-region` is the Azure region where the model is deployed (e.g. `eastus2`).
    * Depending on your authentication preference, you either need an API key to authenticate against the service, or Entra ID credentials. The API key is a 32-character string.
  * For Azure OpenAI (AOAI) service
    * An [Azure subscription](https://azure.microsoft.com/free).
    * An [OpenAI Model from the catalog](https://oai.azure.com/resource/models) deployed through Azure OpenAI Studio.
    * The endpoint URL of your model, in the form `https://<your-resouce-name>.openai.azure.com/openai/deployments/<your-deployment-name>`, where `your-resource-name` is your globally unique AOAI resource name, and `your-deployment-name` is your AI Model deployment name.
    * Depending on your authentication preference, you either need an API key to authenticate against the service, or Entra ID credentials. The API key is a 32-character string.
    * An api-version. Latest preview or GA version listed in the `Data plane - inference` row in [the API Specs table](https://aka.ms/azsdk/azure-ai-inference/azure-openai-api-versions). At the time of writing, latest GA version was "2024-06-01".



  To install the Azure AI Inferencing package use the following command:

  ```bash
  pip install azure-ai-inference
  ```

  To update an existing installation of the package, use:

  ```bash
  pip install --upgrade azure-ai-inference
  ```

  If you want to install Azure AI Inferencing package with support for OpenTelemetry based tracing, use the following command:

  ```bash
  pip install azure-ai-inference[opentelemetry]
  ```





  The package includes two clients `ChatCompletionsClient` and `EmbeddingsClient`<!-- and `ImageGenerationClients`-->. Both can be created in the similar manner. For example, assuming `endpoint`, `key` and `github_token` are strings holding your endpoint URL, API key or GitHub token, this Python code will create and authenticate a synchronous `ChatCompletionsClient`:

  ```python
  from azure.ai.inference import ChatCompletionsClient
  from azure.core.credentials import AzureKeyCredential


  client = ChatCompletionsClient(
      endpoint="https://models.inference.ai.azure.com",
      credential=AzureKeyCredential(github_token),
      model="mistral-large" # Update as needed. Alternatively, you can include this is the `complete` call.
  )


  client = ChatCompletionsClient(
      endpoint=endpoint,  # Of the form https://<your-host-name>.<your-azure-region>.models.ai.azure.com
      credential=AzureKeyCredential(key)
  )


  client = ChatCompletionsClient(
      endpoint=endpoint,  # Of the form https://<your-resouce-name>.openai.azure.com/openai/deployments/<your-deployment-name>
      credential=AzureKeyCredential(key),
      api_version="2024-06-01",  # Azure OpenAI api-version. See https://aka.ms/azsdk/azure-ai-inference/azure-openai-api-versions
  )
  ```

  A synchronous client supports synchronous inference methods, meaning they will block until the service responds with inference results. For simplicity the code snippets below all use synchronous methods. The client offers equivalent asynchronous methods which are more commonly used in production.

  To create an asynchronous client, Install the additional package [aiohttp](https://pypi.org/project/aiohttp/):

  ```bash
  pip install aiohttp
  ```

  and update the code above to import `asyncio`, and import `ChatCompletionsClient` from the `azure.ai.inference.aio` namespace instead of `azure.ai.inference`. For example:

  ```python
  import asyncio
  from azure.ai.inference.aio import ChatCompletionsClient
  from azure.core.credentials import AzureKeyCredential


  client = ChatCompletionsClient(
      endpoint=endpoint,
      credential=AzureKeyCredential(key)
  )
  ```



  _Note: At the time of writing, only Managed Compute endpoints and Azure OpenAI endpoints support Entra ID authentication.

  To use an Entra ID token credential, first install the [azure-identity](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity) package:

  ```python
  pip install azure.identity
  ```

  You will need to provide the desired credential type obtained from that package. A common selection is [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential) and it can be used as follows:

  ```python
  from azure.ai.inference import ChatCompletionsClient
  from azure.identity import DefaultAzureCredential


  client = ChatCompletionsClient(
      endpoint=endpoint,
      credential=DefaultAzureCredential(exclude_interactive_browser_credential=False)
  )


  client = ChatCompletionsClient(
      endpoint=endpoint,
      credential=DefaultAzureCredential(exclude_interactive_browser_credential=False),
      credential_scopes=["https://cognitiveservices.azure.com/.default"],
      api_version="2024-06-01",  # Azure OpenAI api-version. See https://aka.ms/azsdk/azure-ai-inference/azure-openai-api-versions
  )
  ```

  During application development, you would typically set up the environment for authentication using Entra ID by first [Installing the Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli), running `az login` in your console window, then entering your credentials in the browser window that was opened. The call to `DefaultAzureCredential()` will then succeed. Setting `exclude_interactive_browser_credential=False` in that call will enable launching a browser window if the user isn't already logged in.



  You can define default chat completions or embeddings configurations while constructing the relevant client. These configurations will be applied to all future service calls.

  For example, here we create a `ChatCompletionsClient` using API key authentication, and apply two settings, `temperature` and `max_tokens`:

  ```python
  from azure.ai.inference import ChatCompletionsClient
  from azure.core.credentials import AzureKeyCredential


  client = ChatCompletionsClient(
      endpoint=endpoint,
      credential=AzureKeyCredential(key)
      temperature=0.5,
      max_tokens=1000
  )
  ```

  Default settings can be overridden in individual service calls.



  If you are using Serverless API or Managed Compute endpoints, there is an alternative to creating a specific client directly. You can instead use the function `load_client` to return the relevant client (of types `ChatCompletionsClient` or `EmbeddingsClient`) based on the provided endpoint:

  ```python
  from azure.ai.inference import load_client
  from azure.core.credentials import AzureKeyCredential



  client = load_client(
      endpoint=endpoint,
      credential=AzureKeyCredential(key)
  )

  print(f"Created client of type `{type(client).__name__}`.")
  ```

  To load an asynchronous client, import the `load_client` function from `azure.ai.inference.aio` instead.

  Entra ID authentication is also supported by the `load_client` function. Replace the key authentication above with `credential=DefaultAzureCredential(exclude_interactive_browser_credential=False)` for example.



  If you are using Serverless API or Managed Compute endpoints, you can call the client method `get_model_info` to retrive AI model information. This makes a REST call to the `/info` route on the provided endpoint, as documented in [the REST API reference](https://learn.microsoft.com/azure/ai-studio/reference/reference-model-inference-info). This call will not work for GitHub Models or Azure OpenAI endpoints.

  <!-- SNIPPET:sample_get_model_info.get_model_info -->

  ```python
  model_info = client.get_model_info()

  print(f"Model name: {model_info.model_name}")
  print(f"Model provider name: {model_info.model_provider_name}")
  print(f"Model type: {model_info.model_type}")
  ```

  <!-- END SNIPPET -->

  AI model information is cached in the client, and futher calls to `get_model_info` will access the cached value and wil not result in a REST API call. Note that if you created the client using `load_client` function, model information will already be cached in the client.

  AI model information is displayed (if available) when you `print(client)`.



  The `ChatCompletionsClient` has a method named `complete`. The method makes a REST API call to the `/chat/completions` route on the provided endpoint, as documented in [the REST API reference](https://learn.microsoft.com/azure/ai-studio/reference/reference-model-inference-chat-completions).

  See simple chat completion examples below. More can be found in the [samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-inference/samples) folder.



  The `EmbeddingsClient` has a method named `embedding`. The method makes a REST API call to the `/embeddings` route on the provided endpoint, as documented in [the REST API reference](https://learn.microsoft.com/azure/ai-studio/reference/reference-model-inference-embeddings).

  See simple text embedding example below. More can be found in the [samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-inference/samples) folder.

  <!--


  TODO: Add overview and link to explain image embeddings.

  Embeddings operations target the URL route `images/embeddings` on the provided endpoint.
  -->



  In the following sections you will find simple examples of:

  * [Chat completions](#chat-completions-example)
  * [Streaming chat completions](#streaming-chat-completions-example)
  * [Chat completions with additional model-specific parameters](#chat-completions-with-additional-model-specific-parameters)
  * [Text Embeddings](#text-embeddings-example)
  <!-- * [Image Embeddings](#image-embeddings-example) -->

  The examples create a synchronous client assuming a Serverless API or Managed Compute endpoint. Modify client
  construction code as descirbed in [Key concepts](#key-concepts) to have it work with GitHub Models endpoint or Azure OpenAI
  endpoint. Only mandatory input settings are shown for simplicity.

  See the [Samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-inference/samples) folder for full working samples for synchronous and asynchronous clients.



  This example demonstrates how to generate a single chat completions, for a Serverless API or Managed Compute endpoint, with key authentication, assuming `endpoint` and `key` are already defined. For Entra ID authentication, GitHub models endpoint or Azure OpenAI endpoint, modify the code to create the client as specified in the above sections.

  <!-- SNIPPET:sample_chat_completions.chat_completions -->

  ```python
  from azure.ai.inference import ChatCompletionsClient
  from azure.ai.inference.models import SystemMessage, UserMessage
  from azure.core.credentials import AzureKeyCredential

  client = ChatCompletionsClient(endpoint=endpoint, credential=AzureKeyCredential(key))

  response = client.complete(
      messages=[
          SystemMessage(content="You are a helpful assistant."),
          UserMessage(content="How many feet are in a mile?"),
      ]
  )

  print(response.choices[0].message.content)
  ```

  <!-- END SNIPPET -->

  The following types or messages are supported: `SystemMessage`,`UserMessage`, `AssistantMessage`, `ToolMessage`. See also samples:

  * [sample_chat_completions_with_tools.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_with_tools.py) for usage of `ToolMessage`.
  * [sample_chat_completions_with_image_url.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_with_image_url.py) for usage of `UserMessage` that
  includes sending an image URL.
  * [sample_chat_completions_with_image_data.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-inference/samples/sample_chat_completions_with_image_data.py) for usage of `UserMessage` that
  includes sending image data read from a local file.

  Alternatively, you can provide the messages as dictionary instead of using the strongly typed classes like `SystemMessage` and `UserMessage`:

  <!-- SNIPPET:sample_chat_completions_from_input_json.chat_completions -->

  ```python
  response = client.complete(
      {
          "messages": [
              {
                  "role": "system",
                  "content": "You are an AI assistant that helps people find information. Your replies are short, no more than two sentences.",
              },
              {
                  "role": "user",
                  "content": "What year was construction of the International Space Station mostly done?",
              },
              {
                  "role": "assistant",
                  "content": "The main construction of the International Space Station (ISS) was completed between 1998 and 2011. During this period, more than 30 flights by US space shuttles and 40 by Russian rockets were conducted to transport components and modules to the station.",
              },
              {
                  "role": "user",
                  "content": "And what was the estimated cost to build it?"
              },
          ]
      }
  )
  ```

  <!-- END SNIPPET -->

  To generate completions for additional messages, simply call `client.complete` multiple times using the same `client`.



  This example demonstrates how to generate a single chat completions with streaming response, for a Serverless API or Managed Compute endpoint, with key authentication, assuming `endpoint` and `key` are already defined. You simply need to add `stream=True` to the `complete` call to enable streaming.

  For Entra ID authentication, GitHub models endpoint or Azure OpenAI endpoint, modify the code to create the client as specified in the above sections.

  <!-- SNIPPET:sample_chat_completions_streaming.chat_completions_streaming -->

  ```python
  from azure.ai.inference import ChatCompletionsClient
  from azure.ai.inference.models import SystemMessage, UserMessage
  from azure.core.credentials import AzureKeyCredential

  client = ChatCompletionsClient(endpoint=endpoint, credential=AzureKeyCredential(key))

  response = client.complete(
      stream=True,
      messages=[
          SystemMessage(content="You are a helpful assistant."),
          UserMessage(content="Give me 5 good reasons why I should exercise every day."),
      ],
  )

  for update in response:
      print(update.choices[0].delta.content or "", end="", flush=True)

  client.close()
  ```

  <!-- END SNIPPET -->

  In the above `for` loop that prints the results you should see the answer progressively get longer as updates get streamed to the client.

  To generate completions for additional messages, simply call `client.complete` multiple times using the same `client`.



  In this example, extra JSON elements are inserted at the root of the request body by setting `model_extras` when calling the `complete` method. These are intended for AI models that require additional model-specific parameters beyond what is defined in the REST API [Request Body table](https://learn.microsoft.com/azure/ai-studio/reference/reference-model-inference-chat-completions#request-body).

  <!-- SNIPPET:sample_chat_completions_with_model_extras.model_extras -->

  ```python
  response = client.complete(
      messages=[
          SystemMessage(content="You are a helpful assistant."),
          UserMessage(content="How many feet are in a mile?"),
      ],
      model_extras={"key1": "value1", "key2": "value2"},  # Optional. Additional parameters to pass to the model.
  )
  ```

  <!-- END SNIPPET -->
  In the above example, this will be the JSON payload in the HTTP request:

  ```json
  {
      "messages":
      [
          {"role":"system","content":"You are a helpful assistant."},
          {"role":"user","content":"How many feet are in a mile?"}
      ],
      "key1": "value1",
      "key2": "value2"
  }
  ```

  Note that by default, the service will reject any request payload that includes extra parameters. In order to change the default service behaviour, when the `complete` method includes `model_extras`, the client library will automatically add the HTTP request header `"extra-parameters": "pass-through"`.



  This example demonstrates how to get text embeddings, for a Serverless API or Managed Compute endpoint, with key authentication, assuming `endpoint` and `key` are already defined. For Entra ID authentication, GitHub models endpoint or Azure OpenAI endpoint, modify the code to create the client as specified in the above sections.

  <!-- SNIPPET:sample_embeddings.embeddings -->

  ```python
  from azure.ai.inference import EmbeddingsClient
  from azure.core.credentials import AzureKeyCredential

  client = EmbeddingsClient(endpoint=endpoint, credential=AzureKeyCredential(key))

  response = client.embed(input=["first phrase", "second phrase", "third phrase"])

  for item in response.data:
      length = len(item.embedding)
      print(
          f"data[{item.index}]: length={length}, [{item.embedding[0]}, {item.embedding[1]}, "
          f"..., {item.embedding[length-2]}, {item.embedding[length-1]}]"
      )
  ```

  <!-- END SNIPPET -->

  The length of the embedding vector depends on the model, but you should see something like this:

  ```text
  data[0]: length=1024, [0.0013399124, -0.01576233, ..., 0.007843018, 0.000238657]
  data[1]: length=1024, [0.036590576, -0.0059547424, ..., 0.011405945, 0.004863739]
  data[2]: length=1024, [0.04196167, 0.029083252, ..., -0.0027484894, 0.0073127747]
  ```

  To generate embeddings for additional phrases, simply call `client.embed` multiple times using the same `client`.

  <!--


  This example demonstrates how to get image embeddings.

   <! -- SNIPPET:sample_image_embeddings.image_embeddings -- >

  ```python
  from azure.ai.inference import ImageEmbeddingsClient
  from azure.ai.inference.models import EmbeddingInput
  from azure.core.credentials import AzureKeyCredential

  with open("sample1.png", "rb") as f:
      image1: str = base64.b64encode(f.read()).decode("utf-8")
  with open("sample2.png", "rb") as f:
      image2: str = base64.b64encode(f.read()).decode("utf-8")

  client = ImageEmbeddingsClient(endpoint=endpoint, credential=AzureKeyCredential(key))

  response = client.embed(input=[EmbeddingInput(image=image1), EmbeddingInput(image=image2)])

  for item in response.data:
      length = len(item.embedding)
      print(
          f"data[{item.index}]: length={length}, [{item.embedding[0]}, {item.embedding[1]}, "
          f"..., {item.embedding[length-2]}, {item.embedding[length-1]}]"
      )
  ```

  -- END SNIPPET --

  The printed result of course depends on the model, but you should see something like this:

  ```txt
  TBD
  ```

  To generate embeddings for additional phrases, simply call `client.embed` multiple times using the same `client`.
  -->





  The `complete`, `embed` and `get_model_info` methods on the clients raise an [HttpResponseError](https://learn.microsoft.com/python/api/azure-core/azure.core.exceptions.httpresponseerror) exception for a non-success HTTP status code response from the service. The exception's `status_code` will hold the HTTP response status code (with `reason` showing the friendly name). The exception's `error.message` contains a detailed message that may be helpful in diagnosing the issue:

  ```python
  from azure.core.exceptions import HttpResponseError

  ...

  try:
      result = client.complete( ... )
  except HttpResponseError as e:
      print(f"Status code: {e.status_code} ({e.reason})")
      print(e.message)
  ```

  For example, when you provide a wrong authentication key:

  ```text
  Status code: 401 (Unauthorized)
  Operation returned an invalid status 'Unauthorized'
  ```

  Or when you create an `EmbeddingsClient` and call `embed` on the client, but the endpoint does not
  support the `/embeddings` route:

  ```text
  Status code: 405 (Method Not Allowed)
  Operation returned an invalid status 'Method Not Allowed'
  ```



  The client uses the standard [Python logging library](https://docs.python.org/3/library/logging.html). The SDK logs HTTP request and response details, which may be useful in troubleshooting. To log to stdout, add the following:

  ```python
  import sys
  import logging



  logger = logging.getLogger("azure")


  logger.setLevel(logging.DEBUG)


  handler = logging.StreamHandler(stream=sys.stdout)


  logger.addHandler(handler)


  formatter = logging.Formatter("s:s:s:s")
  handler.setFormatter(formatter)
  ```

  By default logs redact the values of URL query strings, the values of some HTTP request and response headers (including `Authorization` which holds the key or token), and the request and response payloads. To create logs without redaction, do these two things:

  1. Set the method argument `logging_enable = True` when you construct the client library, or when you call the client's `complete` or `embed`  methods.
      ```python
      client = ChatCompletionsClient(
          endpoint=endpoint,
          credential=AzureKeyCredential(key),
          logging_enable=True
      )
      ```
  1. Set the log level to `logging.DEBUG`. Logs will be redacted with any other log level.

  Be sure to protect non redacted logs to avoid compromising security.

  For more information, see [Configure logging in the Azure libraries for Python](https://aka.ms/azsdk/python/logging)



  To report issues with the client library, or request additional features, please open a GitHub issue [here](https://github.com/Azure/azure-sdk-for-python/issues)



  The Azure AI Inferencing API Tracing library provides tracing for Azure AI Inference client library for Python. Refer to Installation chapter above for installation instructions.



  The environment variable AZURE_TRACING_GEN_AI_CONTENT_RECORDING_ENABLED controls whether the actual message contents will be recorded in the traces or not. By default, the message contents are not recorded as part of the trace. When message content recording is disabled any function call tool related function names, function parameter names and function parameter values are also not recorded in the trace. Set the value of the environment variable to "true" (case insensitive) for the message contents to be recorded as part of the trace. Any other value will cause the message contents not to be recorded.

  You also need to configure the tracing implementation in your code by setting `AZURE_SDK_TRACING_IMPLEMENTATION` to `opentelemetry` or configuring it in the code with the following snippet:

  <!-- SNIPPET:sample_chat_completions_with_tracing.trace_setting -->

  ```python
  from azure.core.settings import settings
  settings.tracing_implementation = "opentelemetry"
  ```

  <!-- END SNIPPET -->

  Please refer to [azure-core-tracing-documentation](https://learn.microsoft.com/python/api/overview/azure/core-tracing-opentelemetry-readme) for more information.



  Azure AI Inference is instrumented with OpenTelemetry. In order to enable tracing you need to configure OpenTelemetry to export traces to your observability backend.
  Refer to [Azure SDK tracing in Python](https://learn.microsoft.com/python/api/overview/azure/core-tracing-opentelemetry-readme?view=azure-python-preview) for more details.

  Refer to [Azure Monitor OpenTelemetry documentation](https://learn.microsoft.com/azure/azure-monitor/app/opentelemetry-enable?tabs=python) for the details on how to send Azure AI Inference traces to Azure Monitor and create Azure Monitor resource.



  Use the AIInferenceInstrumentor to instrument the Azure AI Inferencing API for LLM tracing, this will cause the LLM traces to be emitted from Azure AI Inferencing API.

  <!-- SNIPPET:sample_chat_completions_with_tracing.instrument_inferencing -->

  ```python
  from azure.ai.inference.tracing import AIInferenceInstrumentor

  AIInferenceInstrumentor().instrument()
  ```

  <!-- END SNIPPET -->


  It is also possible to uninstrument the Azure AI Inferencing API by using the uninstrument call. After this call, the traces will no longer be emitted by the Azure AI Inferencing API until instrument is called again.

  <!-- SNIPPET:sample_chat_completions_with_tracing.uninstrument_inferencing -->

  ```python
  AIInferenceInstrumentor().uninstrument()
  ```

  <!-- END SNIPPET -->


  The @tracer.start_as_current_span decorator can be used to trace your own functions. This will trace the function parameters and their values. You can also add further attributes to the span in the function implementation as demonstrated below. Note that you will have to setup the tracer in your code before using the decorator. More information is available [here](https://opentelemetry.io/docs/languages/python/).

  <!-- SNIPPET:sample_chat_completions_with_tracing.trace_function -->

  ```python
  from opentelemetry.trace import get_tracer
  tracer = get_tracer(__name__)



  @tracer.start_as_current_span("get_temperature") # type: ignore
  def get_temperature(city: str) -> str:

      
      span = trace.get_current_span()
      span.set_attribute("requested_city", city)

      if city == "Seattle":
          return "75"
      elif city == "New York City":
          return "80"
      else:
          return "Unavailable"
  ```

  <!-- END SNIPPET -->



  * Have a look at the [Samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-inference/samples) folder, containing fully runnable Python code for doing inference using synchronous and asynchronous clients.



  This project welcomes contributions and suggestions. Most contributions require
  you to agree to a Contributor License Agreement (CLA) declaring that you have
  the right to, and actually do, grant us the rights to use your contribution.
  For details, visit [https://cla.microsoft.com](https://cla.microsoft.com).

  When you submit a pull request, a CLA-bot will automatically determine whether
  you need to provide a CLA and decorate the PR appropriately (e.g., label,
  comment). Simply follow the instructions provided by the bot. You will only
  need to do this once across all repos using our CLA.

  This project has adopted the
  [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct). For more information,
  see the Code of Conduct FAQ or contact opencode@microsoft.com with any
  additional questions or comments.


  <!-- Note: I did not use LINKS section here with a list of `[link-label](link-url)` because these
  links don't work in the Sphinx generated documentation. The index.html page of these docs
  include this README, but with broken links.-->


pkgId: 32ef2c1c056283d6fdc0c3c98774aa9545dd6df620913ad0cfec7c4e885aa907
name: python-azure-ai-language-conversations
arch: src
version: 1.1.0
epoch: 0
release: 1
summary: Microsoft Azure Conversational Language Understanding Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-language-conversations-1.1.0-1.src.rpm
checksum_type: sha256
description:
  [![Build Status](https://dev.azure.com/azure-sdk/public/_apis/build/status/azure-sdk-for-python.client?branchName=main)](https://dev.azure.com/azure-sdk/public/_build/latest?definitionId=46?branchName=main)


  Conversational Language Understanding - aka **CLU** for short - is a cloud-based conversational AI service which provides many language understanding capabilities like:
  - Conversation App: It's used in extracting intents and entities in conversations
  - Workflow app: Acts like an orchestrator to select the best candidate to analyze conversations to get best response from apps like Qna, Luis, and Conversation App
  - Conversational Summarization: Used to analyze conversations in the form of issues/resolution, chapter title, and narrative summarizations

  [Source code][conversationallanguage_client_src]
  | [Package (PyPI)][conversationallanguage_pypi_package]
  | [Package (Conda)](https://anaconda.org/microsoft/azure-ai-language-conversations/)
  | [API reference documentation][api_reference_documentation]
  | [Samples][conversationallanguage_samples]
  | [Product documentation][conversationallanguage_docs]
  | [REST API documentation][conversationallanguage_restdocs]





  * Python 3.7 or later is required to use this package.
  * An [Azure subscription][azure_subscription]
  * A [Language service resource][language_resource]




  Install the Azure Conversations client library for Python with [pip][pip_link]:

  ```bash
  pip install azure-ai-language-conversations
  ```

  > Note: This version of the client library defaults to the 2023-04-01 version of the service


  In order to interact with the CLU service, you'll need to create an instance of the [ConversationAnalysisClient][conversationanalysisclient_class] class, or [ConversationAuthoringClient][conversationauthoringclient_class] class. You will need an **endpoint**, and an **API key** to instantiate a client object. For more information regarding authenticating with Cognitive Services, see [Authenticate requests to Azure Cognitive Services][cognitive_auth].


  You can get the **endpoint** and an **API key** from the Cognitive Services resource in the [Azure Portal][azure_portal].

  Alternatively, use the [Azure CLI][azure_cli] command shown below to get the API key from the Cognitive Service resource.

  ```powershell
  az cognitiveservices account keys list --resource-group <resource-group-name> --name <resource-name>
  ```



  Once you've determined your **endpoint** and **API key** you can instantiate a `ConversationAnalysisClient`:

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.language.conversations import ConversationAnalysisClient

  endpoint = "https://<my-custom-subdomain>.cognitiveservices.azure.com/"
  credential = AzureKeyCredential("<api-key>")
  client = ConversationAnalysisClient(endpoint, credential)
  ```


  Once you've determined your **endpoint** and **API key** you can instantiate a `ConversationAuthoringClient`:

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.language.conversations.authoring import ConversationAuthoringClient

  endpoint = "https://<my-custom-subdomain>.cognitiveservices.azure.com/"
  credential = AzureKeyCredential("<api-key>")
  client = ConversationAuthoringClient(endpoint, credential)
  ```



  To use an [Azure Active Directory (AAD) token credential][cognitive_authentication_aad],
  provide an instance of the desired credential type obtained from the
  [azure-identity][azure_identity_credentials] library.
  Note that regional endpoints do not support AAD authentication. Create a [custom subdomain][custom_subdomain]
  name for your resource in order to use this type of authentication.

  Authentication with AAD requires some initial setup:

  - [Install azure-identity][install_azure_identity]
  - [Register a new AAD application][register_aad_app]
  - [Grant access][grant_role_access] to the Language service by assigning the "Cognitive Services Language Reader" role to your service principal.

  After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use.
  As an example, [DefaultAzureCredential][default_azure_credential]
  can be used to authenticate the client:

  Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
  `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`

  Use the returned token credential to authenticate the client:

  ```python
  from azure.ai.language.conversations import ConversationAnalysisClient
  from azure.identity import DefaultAzureCredential

  credential = DefaultAzureCredential()
  client = ConversationAnalysisClient(endpoint="https://<my-custom-subdomain>.cognitiveservices.azure.com/", credential=credential)
  ```




  The [ConversationAnalysisClient][conversationanalysisclient_class] is the primary interface for making predictions using your deployed Conversations models. For asynchronous operations, an async `ConversationAnalysisClient` is in the `azure.ai.language.conversation.aio` namespace.


  You can use the [ConversationAuthoringClient][conversationauthoringclient_class] to interface with the [Azure Language Portal][azure_language_portal] to carry out authoring operations on your language resource/project. For example, you can use it to create a project, populate with training data, train, test, and deploy. For asynchronous operations, an async `ConversationAuthoringClient` is in the `azure.ai.language.conversation.authoring.aio` namespace.


  The `azure-ai-language-conversation` client library provides both synchronous and asynchronous APIs.

  The following examples show common scenarios using the `client` [created above](#create-conversationanalysisclient).


  If you would like to extract custom intents and entities from a user utterance, you can call the `client.analyze_conversation()` method with your conversation's project name as follows:


  ```python

  import os
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.language.conversations import ConversationAnalysisClient


  clu_endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"]
  clu_key = os.environ["AZURE_CONVERSATIONS_KEY"]
  project_name = os.environ["AZURE_CONVERSATIONS_PROJECT_NAME"]
  deployment_name = os.environ["AZURE_CONVERSATIONS_DEPLOYMENT_NAME"]


  client = ConversationAnalysisClient(clu_endpoint, AzureKeyCredential(clu_key))
  with client:
      query = "Send an email to Carol about the tomorrow's demo"
      result = client.analyze_conversation(
          task={
              "kind": "Conversation",
              "analysisInput": {
                  "conversationItem": {
                      "participantId": "1",
                      "id": "1",
                      "modality": "text",
                      "language": "en",
                      "text": query
                  },
                  "isLoggingEnabled": False
              },
              "parameters": {
                  "projectName": project_name,
                  "deploymentName": deployment_name,
                  "verbose": True
              }
          }
      )


  print("query: {}".format(result["result"]["query"]))
  print("project kind: {}\n".format(result["result"]["prediction"]["projectKind"]))

  print("top intent: {}".format(result["result"]["prediction"]["topIntent"]))
  print("category: {}".format(result["result"]["prediction"]["intents"][0]["category"]))
  print("confidence score: {}\n".format(result["result"]["prediction"]["intents"][0]["confidenceScore"]))

  print("entities:")
  for entity in result["result"]["prediction"]["entities"]:
      print("\ncategory: {}".format(entity["category"]))
      print("text: {}".format(entity["text"]))
      print("confidence score: {}".format(entity["confidenceScore"]))
      if "resolutions" in entity:
          print("resolutions")
          for resolution in entity["resolutions"]:
              print("kind: {}".format(resolution["resolutionKind"]))
              print("value: {}".format(resolution["value"]))
      if "extraInformation" in entity:
          print("extra info")
          for data in entity["extraInformation"]:
              print("kind: {}".format(data["extraInformationKind"]))
              if data["extraInformationKind"] == "ListKey":
                  print("key: {}".format(data["key"]))
              if data["extraInformationKind"] == "EntitySubtype":
                  print("value: {}".format(data["value"]))
  ```



  If you would like to pass the user utterance to your orchestrator (worflow) app, you can call the `client.analyze_conversation()` method with your orchestration's project name. The orchestrator project simply orchestrates the submitted user utterance between your language apps (Luis, Conversation, and Question Answering) to get the best response according to the user intent. See the next example:


  ```python

  import os
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.language.conversations import ConversationAnalysisClient


  clu_endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"]
  clu_key = os.environ["AZURE_CONVERSATIONS_KEY"]
  project_name = os.environ["AZURE_CONVERSATIONS_WORKFLOW_PROJECT_NAME"]
  deployment_name = os.environ["AZURE_CONVERSATIONS_WORKFLOW_DEPLOYMENT_NAME"]


  client = ConversationAnalysisClient(clu_endpoint, AzureKeyCredential(clu_key))
  with client:
      query = "Reserve a table for 2 at the Italian restaurant"
      result = client.analyze_conversation(
          task={
              "kind": "Conversation",
              "analysisInput": {
                  "conversationItem": {
                      "participantId": "1",
                      "id": "1",
                      "modality": "text",
                      "language": "en",
                      "text": query
                  },
                  "isLoggingEnabled": False
              },
              "parameters": {
                  "projectName": project_name,
                  "deploymentName": deployment_name,
                  "verbose": True
              }
          }
      )


  print("query: {}".format(result["result"]["query"]))
  print("project kind: {}\n".format(result["result"]["prediction"]["projectKind"]))


  top_intent = result["result"]["prediction"]["topIntent"]
  print("top intent: {}".format(top_intent))
  top_intent_object = result["result"]["prediction"]["intents"][top_intent]
  print("confidence score: {}".format(top_intent_object["confidenceScore"]))
  print("project kind: {}".format(top_intent_object["targetProjectKind"]))

  if top_intent_object["targetProjectKind"] == "Luis":
      print("\nluis response:")
      luis_response = top_intent_object["result"]["prediction"]
      print("top intent: {}".format(luis_response["topIntent"]))
      print("\nentities:")
      for entity in luis_response["entities"]:
          print("\n{}".format(entity))
  ```



  You can use this sample if you need to summarize a conversation in the form of an issue, and final resolution. For example, a dialog from tech support:

  ```python

  import os
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.language.conversations import ConversationAnalysisClient

  endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"]
  key = os.environ["AZURE_CONVERSATIONS_KEY"]

  client = ConversationAnalysisClient(endpoint, AzureKeyCredential(key))
  with client:
      poller = client.begin_conversation_analysis(
          task={
              "displayName": "Analyze conversations from xxx",
              "analysisInput": {
                  "conversations": [
                      {
                          "conversationItems": [
                              {
                                  "text": "Hello, how can I help you?",
                                  "modality": "text",
                                  "id": "1",
                                  "participantId": "Agent"
                              },
                              {
                                  "text": "How to upgrade Office? I am getting error messages the whole day.",
                                  "modality": "text",
                                  "id": "2",
                                  "participantId": "Customer"
                              },
                              {
                                  "text": "Press the upgrade button please. Then sign in and follow the instructions.",
                                  "modality": "text",
                                  "id": "3",
                                  "participantId": "Agent"
                              }
                          ],
                          "modality": "text",
                          "id": "conversation1",
                          "language": "en"
                      },
                  ]
              },
              "tasks": [
                  {
                      "taskName": "Issue task",
                      "kind": "ConversationalSummarizationTask",
                      "parameters": {
                          "summaryAspects": ["issue"]
                      }
                  },
                  {
                      "taskName": "Resolution task",
                      "kind": "ConversationalSummarizationTask",
                      "parameters": {
                          "summaryAspects": ["resolution"]
                      }
                  },
              ]
          }
      )

      
      result = poller.result()
      task_results = result["tasks"]["items"]
      for task in task_results:
          print(f"\n{task['taskName']} status: {task['status']}")
          task_result = task["results"]
          if task_result["errors"]:
              print("... errors occurred ...")
              for error in task_result["errors"]:
                  print(error)
          else:
              conversation_result = task_result["conversations"][0]
              if conversation_result["warnings"]:
                  print("... view warnings ...")
                  for warning in conversation_result["warnings"]:
                      print(warning)
              else:
                  summaries = conversation_result["summaries"]
                  print("... view task result ...")
                  for summary in summaries:
                      print(f"{summary['aspect']}: {summary['text']}")
  ```


  This sample shows a common scenario for the authoring part of the SDK

  ```python
  import os
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.language.conversations.authoring import ConversationAuthoringClient

  clu_endpoint = os.environ["AZURE_CONVERSATIONS_ENDPOINT"]
  clu_key = os.environ["AZURE_CONVERSATIONS_KEY"]

  project_name = "test_project"

  exported_project_assets = {
      "projectKind": "Conversation",
      "intents": [{"category": "Read"}, {"category": "Delete"}],
      "entities": [{"category": "Sender"}],
      "utterances": [
          {
              "text": "Open Blake's email",
              "dataset": "Train",
              "intent": "Read",
              "entities": [{"category": "Sender", "offset": 5, "length": 5}],
          },
          {
              "text": "Delete last email",
              "language": "en-gb",
              "dataset": "Test",
              "intent": "Delete",
              "entities": [],
          },
      ],
  }

  client = ConversationAuthoringClient(
      clu_endpoint, AzureKeyCredential(clu_key)
  )
  poller = client.begin_import_project(
      project_name=project_name,
      project={
          "assets": exported_project_assets,
          "metadata": {
              "projectKind": "Conversation",
              "settings": {"confidenceThreshold": 0.7},
              "projectName": "EmailApp",
              "multilingual": True,
              "description": "Trying out CLU",
              "language": "en-us",
          },
          "projectFileVersion": "2022-05-01",
      },
  )
  response = poller.result()
  print(response)

  ```




  Optional keyword arguments can be passed in at the client and per-operation level. The azure-core [reference documentation][azure_core_ref_docs] describes available configurations for retries, logging, transport protocols, and more.





  The Conversations client will raise exceptions defined in [Azure Core][azure_core_exceptions].



  This library uses the standard
  [logging][python_logging] library for logging.
  Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
  level.

  Detailed DEBUG level logging, including request/response bodies and unredacted
  headers, can be enabled on a client with the `logging_enable` argument.

  See full SDK logging documentation with examples [here][sdk_logging_docs].

  ```python
  import sys
  import logging
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.language.conversations import ConversationAnalysisClient


  logger = logging.getLogger('azure')
  logger.setLevel(logging.DEBUG)


  handler = logging.StreamHandler(stream=sys.stdout)
  logger.addHandler(handler)

  endpoint = "https://<my-custom-subdomain>.cognitiveservices.azure.com/"
  credential = AzureKeyCredential("<my-api-key>")


  client = ConversationAnalysisClient(endpoint, credential, logging_enable=True)
  result = client.analyze_conversation(...)
  ```

  Similarly, `logging_enable` can enable detailed logging for a single operation, even when it isn't enabled for the client:

  ```python
  result = client.analyze_conversation(..., logging_enable=True)
  ```





  See the [Sample README][conversationallanguage_samples] for several code snippets illustrating common patterns used in the CLU Python API.



  See the [CONTRIBUTING.md][contributing] for details on building, testing, and contributing to this library.

  This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.

  <!-- LINKS -->
  [azure_cli]: https://docs.microsoft.com/cli/azure/
  [azure_portal]: https://portal.azure.com/
  [azure_subscription]: https://azure.microsoft.com/free/
  [language_resource]: https://portal.azure.com/#create/Microsoft.CognitiveServicesTextAnalytics
  [cla]: https://cla.microsoft.com
  [coc_contact]: mailto:opencode@microsoft.com
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [cognitive_auth]: https://docs.microsoft.com/azure/cognitive-services/authentication/
  [contributing]: https://github.com/Azure/azure-sdk-for-python/blob/main/CONTRIBUTING.md
  [python_logging]: https://docs.python.org/3/library/logging.html
  [sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/azure-sdk-logging
  [azure_core_ref_docs]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html
  [azure_core_readme]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [pip_link]:https://pypi.org/project/pip/
  [conversationallanguage_client_src]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations
  [conversationallanguage_pypi_package]: https://pypi.org/project/azure-ai-language-conversations/
  [api_reference_documentation]:https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-conversations/latest/azure.ai.language.conversations.html
  [conversationallanguage_refdocs]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations
  [conversationallanguage_docs]: https://docs.microsoft.com/azure/cognitive-services/language-service/conversational-language-understanding/overview
  [conversationallanguage_samples]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations/samples/README.md
  [conversationallanguage_restdocs]: https://learn.microsoft.com/rest/api/language/
  [conversationanalysisclient_class]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-conversations/latest/azure.ai.language.conversations.html#azure.ai.language.conversations.ConversationAnalysisClient
  [conversationauthoringclient_class]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-conversations/latest/azure.ai.language.conversations.html#azure.ai.language.conversations.ConversationAuthoringClient
  [azure_core_exceptions]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [azure_language_portal]: https://language.cognitive.azure.com/home
  [cognitive_authentication_aad]: https://docs.microsoft.com/azure/cognitive-services/authentication#authenticate-with-azure-active-directory
  [azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
  [custom_subdomain]: https://docs.microsoft.com/azure/cognitive-services/authentication#create-a-resource-with-a-custom-subdomain
  [install_azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#install-the-package
  [register_aad_app]: https://docs.microsoft.com/azure/cognitive-services/authentication#assign-a-role-to-a-service-principal
  [grant_role_access]: https://docs.microsoft.com/azure/cognitive-services/authentication#assign-a-role-to-a-service-principal
  [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential

  ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fsdk%2Ftemplate%2Fazure-template%2FREADME.png)







  - Added support for service version 2023-04-01.



  > Note: The following changes are only breaking from the previous beta. They are not breaking since version 1.0.0 when those types and members did not exist.

  - Removed support for service version 2022-05-15-preview.
  - Removed support for service version 2022-10-01-preview.
  - Removed support for "ConversationalPIITask" analysis with `ConversationAnalysisClient`.
  - Removed support for "ConversationalSentimentTask" with `ConversationAnalysisClient`.
  - Removed the following methods from `ConversationAuthoringClient`:
    - `begin_assign_deployment_resources`
    - `get_assign_deployment_resources_status`
    - `begin_unassign_deployment_resources`
    - `get_unassign_deployment_resources_status`
    - `begin_delete_deployment_from_resources`
    - `get_deployment_delete_from_resources_status`
    - `list_assigned_resource_deployments`
    - `list_deployment_resources`




  - Added support for the "ConversationalSentimentTask" kind with `begin_conversation_analysis`.
  - Added support for "chapterTitle" and "narrative" `summaryAspects` options for ConversationalSummarizationTasks.
  - Added methods to the `ConversationAuthoringClient` to manage deployment resources:
    - `begin_assign_deployment_resources`
    - `get_assign_deployment_resources_status`
    - `begin_unassign_deployment_resources`
    - `get_unassign_deployment_resources_status`
    - `begin_delete_deployment_from_resources`
    - `get_deployment_delete_from_resources_status`
    - `begin_load_snapshot`
    - `get_load_snapshot_status`
    - `list_assigned_resource_deployments`
    - `list_deployment_resources`
  - Added optional `trained_model_label` keyword argument to `begin_export_project`.


  * This version and all future versions will require Python 3.7+. Python 3.6 is no longer supported.




  * Added Azure Active Directory (AAD) authentication support
  * Added support for authoring operations with `ConversationAuthoringClient` under the `azure.ai.language.conversations.authoring` namespace.




  * Added Azure Active Directory (AAD) authentication support
  * Added more resolution types for entities
  * Added support for authoring operations with `ConversationAuthoringClient` under the `azure.ai.language.conversations.authoring` namespace.


  * Client now uses python dictionaries for method parameters and results instead of classes.




  * Conversation summarization task (Long-running operation)
  * Conversation PII extraction task (Long-running operation)


  * Client now uses python dictionaries for method parameters and results instead of classes.
  * Many input and result parameter name changes in `analyze_conversation()` method




  * Entity resolutions
  * Extra features


  * The `ConversationAnalysisOptions` model used as input to the `analyze_conversation` operation is now wrapped in a `CustomConversationalTask` which combines the analysis options with the project parameters into a single model.
  * The `query` within the `ConversationAnalysisOptions` is now further qualified as a `TextConversationItem` with additional properties.
  * The output `AnalyzeConversationResult` is now wrapped in a `CustomConversationalTaskResult` according to the input model.


  * Python 2.7 is no longer supported. Please use Python version 3.6 or later.




  * Initial release


pkgId: 679655f1926938c32aa152b76a4901309cfe6b9d67bdc47219a5dea1e224d9a7
name: python-azure-ai-language-questionanswering
arch: src
version: 1.1.0
epoch: 0
release: 1
summary: Microsoft Azure Question Answering Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-language-questionanswering-1.1.0-1.src.rpm
checksum_type: sha256
description:
  Question Answering is a cloud-based API service that lets you create a conversational question-and-answer layer over your existing data. Use it to build a knowledge base by extracting questions and answers from your semi-structured content, including FAQ, manuals, and documents. Answer users’ questions with the best answers from the QnAs in your knowledge base—automatically. Your knowledge base gets smarter, too, as it continually learns from users' behavior.

  [Source code][questionanswering_client_src] | [Package (PyPI)][questionanswering_pypi_package] | [API reference documentation][questionanswering_refdocs] | [Product documentation][questionanswering_docs] | [Samples][questionanswering_samples]



  _Azure SDK Python packages support for Python 2.7 ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_





  - Python 3.7 or later is required to use this package.
  - An [Azure subscription][azure_subscription]
  - A [Language Service][language_service] resource



  Install the Azure Question Answering client library for Python with [pip][pip_link]:

  ```bash
  pip install azure-ai-language-questionanswering
  ```

  > Note: this version of the client library defaults to the service API version `2021-10-01`.



  In order to interact with the Question Answering service, you'll need to create an instance of the [QuestionAnsweringClient][questionanswering_client_class] class or an instance of the [AuthoringClient][authoring_client_class] for managing projects within your resource. You will need an **endpoint**, and an **API key** to instantiate a client object. For more information regarding authenticating with Cognitive Services, see [Authenticate requests to Azure Cognitive Services][cognitive_auth].



  You can get the **endpoint** and an **API key** from the Language resource in the [Azure Portal][azure_portal].

  Alternatively, use the [Azure CLI][azure_cli] command shown below to get the API key from the Language resource.

  ```powershell
  az cognitiveservices account keys list --resource-group <resource-group-name> --name <resource-name>
  ```



  Once you've determined your **endpoint** and **API key** you can instantiate a [QuestionAnsweringClient][questionanswering_client_class]:

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.language.questionanswering import QuestionAnsweringClient

  endpoint = "https://{myaccount}.api.cognitive.microsoft.com"
  credential = AzureKeyCredential("{api-key}")

  client = QuestionAnsweringClient(endpoint, credential)
  ```


  With your endpoint and API key, you can instantiate a [AuthoringClient][authoring_client_class]:

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.language.questionanswering.authoring import AuthoringClient

  endpoint = "https://{myaccount}.api.cognitive.microsoft.com"
  credential = AzureKeyCredential("{api-key}")

  client = AuthoringClient(endpoint, credential)
  ```



  To use an [Azure Active Directory (AAD) token credential][cognitive_authentication_aad],
  provide an instance of the desired credential type obtained from the
  [azure-identity][azure_identity_credentials] library.
  Note that regional endpoints do not support AAD authentication. Create a [custom subdomain][custom_subdomain]
  name for your resource in order to use this type of authentication.

  Authentication with AAD requires some initial setup:

  - [Install azure-identity][install_azure_identity]
  - [Register a new AAD application][register_aad_app]
  - [Grant access][grant_role_access] to the Language service by assigning the "Cognitive Services Language Reader" role to your service principal.

  After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use.
  As an example, [DefaultAzureCredential][default_azure_credential]
  can be used to authenticate the client:

  Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
  `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`

  Use the returned token credential to authenticate the client:

  ```python
  from azure.ai.language.questionanswering import QuestionAnsweringClient
  from azure.identity import DefaultAzureCredential

  credential = DefaultAzureCredential()
  client = QuestionAnsweringClient(endpoint="https://<my-custom-subdomain>.cognitiveservices.azure.com/", credential=credential)
  ```





  The [QuestionAnsweringClient][questionanswering_client_class] is the primary interface for asking questions using a knowledge base with your own information, or text input using pre-trained models.
  For asynchronous operations, an async `QuestionAnsweringClient` is in the `azure.ai.language.questionanswering.aio` namespace.


  The [AuthoringClient][authoring_client_class] provides an interface for managing Question Answering projects. Examples of the available operations include creating and deploying projects, updating your knowledge sources, and updating question and answer pairs. It provides both synchronous and asynchronous APIs.




  The `azure-ai-language-questionanswering` client library provides both synchronous and asynchronous APIs.

  - [Ask a question](#ask-a-question "Ask a question")
  - [Ask a follow-up question](#ask-a-follow-up-question "Ask a follow-up question")
  - [Create a new project](#create-a-new-project "Create a new project")
  - [Add a knowledge source](#add-a-knowledge-source "Add a knowledge source")
  - [Deploy your project](#deploy-your-project "Deploy your project")
  - [Asynchronous operations](#asynchronous-operations "Asynchronous operations")



  The only input required to ask a question using a knowledge base is just the question itself:

  ```python
  import os
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.language.questionanswering import QuestionAnsweringClient

  endpoint = os.environ["AZURE_QUESTIONANSWERING_ENDPOINT"]
  key = os.environ["AZURE_QUESTIONANSWERING_KEY"]

  client = QuestionAnsweringClient(endpoint, AzureKeyCredential(key))

  output = client.get_answers(
      question="How long should my Surface battery last?",
      project_name="FAQ",
      deployment_name="test"
  )
  for candidate in output.answers:
      print("({}) {}".format(candidate.confidence, candidate.answer))
      print("Source: {}".format(candidate.source))

  ```

  You can set additional keyword options to limit the number of answers, specify a minimum confidence score, and more.



  If your knowledge base is configured for [chit-chat][questionanswering_docs_chat], the answers from the knowledge base may include suggested [prompts for follow-up questions][questionanswering_refdocs_prompts] to initiate a conversation. You can ask a follow-up question by providing the ID of your chosen answer as the context for the continued conversation:

  ```python
  import os
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.language.questionanswering import QuestionAnsweringClient
  from azure.ai.language.questionanswering import models

  endpoint = os.environ["AZURE_QUESTIONANSWERING_ENDPOINT"]
  key = os.environ["AZURE_QUESTIONANSWERING_KEY"]

  client = QuestionAnsweringClient(endpoint, AzureKeyCredential(key))

  output = client.get_answers(
      question="How long should charging take?",
      answer_context=models.KnowledgeBaseAnswerContext(
          previous_qna_id=previous_answer.qna_id
      ),
      project_name="FAQ",
      deployment_name="live"
  )
  for candidate in output.answers:
      print("({}) {}".format(candidate.confidence, candidate.answer))
      print("Source: {}".format(candidate.source))
  ```



  ```python
  import os
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.language.questionanswering.authoring import AuthoringClient


  endpoint = os.environ["AZURE_QUESTIONANSWERING_ENDPOINT"]
  key = os.environ["AZURE_QUESTIONANSWERING_KEY"]


  client = AuthoringClient(endpoint, AzureKeyCredential(key))
  with client:

      
      project_name = "IssacNewton"
      project = client.create_project(
          project_name=project_name,
          options={
              "description": "biography of Sir Issac Newton",
              "language": "en",
              "multilingualResource": True,
              "settings": {
                  "defaultAnswer": "no answer"
              }
          })

      print("view created project info:")
      print("\tname: {}".format(project["projectName"]))
      print("\tlanguage: {}".format(project["language"]))
      print("\tdescription: {}".format(project["description"]))
  ```



  ```python
  import os
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.language.questionanswering.authoring import AuthoringClient


  endpoint = os.environ["AZURE_QUESTIONANSWERING_ENDPOINT"]
  key = os.environ["AZURE_QUESTIONANSWERING_KEY"]


  client = AuthoringClient(endpoint, AzureKeyCredential(key))

  project_name = "IssacNewton"
  update_sources_poller = client.begin_update_sources(
      project_name=project_name,
      sources=[
          {
              "op": "add",
              "value": {
                  "displayName": "Issac Newton Bio",
                  "sourceUri": "https://wikipedia.org/wiki/Isaac_Newton",
                  "sourceKind": "url"
              }
          }
      ]
  )
  update_sources_poller.result()


  print("list project sources")
  sources = client.list_sources(
      project_name=project_name
  )
  for source in sources:
      print("project: {}".format(source["displayName"]))
      print("\tsource: {}".format(source["source"]))
      print("\tsource Uri: {}".format(source["sourceUri"]))
      print("\tsource kind: {}".format(source["sourceKind"]))
  ```




  ```python
  import os
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.language.questionanswering.authoring import AuthoringClient


  endpoint = os.environ["AZURE_QUESTIONANSWERING_ENDPOINT"]
  key = os.environ["AZURE_QUESTIONANSWERING_KEY"]


  client = AuthoringClient(endpoint, AzureKeyCredential(key))

  project_name = "IssacNewton"


  deployment_poller = client.begin_deploy_project(
      project_name=project_name,
      deployment_name="production"
  )
  deployment_poller.result()


  deployments = client.list_deployments(
      project_name=project_name
  )

  print("view project deployments")
  for d in deployments:
      print(d)
  ```



  The above examples can also be run asynchronously using the clients in the `aio` namespace:

  ```python
  import os
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.language.questionanswering.aio import QuestionAnsweringClient

  endpoint = os.environ["AZURE_QUESTIONANSWERING_ENDPOINT"]
  key = os.environ["AZURE_QUESTIONANSWERING_KEY"]

  client = QuestionAnsweringClient(endpoint, AzureKeyCredential(key))

  output = await client.get_answers(
      question="How long should my Surface battery last?",
      project_name="FAQ",
      deployment_name="production"
  )
  ```



  Optional keyword arguments can be passed in at the client and per-operation level. The azure-core [reference documentation][azure_core_ref_docs] describes available configurations for retries, logging, transport protocols, and more.





  Azure Question Answering clients raise exceptions defined in [Azure Core][azure_core_readme].
  When you interact with the Cognitive Language Service Question Answering client library using the Python SDK, errors returned by the service correspond to the same HTTP status codes returned for [REST API][questionanswering_rest_docs] requests.

  For example, if you submit a question to a non-existent knowledge base, a `400` error is returned indicating "Bad Request".

  ```python
  from azure.core.exceptions import HttpResponseError

  try:
      client.get_answers(
          question="Why?",
          project_name="invalid-knowledge-base",
          deployment_name="test"
      )
  except HttpResponseError as error:
      print("Query failed: {}".format(error.message))
  ```



  This library uses the standard
  [logging][python_logging] library for logging.
  Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
  level.

  Detailed DEBUG level logging, including request/response bodies and unredacted
  headers, can be enabled on a client with the `logging_enable` argument.

  See full SDK logging documentation with examples [here][sdk_logging_docs].



  - View our [samples][questionanswering_samples].
  - Read about the different [features][questionanswering_docs_features] of the Question Answering service.
  - Try our service [demos][questionanswering_docs_demos].



  See the [CONTRIBUTING.md][contributing] for details on building, testing, and contributing to this library.

  This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.

  <!-- LINKS -->

  [azure_cli]: https://docs.microsoft.com/cli/azure/
  [azure_portal]: https://portal.azure.com/
  [azure_subscription]: https://azure.microsoft.com/free/
  [language_service]: https://ms.portal.azure.com/#create/Microsoft.CognitiveServicesTextAnalytics
  [cla]: https://cla.microsoft.com
  [coc_contact]: mailto:opencode@microsoft.com
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [cognitive_auth]: https://docs.microsoft.com/azure/cognitive-services/authentication/
  [contributing]: https://github.com/Azure/azure-sdk-for-python/blob/main/CONTRIBUTING.md
  [python_logging]: https://docs.python.org/3/library/logging.html
  [sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/azure-sdk-logging
  [azure_core_ref_docs]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html
  [azure_core_readme]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [pip_link]: https://pypi.org/project/pip/
  [questionanswering_client_class]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/latest/azure.ai.language.questionanswering.html#azure.ai.language.questionanswering.QuestionAnsweringClient
  [authoring_client_class]: https://aka.ms/azsdk/python/questionansweringauthoringclient
  [questionanswering_refdocs_prompts]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/latest/azure.ai.language.questionanswering.models.html#azure.ai.language.questionanswering.models.KnowledgeBaseAnswerDialog
  [questionanswering_client_src]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-questionanswering/
  [questionanswering_docs]: https://azure.microsoft.com/services/cognitive-services/qna-maker/
  [questionanswering_docs_chat]: https://docs.microsoft.com/azure/cognitive-services/qnamaker/how-to/chit-chat-knowledge-base
  [questionanswering_docs_demos]: https://azure.microsoft.com/services/cognitive-services/qna-maker/#demo
  [questionanswering_docs_features]: https://azure.microsoft.com/services/cognitive-services/qna-maker/#features
  [questionanswering_pypi_package]: https://pypi.org/project/azure-ai-language-questionanswering/
  [questionanswering_refdocs]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/latest/azure.ai.language.questionanswering.html
  [questionanswering_rest_docs]: https://learn.microsoft.com/rest/api/cognitiveservices/questionanswering/question-answering
  [questionanswering_samples]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/README.md
  [cognitive_authentication_aad]: https://docs.microsoft.com/azure/cognitive-services/authentication#authenticate-with-azure-active-directory
  [azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
  [custom_subdomain]: https://docs.microsoft.com/azure/cognitive-services/authentication#create-a-resource-with-a-custom-subdomain
  [install_azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#install-the-package
  [register_aad_app]: https://docs.microsoft.com/azure/cognitive-services/authentication#assign-a-role-to-a-service-principal
  [grant_role_access]: https://docs.microsoft.com/azure/cognitive-services/authentication#assign-a-role-to-a-service-principal
  [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential

  ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fsdk%2Ftemplate%2Fazure-template%2FREADME.png)


pkgId: bacdde08e90ff2b88f0f68e3655642cb28b1f205a53f9e4d468d66142728248e
name: python-azure-ai-metricsadvisor
arch: src
version: 1.0.1
epoch: 0
release: 1
summary: Microsoft Azure Metrics Advisor Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-metricsadvisor-1.0.1-1.src.rpm
checksum_type: sha256
description:
  This package is no longer being maintained, as the service has been retired. There is no replacement package for this package.






  - This package is no longer being maintained, as the service has been retired. There is no replacement package for this package.





  - Changed
    - `DetectionConditionsOperator` -> `DetectionConditionOperator`
    - `cross_conditions_operator` -> `condition_operator`
    - `AnomalyAlert.created_on` -> `AnomalyAlert.created_time`
    - `AnomalyAlert.modified_on` -> `AnomalyAlert.modified_time`
    - `Anomaly.created_on` -> `Anomaly.created_time`
    - `admin_emails` has been renamed to `admins` in `NotificationHook`
    - `admin_emails` has been renamed to `admins` in `DataFeedOptions`
    - `viewer_emails` has been renamed to `viewers` in `DataFeedOptions`



  **New Features**

  - Added `AzureLogAnalyticsDataFeedSource` and `AzureEventHubsDataFeedSource`
  - Update method now returns the updated object
  - Added DatasourceCredentials and DatasourceCredential operations
  - Added authentication type support for data feed

  **Breaking Changes**

  - Delete methods now take positional only argument as id
  - `update_subscription_key` and `update_api_key` are merged into one method `update_key`
  - Removed `DataFeedOptions` and moved all its properties to the `DataFeed` model

  - Deprecated:
    - `HttpRequestDataFeed`
    - `ElasticsearchDataFeed`

  - Renamed
    - `AzureApplicationInsightsDataFeed` -> `AzureApplicationInsightsDataFeedSource`
    - `AzureBlobDataFeed` -> `AzureBlobDataFeedSource`
    - `AzureCosmosDBDataFeed` -> `AzureCosmosDbDataFeedSource`
    - `AzureDataExplorerDataFeed` -> `AzureDataExplorerDataFeedSource`
    - `AzureTableDataFeed` -> `AzureTableDataFeedSource`
    - `InfluxDBDataFeed` -> `InfluxDbDataFeedSource`
    - `MySqlDataFeed` -> `MySqlDataFeedSource`
    - `PostgreSqlDataFeed` -> `PostgreSqlDataFeedSource`
    - `SQLServerDataFeed` -> `SqlServerDataFeedSource`
    - `MongoDBDataFeed` -> `MongoDbDataFeedSource`
    - `AzureDataLakeStorageGen2DataFeed` -> `AzureDataLakeStorageGen2DataFeedSource`

  **Dependency Updates**

  - Bump `msrest` requirement from `0.6.12` to `0.6.21`



  **New Features**

  - AAD support authentication    #15922
  - `MetricsAdvisorKeyCredential` support for rotating the subscription and api keys to update long-lived clients

  **Breaking Changes**

  - `list_dimension_values` has been renamed to `list_anomaly_dimension_values`
  - update methods now return None
  - Updated DataFeed.metric_ids to be a dict rather than a list

  **Hotfixes**

  - Bump `six` requirement from `1.6` to 1.11.0`



  **Breaking Changes**

  - `create_hook` now takes as input an `EmailHook` or `WebHook`
  - `Anomaly` has been renamed to `DataPointAnomaly`
  - `Incident` has been renamed to `AnomalyIncident`
  - `IncidentPropertyIncidentStatus` has been renamed to `AnomalyIncidentStatus`
  - `Alert` has been renamed to `AnomalyAlert`
  - `Severity` has been renamed to `AnomalySeverity`
  - `Metric` has been renamed to `DataFeedMetric`
  - `Dimension` has been renamed to `DataFeedDimension`
  - `EmailHook` has been renamed to `EmailNotificationHook`
  - `WebHook` has been renamed to `WebNotificationHook`
  - `Hook` has been renamed to `NotificationHook`
  - `TimeMode` has been renamed to `AlertQueryTimeMode`
  - `admins` has been renamed to `admin_emails` on `NotificationHook`
  - `admins` has been renamed to `admin_emails` on `DataFeedOptions`
  - `viewers` has been renamed to `viewer_emails` on `DataFeedOptions`
  - `timestamp_list` has been renamed to `timestamps` on `MetricSeriesData`
  - `value_list` has been renamed to `values` on `MetricSeriesData`
  - `SeriesResult` has been renamed to `MetricEnrichedSeriesData`
  - `create_anomaly_alert_configuration` has been renamed to `create_alert_configuration`
  - `get_anomaly_alert_configuration` has been renamed to `get_alert_configuration`
  - `delete_anomaly_alert_configuration` has been renamed to `delete_alert_configuration`
  - `update_anomaly_alert_configuration` has been renamed to `update_alert_configuration`
  - `list_anomaly_alert_configurations` has been renamed to `list_alert_configurations`
  - `create_metric_anomaly_detection_configuration` has been renamed to `create_detection_configuration`
  - `get_metric_anomaly_detection_configuration` has been renamed to `get_detection_configuration`
  - `delete_metric_anomaly_detection_configuration` has been renamed to `delete_detection_configuration`
  - `update_metric_anomaly_detection_configuration` has been renamed to `update_detection_configuration`
  - `list_metric_anomaly_detection_configurations` has been renamed to `list_detection_configurations`
  - `list_feedbacks` has been renamed to `list_feedback`
  - `list_alerts_for_alert_configuration` has been renamed to `list_alerts`
  - `list_anomalies_for_alert` & `list_anomalies_for_detection_configuration` have been grouped into `list_anomalies`
  - `list_dimension_values_for_detection_configuration` has been renamed to `list_dimension_values`
  - `list_incidents_for_alert` & `list_incidents_for_detection_configuration` have been grouped into `list_incidents`

  **New Features**

  - `__repr__` added to all models



  First preview release


pkgId: 97264ca922d00727df36f441be5c078be7f931a853df33ae7a63f98675ca1b23
name: python-azure-ai-ml
arch: src
version: 1.20.0
epoch: 0
release: 1
summary: Microsoft Azure Machine Learning Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-ml-1.20.0-1.src.rpm
checksum_type: sha256
description:
  We are excited to introduce the GA of Azure Machine Learning Python SDK v2. The Python SDK v2 introduces new SDK capabilities like standalone local jobs, reusable components for pipelines and managed online/batch inferencing. Python SDK v2 allows you to move from simple to complex tasks easily and incrementally. This is enabled by using a common object model which brings concept reuse and consistency of actions across various tasks. The SDK v2 shares its foundation with the CLI v2 which is also GA.

  [Source code][source_code]
  | [Package (PyPI)][ml_pypi]
  | [Package (Conda)][ml_conda]
  | [API reference documentation][ml_ref_docs]
  | [Product documentation][product_documentation]
  | [Samples][ml_samples]


  This package has been tested with Python 3.8, 3.9, 3.10, 3.11 and 3.12.

  For a more complete set of Azure libraries, see https://aka.ms/azsdk/python/all





  - Python 3.7 or later is required to use this package.
  - You must have an [Azure subscription][azure_subscription].
  - An [Azure Machine Learning Workspace][workspace].



  Install the Azure ML client library for Python with [pip][pip_link]:

  ```bash
  pip install azure-ai-ml
  pip install azure-identity
  ```



  ```python
  from azure.ai.ml import MLClient
  from azure.identity import DefaultAzureCredential

  ml_client = MLClient(
      DefaultAzureCredential(), subscription_id, resource_group, workspace
  )
  ```



  Azure Machine Learning Python SDK v2 comes with many new features like standalone local jobs, reusable components for pipelines and managed online/batch inferencing. The SDK v2 brings consistency and ease of use across all assets of the platform. The Python SDK v2 offers the following capabilities:
  * Run **Standalone Jobs** - run a discrete ML activity as Job. This job can be run locally or on the cloud. We currently support the following types of jobs:
    * Command - run a command (Python, R, Windows Command, Linux Shell etc.)
    * Sweep - run a hyperparameter sweep on your Command
  * Run multiple jobs using our **improved Pipelines**
    * Run a series of commands stitched into a pipeline (**New**)
    * **Components** - run pipelines using reusable components (**New**)
  * Use your models for **Managed Online inferencing** (**New**)
  * Use your models for Managed **batch inferencing**
  * Manage AML resources – workspace, compute, datastores
  * Manage AML assets - Datasets, environments, models
  * **AutoML** - run standalone AutoML training for various ml-tasks:
    - Classification (Tabular data)
    - Regression (Tabular data)
    - Time Series Forecasting (Tabular data)
    - Image Classification (Multi-class) (**New**)
    - Image Classification (Multi-label) (**New**)
    - Image Object Detection (**New**)
    - Image Instance Segmentation (**New**)
    - NLP Text Classification (Multi-class) (**New**)
    - NLP Text Classification (Multi-label) (**New**)
    - NLP Text Named Entity Recognition (NER) (**New**)



  - View our [samples][ml_samples].





  Azure ML clients raise exceptions defined in [Azure Core][azure_core_readme].

  ```python
  from azure.core.exceptions import HttpResponseError

  try:
      ml_client.compute.get("cpu-cluster")
  except HttpResponseError as error:
      print("Request failed: {}".format(error.message))
  ```



  This library uses the standard
  [logging][python_logging] library for logging.
  Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
  level.

  Detailed DEBUG level logging, including request/response bodies and unredacted
  headers, can be enabled on a client with the `logging_enable` argument.

  See full SDK logging documentation with examples [here][sdk_logging_docs].



  The Azure ML Python SDK includes a telemetry feature that collects usage and failure data about the SDK and sends it to Microsoft when you use the SDK in a Jupyter Notebook only.
  <u>Telemetry will **not** be collected for any use of the Python SDK outside of a Jupyter Notebook.</u>

  Telemetry data helps the SDK team understand how the SDK is used so it can be improved and the information about failures helps the team resolve problems and fix bugs.
  The SDK telemetry feature is enabled by default for Jupyter Notebook usage and cannot be enabled for non-Jupyter scenarios. To opt out of the telemetry feature in a Jupyter scenario, pass in `enable_telemetry=False` when constructing your MLClient object.



  - View our [samples][ml_samples].



  This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.

  <!-- LINKS -->

  [source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ml/azure-ai-ml
  [ml_pypi]: https://pypi.org/project/azure-ai-ml/
  [ml_conda]: https://anaconda.org/microsoft/azure-ai-ml/
  [ml_ref_docs]: https://learn.microsoft.com/python/api/azure-ai-ml/?view=azure-python
  [ml_samples]: https://github.com/Azure/azureml-examples/tree/main/sdk/python
  [product_documentation]: https://docs.microsoft.com/azure/machine-learning/
  [azure_subscription]: https://azure.microsoft.com/free/
  [workspace]: https://docs.microsoft.com/azure/machine-learning/concept-workspace
  [python_logging]: https://docs.python.org/3/library/logging.html
  [sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/azure-sdk-logging
  [azure_core_readme]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [pip_link]: https://pypi.org/project/pip/
  [azure_core_ref_docs]: https://aka.ms/azsdk-python-core-policies
  [azure_core]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity
  [cla]: https://cla.microsoft.com
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
  [coc_contact]: mailto:opencode@microsoft.com







    - When a workspace is created with `managed_network` enabled or has `public_network_access` set to disabled, the resources created with the workspace (Key Vault, Storage Account) will be set to have restricted network access settings. This is only applicable when the user does not specify existing resources.
    - Added support of `fqdns` property for managed network `PrivateEndpointDestination` outbound rule objects. Enabling the support of Application Gateway as a Private Endpoint target in the workspace managed network.
    - Added support of `address_prefixes` property for managed network `ServiceTagDestination` outbound rule objects.
    - Removed experimental tag from `managed_network` which is a GA feature.





    - Added enable_sso operation under compute operation that will allow user to enable sso setting of a compute instance without any write permission set on compute.


  - Workspace update no longer broken for older workspaces due to deprecated tags.
  - Support credential-less fileshare datastore





   - Expose `public_ip_address` in `AmlComputeNodeInfo`, to get the public ip address with the ssh port when calling `ml_client.compute.list_nodes`
   - Uploads to account key access datastores will be authorized via a SAS token retrieved from a call to `DatastoreOperations._list_secrets`. Key-based authentication for uploads for such datastores is no longer used. Identity-based datastores will use user identity authentication retrieved from the MLClient.
  - Support `update_sso_settings` in `ComputeOperations`, to enable or disable single sign-on settings of a compute instance.


  - InputTypes exported in constants module
  - WorkspaceConnection tags are now listed as deprecated, and the erroneously-deprecated metadata field has been un-deprecated and added as a initialization field. These two fields still point to the same underlying object property, and actual API usage of this value is unchanged.
  - Workspace Create operation works without an application insights being provided, and creates a default appIn resource for normal workspaces in that case.
  - Project create operations works in general.



  - WorkspaceConnections are officially GA'd and no longer experimental. But its much newer subclasses remain experimental.




  - Workspace Create operation works without an application insights being provided, and creates a default appIn resource for normal workspaces in that case.
  - Project create operations works in general.






  - Add experimental support for working with Promptflow evaluators: `ml_client.evaluators`.
  - Many changes to the Connection entity class and its associated operations.
  - Workspace Connection `list`, `get`, and `create_or_update` operations now include an optional `populate_secrets` input, which causes the operations to try making a secondary call to fill in the returned connections' credential info if possible. Only works with api key-based credentials for now.
  - Many workspace connection subtypes added. The full list of subclasses is now:
    - `AzureBlobStoreConnection`
    - `AzureBlobStoreConnection`
    - `MicrosoftOneLakeConnection`
    - `AzureOpenAIConnection`
    - `AzureAIServicesConnection`
    - `AzureAISearchConnection`
    - `AzureContentSafetyConnection`
    - `AzureSpeechServicesConnection`
    - `APIKeyConnection`
    - `OpenAIConnection`
    - `SerpConnection`
    - `ServerlessConnection`
  - Many workspace connections only accept api keys or entra ids for credentials. Since Entra IDs require not inputs, these have been refactored to not required a full credential object. Instead they only accept an api_key as a top-level input, and default to an entra credential otherwise. Their YAML schemas have been similarly altered.
  - Client-side credential-type validation added for some workspace connection types.
  - Added new credential type: `AadCredentialConfiguration`
  - Renamed WorkspaceHub class as Hub.
  - Added Project entity class and YAML support.
  - Project and Hub operations supported by workspace operations.
  - workspace list operation supports type filtering.
  - Add support for Microsoft Entra token (`aad_token`) auth in `invoke` and `get-credentials` operations.
  - Add experimental support for working with indexes: `ml_client.indexes`





  - Removed WorkspaceHubConfig entity, and renamed WorkspaceHub to Hub.
  - workspace_hub input of Workspace class hidden, renamed to hub_id, and re-surfaced in child class Project.
  - Removed Workspace Hub Operations from ML Client.







  - The following classes will still be able to be imported from `azure.ai.ml`, but the import is deprecated and emits a warning. Instead, please import them from `azure.ai.ml.entities`.
    - `AmlTokenConfiguration`
    - `ManagedIdentityConfiguration`
    - `UserIdentityConfiguration`
  - The following classes will still be able to be imported from `azure.ai.ml.entities`, but the import is deprecated and emits a warning. Instead, please import them from `azure.ai.ml.sweep`.
    - `Choice`
    - `Uniform`
    - `LogUniform`
    - `QLogUniform`
    - `QUniform`
    - `QLogNormal`
    - `QNormal`
    - `LogNormal`
    - `Normal`
    - `Randint`




  - Remove `experimental` tag for  `ml_client.jobs.validate`.
  - Workspace Connection has new read-only subclass: AzureBlobStoreWorkspaceConnectionSchema.
  - Workspace Connection supports 2 new types under main class: gen 2 and azure_one_lake.
  - Workspace Connection LIST operation can return data connections via new optional flag: include_data_connections.
  - Support `ml_client.schedules.trigger(name='my_schedule')` function to trigger a schedule once.


  - Fix pipeline job `outputs` not load correctly when `component: <local-file>` exists in pipeline job yaml.
  - Workspace ListKey operation serialization issue fixed.
  - Workspace Diagnose result now can be print in to Json format.





  - Support for Python 3.12














  - Workspace Connections had 3 child classes added for open AI, cog search, and cog service connections.
  - Workspace Connections replaced metadata with tags, and surfaced api_version, api_type, and kind for certain connection types.



  - Workspace Hubs now properly create various endpoints, and surface a variable to select the resource they connect to via the
    'endpoint_resource_id' kwarg.








   - pydash dependency version was upgraded to >=6.0.0 to patch [security vulnerability in versions below 6.0.0](https://github.com/advisories/GHSA-8mjr-6c96-39w8)
   - Workspace hub deletion no longer fails if delete_dependent_resources is true.




  - Now, when you specify `delete_dependent_resources` as True when deleting a workspace, the log analytics resource
    associated with the workspace application insights resource will also be deleted.
  - Now, when creating or updating a workspace, you can provide a `serverless_compute` configuration object. This allows configuring a custom subnet in which all Serverless computes will be created. You can also specify whether or not these Serverless computes will have public IP addresses or not.


   - [Python 3.7 reached end-of-life on June 27th 2023](https://devguide.python.org/versions/). Consequently, 3.7 will be deprecated in azure-ai-ml starting in October 2023 and azure-ai-ml will end support for 3.7 in February 2024.




  - Feature sets can now be registers after being dumped and reloaded.
  - SDK feature store create/update can now assign materialization identities to cross RG offline stores and online stores.




  - Added support of features that are known into the future/at forecast time for dnn in AutoML Forecasting jobs.
  - Added support for new workspace connection types: azure_open_ai, cognitive_search, and cognitive_service.
  - Added support for new credential type: ApiKeyConfiguration.
  - Added support of `download` for component operations.


  - Local job runs will no longer fail if Docker registry has no username/password
  - Fixed an issue that code asset doesn't work with relative symbol links.
  - Fixed [Issue 31319](https://github.com/Azure/azure-sdk-for-python/issues/31319): can't accept `PathLike` for `CommandComponent.code`.



  - `azure-ai-ml` now performs all file i/o on `utf-8` encoded files per Azure SDK guidance.
    (instead of the default behavior for python < 3.15, which uses locale specific encodings)
  - Removed references to deprecated "feature_store" workspace connection type.




  - Added support to enable gpu access (local_enable_gpu) for local deployment.



  - Improved the output when printing a workspace object to be more clean and readable.
  - Log level of unknown field notifications for pipeline nodes raised from INFO to WARNING.



  - Added support to enable set workspace connection secret expiry time.
  - Added support for `stage` on model version



  - Fixed an issue affecting authentication to registry-related services in sovereign regions.
  - Made job_tier and priority values case insensitive




  - Public preview support for new schedule type `MonitorSchedule`





  - Fixed an issue where `OnlineDeployment.provisioning_state` was incorrectly deserialized and set as `None`





  - Added data import schedule. The class added is `ImportDataSchedule`.
  - Added support to enable data isolation feature at workspace creation stage.
  - Added auto_delete_setting support for asset version in data import job.
  - Switched code snapshot upload from directory-based to container-based design in order to allow finer RBAC within workspaces. A container will be created for each new snapshot. This change does not affect storage costs or snapshot functionality.











  - Added experimental scatter gather node to DSL package. This node has a unique mldesigner dependency.
  - Added support to make JobService and ServiceInstance objects serializable when printed
  - Support Singularity compute in pipeline job
  - Added purge operation support for workspace resource
  - Added Feature Store, its dedicated classes and updated the docstrings, now available in public interface. The classes added are `FeatureStoreOperations, FeatureSetOperations, FeatureStoreEntityOperations` with properties classes specific to the new features.
  - Support additional_includes in command component
  - Added experimental `distribution: ray` support in command job.



  - Fixed issue where show_progress=False was not being respected for uploads when set via MLClient
  - Fixed issue of spark input/output mode validation doesn't take effect because of wrong type assertion
  - Fixed the bug when setting `node.limits.timeout` to a pipeline input.
  - Removed Experimental Tag from Idle Shutdown, Custom Applications, Setup Scripts, and Image Metadata on Compute Instances.
  - Removed Experimental Tag from JobService classes



  - Renamed `JobServiceBase.job_service_type` to `type`



  - Remove the default placeholder for CommandComponent.code




  - Added support for `tags` on Compute Resources.
  - Added support for promoting data asset from a workspace to a registry
  - Added support for registering named asset from job output or node output by specifying name and version settings.
  - Added support for data binding on outputs inside dynamic arguments for dsl pipeline
  - Added support for serverless compute in pipeline, command, automl and sweep job
  - Added support for `job_tier` and `priority` in standalone job
  - Added support for passing `locations` via command function and set it to `JobResourceConfiguration.locations`
  - Added support for modifying SSH key values after creation on Compute Resources.
  - Added WorkspaceConnection types `s3`, `snowflake`, `azure_sql_db`, `azure_synapse_analytics`, `azure_my_sql_db`, `azure_postgres_db`
  - Added WorkspaceConnection auth type `access_key` for `s3`
  - Added DataImport class and DataOperations.import_data.
  - Added DataOperations.list_materialization_status - list status of data import jobs that create asset versions via asset name.



  - Fix experiment name wrongly set to 'Default' when schedule existing job.
  - Error message improvement when a local path fails to match with data asset type.
  - Error message improvement when an asset does not exist in a registry
  - Fix an issue when submit spark pipeline job with referring a registered component
  - Fix an issue that prevented Job.download from downloading the output of a BatchJob



  - Added dependency on `azure-mgmt-resource`
  - Added dependency on `azure-mgmt-resourcegraph`
  - Added dependency on `opencensus-ext-azure<2.0.0`
  - Update job types to use MFE Dec preview rest objects.
  - Added classifiers for Python version 3.11.
  - Added warning for reserved keywords in IO names in pipeline job nodes.
  - Added telemetry logging for SDK Jupyter Notebook scenarios with opt-out option (see README.md)




  - Added dedicated classes for each type of job service and updated the docstrings. The classes added are `JupyterLabJobService, SshJobService, TensorBoardJobService, VsCodeJobService` with a few properties specific to the type.
  - Added Custom Applications Support to Compute Instances.
  - Update data asset list, show and create operations to support data assets in registry.
  - Added Managed Network features to workspace to include `ManagedNetwork`, `FqdnDestination`, `PrivateEndpointDestination`, `ServiceTagDestination` as well as relevant schema.


  - Fixed an issue where the ordering of `.amlignore` and `.gitignore` files are not respected.
  - Fixed an issue that attributes with a value of `False` in `PipelineJobSettings` are not respected.
  - Fixed an issue where ignore files weren't considered during upload directory size calculations.
  - Fixed an issue where symlinks crashed upload directory size calculations.
  - Fixes a bug where enable_node_public_ip returned an improper value when fetching a Compute.


  - Update workspace creation to use Log Analytics-Based Application Insights when the user does not specify/bring their own App Insights.
  - Upgraded minimum azure-core version to 1.23.0.




  - Change print behavior of entity classes to show object yaml in notebooks, can be configured on in other contexts.
  - Added property to enable/disable public ip addresses to Compute Instances and AML Computes.
  - `Deployment` and `ScheduleOperations` added to public interface.


  - Fixed issue with date-time format for utc_time_created field when creating models.
  - Added stricter behavior for ArmStr schemas when parsing 'azureml:' prefix.
  - Fixed issue where AmlComputes could only be created in a workspace's default region.
  - Improved intellisense with VS Code for fields supporting local paths and datastores.
  - Added validation for token generation with aml scope when user_identity is used in job definition aka OBO flow.
  - Fixed duplicate node name error in pipeline when two node names assigned to the same node and get renamed by node.name='xx'.
  - Resolve the cross references for MLClient, Resource and OnlineDeployment.
  - Explicit use of Optional (or a Union with None), as per PEP 484.
  - Fixed print on Command objects when job id is empty
  - Fixed issue where `SasTokenConfiguration` cannot be used as credential for `WorkspaceConnection`


  - Removed dependency on API version 2021-10-01 and 2022-06-01-preview to reduce side of azure-ai-ml package.




  - Removed description from Registry.
  - Disable sdk telemetry logging


  - Enable updating the CMK encryption key (workspace.encryption.keyVaultProperties.keyIdentifier) for a workspace.
  - Mark JobService class and services param to command() as experimental.
  - Added a replication_count value to the schema of SystemCreatedStorageAccount in Registry.
  - Added support for Fairfax and MoonCake cloud for the registry discovery baseurl.
  - Added support for variable args as pipeline input in DSL Pipeline.
  - Added OS Patching Parameters to Compute Instance.


  - Update the upper bound dependencies version for tqdm, strictyaml, colorama and opencensus-ext-azure.
  - Added missing "properties" to batch deployment.
  - Retain the cases for the names of system job services (Tracking and Studio).
  - Update registry begin_delete method return type.
  - Fixed sweep job optional input cannot be empty.
  - Fixed bool test for output in download operation.
  - Fixed Compute Instance schedule not being created
  - Removed erroneous experimental warning from Compute Schedules




  - Restored idle_time_before_shutdown property for Compute Instances.
  - Deprecated idle_time_before_shutdown property in favor of idle_time_before_shutdown_minutes.


  - Fixed idle_time_before_shutdown appearing as None for Compute Instances returned by `show` or `list`.
  - Fixed idle_time_before_shutdown_minutes preventing creation of Compute Instances when set to None.




  - Renamed idle_time_before_shutdown to idle_time_before_shutdown_minutes and changed input type to int.


  - Fixed idle_time_before_shutdown_minutes not appearing in GET calls for Compute Instances.




  - Registry list operation now accepts scope value to allow subscription-only based requests.
  - Most configuration classes from the entity package now implement the standard mapping protocol.
  - Add registry delete operation.
  - The values of JobService.job_service_type are now using the snake case. e.g jupyter_lab, ssh, tensor_board, vs_code.
  - Command function now accepts services param of type Dict[str, JobService] instead of dict.


  - MLClient.from_config can now find the default config.json on Compute Instance when running sample notebooks.
  - Fixed job inputs not accepting datastores or job inputs.
  - Registries now assign managed tags to match registry's tags.
  - Adjust registry experimental tags and imports to avoid warning printouts for unrelated operations.
  - Make registry delete operation return an LROPoller, and change name to begin_delete.
  - Prevent registering an already existing environment that references conda file.
  - Fix ARM ID logic for registry environments (ex: Creating a registry component that references a registry environment).
  - Fix ARM ID logic for passing models and environments with ID (ex: Creating endpoint deployment for a registry model should return said model's ID immediately)


  - Switched compute operations to go through 2022-10-01-preview API version.


  - GA release
  - Dropped support for Python 3.6. The Python versions supported for this release are 3.7-3.10.




  - OnlineDeploymentOperations.delete has been renamed to begin_delete.
  - Datastore credentials are switched to use unified credential configuration classes.
  - UserAssignedIdentity is replaced by ManagedIdentityConfiguration
  - Endpoint and Job use unified identity classes.
  - Workspace ManagedServiceIdentity has been replaced by IdentityConfiguration.



   - Switched Compute operations to use Oct preview API version.
   - Updated batch deployment/endpoint invoke and list-jobs function signatures with curated BatchJob class.




   - Support passing JobService as argument to Command()
   - Added support for custom setup scripts on compute instances.
   - Added a `show_progress` parameter to MLClient for enable/disable progress bars of long running operations.
   - Support `month_days` in `RecurrencePattern` when using `RecurrenceSchedule`.
   - Support `ml_client.schedules.list` with `list_view_type`, default to `ENABLED_ONLY`.
   - Add support for model sweeping and hyperparameter tuning in AutoML NLP jobs.
   - Added `ml_client.jobs.show_services()` operation.


  - ComputeOperations.attach has been renamed to begin_attach.
  - Deprecated parameter path has been removed from load and dump methods.
  - JobOperations.cancel() is renamed to JobOperations.begin_cancel() and it returns LROPoller
  - Workspace.list_keys renamed to Workspace.get_keys.


  - Fix identity passthrough job with single file code
  - MLClient.from_config can now find the default config.json on Compute Instance when running sample notebooks.


   - Removed declaration on Python 3.6 support
   - Added support for custom setup scripts on compute instances.
   - Updated dependencies upper bounds to be major versions.




   - Spark job submission.
   - Command and sweep job docker config (shmSize and dockerArgs) spec support.
   - Entity load and dump now also accept a file pointer as input.
   - Load and dump input names changed from path to 'source' and 'dest', respectively.
   - Load and dump 'path' input still works, but is deprecated and emits a warning.
   - Managed Identity Support for Compute Instance (experimental).
   - Enable using @dsl.pipeline without brackets when no additional parameters.
   - Expose Azure subscription Id and resource group name from MLClient objects.
   - Added Idle Shutdown support for Compute Instances, allowing instances to shutdown after a set period of inactivity.
   - Online Deployment Data Collection for eventhub and data storage will be supported.
   - Syntax validation on scoring scripts of Batch Deployment and Online Deployment will prevent the user from submitting bad deployments.


   - Change (begin_)create_or_update typehints to use generics.
   - Remove invalid option from create_or_update typehints.
   - Change error returned by (begin_)create_or_update invalid input to TypeError.
   - Rename set_image_model APIs for all vision tasks to set_training_parameters
   - JobOperations.download defaults to "." instead of Path.cwd()




   - Show 'properties' on data assets






  - Support for AutoML Component
  - Added skip_validation for Job/Component create_or_update



  - Dataset removed from public interface.



  - Fixed mismatch errors when updating scale_settings for KubernetesOnlineDeployment.
  - Removed az CLI command that was printed when deleting OnlineEndpoint





  - Allow Input/Output objects to be used by CommandComponent.
  - Added MoonCake cloud support.
  - Unified inputs/outputs building and validation logic in BaseNode.
  - Allow Git repo URLs to be used as code for jobs and components.
  - Updated AutoML YAML schema to use InputSchema.
  - Added end_time to job schedule.
  - MIR and pipeline job now support registry assets.




  - Have mldesigner use argparser to parse incoming args.
  - Bumped pyjwt version to <3.0.0.
  - Reverted "upload support for symlinks".
  - Error message improvement when a YAML UnionField fails to match.
  - Reintroduced support for symlinks when uploading.
  - Hard coded registry base URL to eastus region to support preview.







  - First preview.


pkgId: 024e65f57aa6aa8072da3221ac49bb41769c48b0052e19b442f36320d70a6397
name: python-azure-ai-ml
arch: src
version: 1.21.0
epoch: 0
release: 1
summary: Microsoft Azure Machine Learning Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-ml-1.21.0-1.src.rpm
checksum_type: sha256
description:
  We are excited to introduce the GA of Azure Machine Learning Python SDK v2. The Python SDK v2 introduces new SDK capabilities like standalone local jobs, reusable components for pipelines and managed online/batch inferencing. Python SDK v2 allows you to move from simple to complex tasks easily and incrementally. This is enabled by using a common object model which brings concept reuse and consistency of actions across various tasks. The SDK v2 shares its foundation with the CLI v2 which is also GA.

  [Source code][source_code]
  | [Package (PyPI)][ml_pypi]
  | [Package (Conda)][ml_conda]
  | [API reference documentation][ml_ref_docs]
  | [Product documentation][product_documentation]
  | [Samples][ml_samples]


  This package has been tested with Python 3.8, 3.9, 3.10, 3.11 and 3.12.

  For a more complete set of Azure libraries, see https://aka.ms/azsdk/python/all





  - Python 3.7 or later is required to use this package.
  - You must have an [Azure subscription][azure_subscription].
  - An [Azure Machine Learning Workspace][workspace].



  Install the Azure ML client library for Python with [pip][pip_link]:

  ```bash
  pip install azure-ai-ml
  pip install azure-identity
  ```



  ```python
  from azure.ai.ml import MLClient
  from azure.identity import DefaultAzureCredential

  ml_client = MLClient(
      DefaultAzureCredential(), subscription_id, resource_group, workspace
  )
  ```



  Azure Machine Learning Python SDK v2 comes with many new features like standalone local jobs, reusable components for pipelines and managed online/batch inferencing. The SDK v2 brings consistency and ease of use across all assets of the platform. The Python SDK v2 offers the following capabilities:
  * Run **Standalone Jobs** - run a discrete ML activity as Job. This job can be run locally or on the cloud. We currently support the following types of jobs:
    * Command - run a command (Python, R, Windows Command, Linux Shell etc.)
    * Sweep - run a hyperparameter sweep on your Command
  * Run multiple jobs using our **improved Pipelines**
    * Run a series of commands stitched into a pipeline (**New**)
    * **Components** - run pipelines using reusable components (**New**)
  * Use your models for **Managed Online inferencing** (**New**)
  * Use your models for Managed **batch inferencing**
  * Manage AML resources – workspace, compute, datastores
  * Manage AML assets - Datasets, environments, models
  * **AutoML** - run standalone AutoML training for various ml-tasks:
    - Classification (Tabular data)
    - Regression (Tabular data)
    - Time Series Forecasting (Tabular data)
    - Image Classification (Multi-class) (**New**)
    - Image Classification (Multi-label) (**New**)
    - Image Object Detection (**New**)
    - Image Instance Segmentation (**New**)
    - NLP Text Classification (Multi-class) (**New**)
    - NLP Text Classification (Multi-label) (**New**)
    - NLP Text Named Entity Recognition (NER) (**New**)



  - View our [samples][ml_samples].





  Azure ML clients raise exceptions defined in [Azure Core][azure_core_readme].

  ```python
  from azure.core.exceptions import HttpResponseError

  try:
      ml_client.compute.get("cpu-cluster")
  except HttpResponseError as error:
      print("Request failed: {}".format(error.message))
  ```



  This library uses the standard
  [logging][python_logging] library for logging.
  Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
  level.

  Detailed DEBUG level logging, including request/response bodies and unredacted
  headers, can be enabled on a client with the `logging_enable` argument.

  See full SDK logging documentation with examples [here][sdk_logging_docs].



  The Azure ML Python SDK includes a telemetry feature that collects usage and failure data about the SDK and sends it to Microsoft when you use the SDK in a Jupyter Notebook only.
  <u>Telemetry will **not** be collected for any use of the Python SDK outside of a Jupyter Notebook.</u>

  Telemetry data helps the SDK team understand how the SDK is used so it can be improved and the information about failures helps the team resolve problems and fix bugs.
  The SDK telemetry feature is enabled by default for Jupyter Notebook usage and cannot be enabled for non-Jupyter scenarios. To opt out of the telemetry feature in a Jupyter scenario, pass in `enable_telemetry=False` when constructing your MLClient object.



  - View our [samples][ml_samples].



  This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.

  <!-- LINKS -->

  [source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ml/azure-ai-ml
  [ml_pypi]: https://pypi.org/project/azure-ai-ml/
  [ml_conda]: https://anaconda.org/microsoft/azure-ai-ml/
  [ml_ref_docs]: https://learn.microsoft.com/python/api/azure-ai-ml/?view=azure-python
  [ml_samples]: https://github.com/Azure/azureml-examples/tree/main/sdk/python
  [product_documentation]: https://docs.microsoft.com/azure/machine-learning/
  [azure_subscription]: https://azure.microsoft.com/free/
  [workspace]: https://docs.microsoft.com/azure/machine-learning/concept-workspace
  [python_logging]: https://docs.python.org/3/library/logging.html
  [sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/azure-sdk-logging
  [azure_core_readme]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [pip_link]: https://pypi.org/project/pip/
  [azure_core_ref_docs]: https://aka.ms/azsdk-python-core-policies
  [azure_core]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity
  [cla]: https://cla.microsoft.com
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
  [coc_contact]: mailto:opencode@microsoft.com







    - Cross subscription storage account support for workspace and feature store. Developer can provide a storage account from another subscription while creating a workspace or storage account.


    - #35820 - using compute location attribute to fill compute location to align the experience with UI.





    - When a workspace is created with `managed_network` enabled or has `public_network_access` set to disabled, the resources created with the workspace (Key Vault, Storage Account) will be set to have restricted network access settings. This is only applicable when the user does not specify existing resources.
    - Added support of `fqdns` property for managed network `PrivateEndpointDestination` outbound rule objects. Enabling the support of Application Gateway as a Private Endpoint target in the workspace managed network.
    - Added support of `address_prefixes` property for managed network `ServiceTagDestination` outbound rule objects.
    - Removed experimental tag from `managed_network` which is a GA feature.





    - Added enable_sso operation under compute operation that will allow user to enable sso setting of a compute instance without any write permission set on compute.


  - Workspace update no longer broken for older workspaces due to deprecated tags.
  - Support credential-less fileshare datastore





   - Expose `public_ip_address` in `AmlComputeNodeInfo`, to get the public ip address with the ssh port when calling `ml_client.compute.list_nodes`
   - Uploads to account key access datastores will be authorized via a SAS token retrieved from a call to `DatastoreOperations._list_secrets`. Key-based authentication for uploads for such datastores is no longer used. Identity-based datastores will use user identity authentication retrieved from the MLClient.
  - Support `update_sso_settings` in `ComputeOperations`, to enable or disable single sign-on settings of a compute instance.


  - InputTypes exported in constants module
  - WorkspaceConnection tags are now listed as deprecated, and the erroneously-deprecated metadata field has been un-deprecated and added as a initialization field. These two fields still point to the same underlying object property, and actual API usage of this value is unchanged.
  - Workspace Create operation works without an application insights being provided, and creates a default appIn resource for normal workspaces in that case.
  - Project create operations works in general.



  - WorkspaceConnections are officially GA'd and no longer experimental. But its much newer subclasses remain experimental.




  - Workspace Create operation works without an application insights being provided, and creates a default appIn resource for normal workspaces in that case.
  - Project create operations works in general.






  - Add experimental support for working with Promptflow evaluators: `ml_client.evaluators`.
  - Many changes to the Connection entity class and its associated operations.
  - Workspace Connection `list`, `get`, and `create_or_update` operations now include an optional `populate_secrets` input, which causes the operations to try making a secondary call to fill in the returned connections' credential info if possible. Only works with api key-based credentials for now.
  - Many workspace connection subtypes added. The full list of subclasses is now:
    - `AzureBlobStoreConnection`
    - `AzureBlobStoreConnection`
    - `MicrosoftOneLakeConnection`
    - `AzureOpenAIConnection`
    - `AzureAIServicesConnection`
    - `AzureAISearchConnection`
    - `AzureContentSafetyConnection`
    - `AzureSpeechServicesConnection`
    - `APIKeyConnection`
    - `OpenAIConnection`
    - `SerpConnection`
    - `ServerlessConnection`
  - Many workspace connections only accept api keys or entra ids for credentials. Since Entra IDs require not inputs, these have been refactored to not required a full credential object. Instead they only accept an api_key as a top-level input, and default to an entra credential otherwise. Their YAML schemas have been similarly altered.
  - Client-side credential-type validation added for some workspace connection types.
  - Added new credential type: `AadCredentialConfiguration`
  - Renamed WorkspaceHub class as Hub.
  - Added Project entity class and YAML support.
  - Project and Hub operations supported by workspace operations.
  - workspace list operation supports type filtering.
  - Add support for Microsoft Entra token (`aad_token`) auth in `invoke` and `get-credentials` operations.
  - Add experimental support for working with indexes: `ml_client.indexes`





  - Removed WorkspaceHubConfig entity, and renamed WorkspaceHub to Hub.
  - workspace_hub input of Workspace class hidden, renamed to hub_id, and re-surfaced in child class Project.
  - Removed Workspace Hub Operations from ML Client.







  - The following classes will still be able to be imported from `azure.ai.ml`, but the import is deprecated and emits a warning. Instead, please import them from `azure.ai.ml.entities`.
    - `AmlTokenConfiguration`
    - `ManagedIdentityConfiguration`
    - `UserIdentityConfiguration`
  - The following classes will still be able to be imported from `azure.ai.ml.entities`, but the import is deprecated and emits a warning. Instead, please import them from `azure.ai.ml.sweep`.
    - `Choice`
    - `Uniform`
    - `LogUniform`
    - `QLogUniform`
    - `QUniform`
    - `QLogNormal`
    - `QNormal`
    - `LogNormal`
    - `Normal`
    - `Randint`




  - Remove `experimental` tag for  `ml_client.jobs.validate`.
  - Workspace Connection has new read-only subclass: AzureBlobStoreWorkspaceConnectionSchema.
  - Workspace Connection supports 2 new types under main class: gen 2 and azure_one_lake.
  - Workspace Connection LIST operation can return data connections via new optional flag: include_data_connections.
  - Support `ml_client.schedules.trigger(name='my_schedule')` function to trigger a schedule once.


  - Fix pipeline job `outputs` not load correctly when `component: <local-file>` exists in pipeline job yaml.
  - Workspace ListKey operation serialization issue fixed.
  - Workspace Diagnose result now can be print in to Json format.





  - Support for Python 3.12














  - Workspace Connections had 3 child classes added for open AI, cog search, and cog service connections.
  - Workspace Connections replaced metadata with tags, and surfaced api_version, api_type, and kind for certain connection types.



  - Workspace Hubs now properly create various endpoints, and surface a variable to select the resource they connect to via the
    'endpoint_resource_id' kwarg.








   - pydash dependency version was upgraded to >=6.0.0 to patch [security vulnerability in versions below 6.0.0](https://github.com/advisories/GHSA-8mjr-6c96-39w8)
   - Workspace hub deletion no longer fails if delete_dependent_resources is true.




  - Now, when you specify `delete_dependent_resources` as True when deleting a workspace, the log analytics resource
    associated with the workspace application insights resource will also be deleted.
  - Now, when creating or updating a workspace, you can provide a `serverless_compute` configuration object. This allows configuring a custom subnet in which all Serverless computes will be created. You can also specify whether or not these Serverless computes will have public IP addresses or not.


   - [Python 3.7 reached end-of-life on June 27th 2023](https://devguide.python.org/versions/). Consequently, 3.7 will be deprecated in azure-ai-ml starting in October 2023 and azure-ai-ml will end support for 3.7 in February 2024.




  - Feature sets can now be registers after being dumped and reloaded.
  - SDK feature store create/update can now assign materialization identities to cross RG offline stores and online stores.




  - Added support of features that are known into the future/at forecast time for dnn in AutoML Forecasting jobs.
  - Added support for new workspace connection types: azure_open_ai, cognitive_search, and cognitive_service.
  - Added support for new credential type: ApiKeyConfiguration.
  - Added support of `download` for component operations.


  - Local job runs will no longer fail if Docker registry has no username/password
  - Fixed an issue that code asset doesn't work with relative symbol links.
  - Fixed [Issue 31319](https://github.com/Azure/azure-sdk-for-python/issues/31319): can't accept `PathLike` for `CommandComponent.code`.



  - `azure-ai-ml` now performs all file i/o on `utf-8` encoded files per Azure SDK guidance.
    (instead of the default behavior for python < 3.15, which uses locale specific encodings)
  - Removed references to deprecated "feature_store" workspace connection type.




  - Added support to enable gpu access (local_enable_gpu) for local deployment.



  - Improved the output when printing a workspace object to be more clean and readable.
  - Log level of unknown field notifications for pipeline nodes raised from INFO to WARNING.



  - Added support to enable set workspace connection secret expiry time.
  - Added support for `stage` on model version



  - Fixed an issue affecting authentication to registry-related services in sovereign regions.
  - Made job_tier and priority values case insensitive




  - Public preview support for new schedule type `MonitorSchedule`





  - Fixed an issue where `OnlineDeployment.provisioning_state` was incorrectly deserialized and set as `None`





  - Added data import schedule. The class added is `ImportDataSchedule`.
  - Added support to enable data isolation feature at workspace creation stage.
  - Added auto_delete_setting support for asset version in data import job.
  - Switched code snapshot upload from directory-based to container-based design in order to allow finer RBAC within workspaces. A container will be created for each new snapshot. This change does not affect storage costs or snapshot functionality.











  - Added experimental scatter gather node to DSL package. This node has a unique mldesigner dependency.
  - Added support to make JobService and ServiceInstance objects serializable when printed
  - Support Singularity compute in pipeline job
  - Added purge operation support for workspace resource
  - Added Feature Store, its dedicated classes and updated the docstrings, now available in public interface. The classes added are `FeatureStoreOperations, FeatureSetOperations, FeatureStoreEntityOperations` with properties classes specific to the new features.
  - Support additional_includes in command component
  - Added experimental `distribution: ray` support in command job.



  - Fixed issue where show_progress=False was not being respected for uploads when set via MLClient
  - Fixed issue of spark input/output mode validation doesn't take effect because of wrong type assertion
  - Fixed the bug when setting `node.limits.timeout` to a pipeline input.
  - Removed Experimental Tag from Idle Shutdown, Custom Applications, Setup Scripts, and Image Metadata on Compute Instances.
  - Removed Experimental Tag from JobService classes



  - Renamed `JobServiceBase.job_service_type` to `type`



  - Remove the default placeholder for CommandComponent.code




  - Added support for `tags` on Compute Resources.
  - Added support for promoting data asset from a workspace to a registry
  - Added support for registering named asset from job output or node output by specifying name and version settings.
  - Added support for data binding on outputs inside dynamic arguments for dsl pipeline
  - Added support for serverless compute in pipeline, command, automl and sweep job
  - Added support for `job_tier` and `priority` in standalone job
  - Added support for passing `locations` via command function and set it to `JobResourceConfiguration.locations`
  - Added support for modifying SSH key values after creation on Compute Resources.
  - Added WorkspaceConnection types `s3`, `snowflake`, `azure_sql_db`, `azure_synapse_analytics`, `azure_my_sql_db`, `azure_postgres_db`
  - Added WorkspaceConnection auth type `access_key` for `s3`
  - Added DataImport class and DataOperations.import_data.
  - Added DataOperations.list_materialization_status - list status of data import jobs that create asset versions via asset name.



  - Fix experiment name wrongly set to 'Default' when schedule existing job.
  - Error message improvement when a local path fails to match with data asset type.
  - Error message improvement when an asset does not exist in a registry
  - Fix an issue when submit spark pipeline job with referring a registered component
  - Fix an issue that prevented Job.download from downloading the output of a BatchJob



  - Added dependency on `azure-mgmt-resource`
  - Added dependency on `azure-mgmt-resourcegraph`
  - Added dependency on `opencensus-ext-azure<2.0.0`
  - Update job types to use MFE Dec preview rest objects.
  - Added classifiers for Python version 3.11.
  - Added warning for reserved keywords in IO names in pipeline job nodes.
  - Added telemetry logging for SDK Jupyter Notebook scenarios with opt-out option (see README.md)




  - Added dedicated classes for each type of job service and updated the docstrings. The classes added are `JupyterLabJobService, SshJobService, TensorBoardJobService, VsCodeJobService` with a few properties specific to the type.
  - Added Custom Applications Support to Compute Instances.
  - Update data asset list, show and create operations to support data assets in registry.
  - Added Managed Network features to workspace to include `ManagedNetwork`, `FqdnDestination`, `PrivateEndpointDestination`, `ServiceTagDestination` as well as relevant schema.


  - Fixed an issue where the ordering of `.amlignore` and `.gitignore` files are not respected.
  - Fixed an issue that attributes with a value of `False` in `PipelineJobSettings` are not respected.
  - Fixed an issue where ignore files weren't considered during upload directory size calculations.
  - Fixed an issue where symlinks crashed upload directory size calculations.
  - Fixes a bug where enable_node_public_ip returned an improper value when fetching a Compute.


  - Update workspace creation to use Log Analytics-Based Application Insights when the user does not specify/bring their own App Insights.
  - Upgraded minimum azure-core version to 1.23.0.




  - Change print behavior of entity classes to show object yaml in notebooks, can be configured on in other contexts.
  - Added property to enable/disable public ip addresses to Compute Instances and AML Computes.
  - `Deployment` and `ScheduleOperations` added to public interface.


  - Fixed issue with date-time format for utc_time_created field when creating models.
  - Added stricter behavior for ArmStr schemas when parsing 'azureml:' prefix.
  - Fixed issue where AmlComputes could only be created in a workspace's default region.
  - Improved intellisense with VS Code for fields supporting local paths and datastores.
  - Added validation for token generation with aml scope when user_identity is used in job definition aka OBO flow.
  - Fixed duplicate node name error in pipeline when two node names assigned to the same node and get renamed by node.name='xx'.
  - Resolve the cross references for MLClient, Resource and OnlineDeployment.
  - Explicit use of Optional (or a Union with None), as per PEP 484.
  - Fixed print on Command objects when job id is empty
  - Fixed issue where `SasTokenConfiguration` cannot be used as credential for `WorkspaceConnection`


  - Removed dependency on API version 2021-10-01 and 2022-06-01-preview to reduce side of azure-ai-ml package.




  - Removed description from Registry.
  - Disable sdk telemetry logging


  - Enable updating the CMK encryption key (workspace.encryption.keyVaultProperties.keyIdentifier) for a workspace.
  - Mark JobService class and services param to command() as experimental.
  - Added a replication_count value to the schema of SystemCreatedStorageAccount in Registry.
  - Added support for Fairfax and MoonCake cloud for the registry discovery baseurl.
  - Added support for variable args as pipeline input in DSL Pipeline.
  - Added OS Patching Parameters to Compute Instance.


  - Update the upper bound dependencies version for tqdm, strictyaml, colorama and opencensus-ext-azure.
  - Added missing "properties" to batch deployment.
  - Retain the cases for the names of system job services (Tracking and Studio).
  - Update registry begin_delete method return type.
  - Fixed sweep job optional input cannot be empty.
  - Fixed bool test for output in download operation.
  - Fixed Compute Instance schedule not being created
  - Removed erroneous experimental warning from Compute Schedules




  - Restored idle_time_before_shutdown property for Compute Instances.
  - Deprecated idle_time_before_shutdown property in favor of idle_time_before_shutdown_minutes.


  - Fixed idle_time_before_shutdown appearing as None for Compute Instances returned by `show` or `list`.
  - Fixed idle_time_before_shutdown_minutes preventing creation of Compute Instances when set to None.




  - Renamed idle_time_before_shutdown to idle_time_before_shutdown_minutes and changed input type to int.


  - Fixed idle_time_before_shutdown_minutes not appearing in GET calls for Compute Instances.




  - Registry list operation now accepts scope value to allow subscription-only based requests.
  - Most configuration classes from the entity package now implement the standard mapping protocol.
  - Add registry delete operation.
  - The values of JobService.job_service_type are now using the snake case. e.g jupyter_lab, ssh, tensor_board, vs_code.
  - Command function now accepts services param of type Dict[str, JobService] instead of dict.


  - MLClient.from_config can now find the default config.json on Compute Instance when running sample notebooks.
  - Fixed job inputs not accepting datastores or job inputs.
  - Registries now assign managed tags to match registry's tags.
  - Adjust registry experimental tags and imports to avoid warning printouts for unrelated operations.
  - Make registry delete operation return an LROPoller, and change name to begin_delete.
  - Prevent registering an already existing environment that references conda file.
  - Fix ARM ID logic for registry environments (ex: Creating a registry component that references a registry environment).
  - Fix ARM ID logic for passing models and environments with ID (ex: Creating endpoint deployment for a registry model should return said model's ID immediately)


  - Switched compute operations to go through 2022-10-01-preview API version.


  - GA release
  - Dropped support for Python 3.6. The Python versions supported for this release are 3.7-3.10.




  - OnlineDeploymentOperations.delete has been renamed to begin_delete.
  - Datastore credentials are switched to use unified credential configuration classes.
  - UserAssignedIdentity is replaced by ManagedIdentityConfiguration
  - Endpoint and Job use unified identity classes.
  - Workspace ManagedServiceIdentity has been replaced by IdentityConfiguration.



   - Switched Compute operations to use Oct preview API version.
   - Updated batch deployment/endpoint invoke and list-jobs function signatures with curated BatchJob class.




   - Support passing JobService as argument to Command()
   - Added support for custom setup scripts on compute instances.
   - Added a `show_progress` parameter to MLClient for enable/disable progress bars of long running operations.
   - Support `month_days` in `RecurrencePattern` when using `RecurrenceSchedule`.
   - Support `ml_client.schedules.list` with `list_view_type`, default to `ENABLED_ONLY`.
   - Add support for model sweeping and hyperparameter tuning in AutoML NLP jobs.
   - Added `ml_client.jobs.show_services()` operation.


  - ComputeOperations.attach has been renamed to begin_attach.
  - Deprecated parameter path has been removed from load and dump methods.
  - JobOperations.cancel() is renamed to JobOperations.begin_cancel() and it returns LROPoller
  - Workspace.list_keys renamed to Workspace.get_keys.


  - Fix identity passthrough job with single file code
  - MLClient.from_config can now find the default config.json on Compute Instance when running sample notebooks.


   - Removed declaration on Python 3.6 support
   - Added support for custom setup scripts on compute instances.
   - Updated dependencies upper bounds to be major versions.




   - Spark job submission.
   - Command and sweep job docker config (shmSize and dockerArgs) spec support.
   - Entity load and dump now also accept a file pointer as input.
   - Load and dump input names changed from path to 'source' and 'dest', respectively.
   - Load and dump 'path' input still works, but is deprecated and emits a warning.
   - Managed Identity Support for Compute Instance (experimental).
   - Enable using @dsl.pipeline without brackets when no additional parameters.
   - Expose Azure subscription Id and resource group name from MLClient objects.
   - Added Idle Shutdown support for Compute Instances, allowing instances to shutdown after a set period of inactivity.
   - Online Deployment Data Collection for eventhub and data storage will be supported.
   - Syntax validation on scoring scripts of Batch Deployment and Online Deployment will prevent the user from submitting bad deployments.


   - Change (begin_)create_or_update typehints to use generics.
   - Remove invalid option from create_or_update typehints.
   - Change error returned by (begin_)create_or_update invalid input to TypeError.
   - Rename set_image_model APIs for all vision tasks to set_training_parameters
   - JobOperations.download defaults to "." instead of Path.cwd()




   - Show 'properties' on data assets






  - Support for AutoML Component
  - Added skip_validation for Job/Component create_or_update



  - Dataset removed from public interface.



  - Fixed mismatch errors when updating scale_settings for KubernetesOnlineDeployment.
  - Removed az CLI command that was printed when deleting OnlineEndpoint





  - Allow Input/Output objects to be used by CommandComponent.
  - Added MoonCake cloud support.
  - Unified inputs/outputs building and validation logic in BaseNode.
  - Allow Git repo URLs to be used as code for jobs and components.
  - Updated AutoML YAML schema to use InputSchema.
  - Added end_time to job schedule.
  - MIR and pipeline job now support registry assets.




  - Have mldesigner use argparser to parse incoming args.
  - Bumped pyjwt version to <3.0.0.
  - Reverted "upload support for symlinks".
  - Error message improvement when a YAML UnionField fails to match.
  - Reintroduced support for symlinks when uploading.
  - Hard coded registry base URL to eastus region to support preview.







  - First preview.


pkgId: 6aa4f0325e0cd6ec1e2889f9a75304f2cfbc9ba631e6566603a0e24c4eb4ffa8
name: python-azure-ai-ml
arch: src
version: 1.22.0
epoch: 0
release: 1
summary: Microsoft Azure Machine Learning Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-ml-1.22.0-1.src.rpm
checksum_type: sha256
description:
  We are excited to introduce the GA of Azure Machine Learning Python SDK v2. The Python SDK v2 introduces new SDK capabilities like standalone local jobs, reusable components for pipelines and managed online/batch inferencing. Python SDK v2 allows you to move from simple to complex tasks easily and incrementally. This is enabled by using a common object model which brings concept reuse and consistency of actions across various tasks. The SDK v2 shares its foundation with the CLI v2 which is also GA.

  [Source code][source_code]
  | [Package (PyPI)][ml_pypi]
  | [Package (Conda)][ml_conda]
  | [API reference documentation][ml_ref_docs]
  | [Product documentation][product_documentation]
  | [Samples][ml_samples]


  This package has been tested with Python 3.8, 3.9, 3.10, 3.11 and 3.12.

  For a more complete set of Azure libraries, see https://aka.ms/azsdk/python/all





  - Python 3.7 or later is required to use this package.
  - You must have an [Azure subscription][azure_subscription].
  - An [Azure Machine Learning Workspace][workspace].



  Install the Azure ML client library for Python with [pip][pip_link]:

  ```bash
  pip install azure-ai-ml
  pip install azure-identity
  ```



  ```python
  from azure.ai.ml import MLClient
  from azure.identity import DefaultAzureCredential

  ml_client = MLClient(
      DefaultAzureCredential(), subscription_id, resource_group, workspace
  )
  ```



  Azure Machine Learning Python SDK v2 comes with many new features like standalone local jobs, reusable components for pipelines and managed online/batch inferencing. The SDK v2 brings consistency and ease of use across all assets of the platform. The Python SDK v2 offers the following capabilities:
  * Run **Standalone Jobs** - run a discrete ML activity as Job. This job can be run locally or on the cloud. We currently support the following types of jobs:
    * Command - run a command (Python, R, Windows Command, Linux Shell etc.)
    * Sweep - run a hyperparameter sweep on your Command
  * Run multiple jobs using our **improved Pipelines**
    * Run a series of commands stitched into a pipeline (**New**)
    * **Components** - run pipelines using reusable components (**New**)
  * Use your models for **Managed Online inferencing** (**New**)
  * Use your models for Managed **batch inferencing**
  * Manage AML resources – workspace, compute, datastores
  * Manage AML assets - Datasets, environments, models
  * **AutoML** - run standalone AutoML training for various ml-tasks:
    - Classification (Tabular data)
    - Regression (Tabular data)
    - Time Series Forecasting (Tabular data)
    - Image Classification (Multi-class) (**New**)
    - Image Classification (Multi-label) (**New**)
    - Image Object Detection (**New**)
    - Image Instance Segmentation (**New**)
    - NLP Text Classification (Multi-class) (**New**)
    - NLP Text Classification (Multi-label) (**New**)
    - NLP Text Named Entity Recognition (NER) (**New**)



  - View our [samples][ml_samples].





  Azure ML clients raise exceptions defined in [Azure Core][azure_core_readme].

  ```python
  from azure.core.exceptions import HttpResponseError

  try:
      ml_client.compute.get("cpu-cluster")
  except HttpResponseError as error:
      print("Request failed: {}".format(error.message))
  ```



  This library uses the standard
  [logging][python_logging] library for logging.
  Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
  level.

  Detailed DEBUG level logging, including request/response bodies and unredacted
  headers, can be enabled on a client with the `logging_enable` argument.

  See full SDK logging documentation with examples [here][sdk_logging_docs].



  The Azure ML Python SDK includes a telemetry feature that collects usage and failure data about the SDK and sends it to Microsoft when you use the SDK in a Jupyter Notebook only.
  <u>Telemetry will **not** be collected for any use of the Python SDK outside of a Jupyter Notebook.</u>

  Telemetry data helps the SDK team understand how the SDK is used so it can be improved and the information about failures helps the team resolve problems and fix bugs.
  The SDK telemetry feature is enabled by default for Jupyter Notebook usage and cannot be enabled for non-Jupyter scenarios. To opt out of the telemetry feature in a Jupyter scenario, pass in `enable_telemetry=False` when constructing your MLClient object.



  - View our [samples][ml_samples].



  This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.

  <!-- LINKS -->

  [source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ml/azure-ai-ml
  [ml_pypi]: https://pypi.org/project/azure-ai-ml/
  [ml_conda]: https://anaconda.org/microsoft/azure-ai-ml/
  [ml_ref_docs]: https://learn.microsoft.com/python/api/azure-ai-ml/?view=azure-python
  [ml_samples]: https://github.com/Azure/azureml-examples/tree/main/sdk/python
  [product_documentation]: https://docs.microsoft.com/azure/machine-learning/
  [azure_subscription]: https://azure.microsoft.com/free/
  [workspace]: https://docs.microsoft.com/azure/machine-learning/concept-workspace
  [python_logging]: https://docs.python.org/3/library/logging.html
  [sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/azure-sdk-logging
  [azure_core_readme]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [pip_link]: https://pypi.org/project/pip/
  [azure_core_ref_docs]: https://aka.ms/azsdk-python-core-policies
  [azure_core]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity
  [cla]: https://cla.microsoft.com
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
  [coc_contact]: mailto:opencode@microsoft.com







    - Update TLS version from 1.0 to 1.2
    - Added support for Distillation jobs. Can be created by importing `disillation` from `azure.ai.ml.model_customization`

    - Fix send email notification issue in model monitoring







  - **#37857** - Fix online deployment registry issue






  - Cross subscription storage account support for workspace and feature store. Developer can provide a storage account from another subscription while creating a workspace or storage account.



  - #35820 - using compute location attribute to fill compute location to align the experience with UI.





  - When a workspace is created with `managed_network` enabled or has `public_network_access` set to disabled, the resources created with the workspace (Key Vault, Storage Account) will be set to have restricted network access settings. This is only applicable when the user does not specify existing resources.
  - Added support of `fqdns` property for managed network `PrivateEndpointDestination` outbound rule objects. Enabling the support of Application Gateway as a Private Endpoint target in the workspace managed network.
  - Added support of `address_prefixes` property for managed network `ServiceTagDestination` outbound rule objects.
  - Removed experimental tag from `managed_network` which is a GA feature.





  - Added enable_sso operation under compute operation that will allow user to enable sso setting of a compute instance without any write permission set on compute.



  - Workspace update no longer broken for older workspaces due to deprecated tags.
  - Support credential-less fileshare datastore





  - Expose `public_ip_address` in `AmlComputeNodeInfo`, to get the public ip address with the ssh port when calling `ml_client.compute.list_nodes`
  - Uploads to account key access datastores will be authorized via a SAS token retrieved from a call to `DatastoreOperations._list_secrets`. Key-based authentication for uploads for such datastores is no longer used. Identity-based datastores will use user identity authentication retrieved from the MLClient.
  - Support `update_sso_settings` in `ComputeOperations`, to enable or disable single sign-on settings of a compute instance.



  - InputTypes exported in constants module
  - WorkspaceConnection tags are now listed as deprecated, and the erroneously-deprecated metadata field has been un-deprecated and added as a initialization field. These two fields still point to the same underlying object property, and actual API usage of this value is unchanged.
  - Workspace Create operation works without an application insights being provided, and creates a default appIn resource for normal workspaces in that case.
  - Project create operations works in general.



  - WorkspaceConnections are officially GA'd and no longer experimental. But its much newer subclasses remain experimental.





  - Workspace Create operation works without an application insights being provided, and creates a default appIn resource for normal workspaces in that case.
  - Project create operations works in general.







  - Add experimental support for working with Promptflow evaluators: `ml_client.evaluators`.
  - Many changes to the Connection entity class and its associated operations.
  - Workspace Connection `list`, `get`, and `create_or_update` operations now include an optional `populate_secrets` input, which causes the operations to try making a secondary call to fill in the returned connections' credential info if possible. Only works with api key-based credentials for now.
  - Many workspace connection subtypes added. The full list of subclasses is now:
    - `AzureBlobStoreConnection`
    - `AzureBlobStoreConnection`
    - `MicrosoftOneLakeConnection`
    - `AzureOpenAIConnection`
    - `AzureAIServicesConnection`
    - `AzureAISearchConnection`
    - `AzureContentSafetyConnection`
    - `AzureSpeechServicesConnection`
    - `APIKeyConnection`
    - `OpenAIConnection`
    - `SerpConnection`
    - `ServerlessConnection`
  - Many workspace connections only accept api keys or entra ids for credentials. Since Entra IDs require not inputs, these have been refactored to not required a full credential object. Instead they only accept an api_key as a top-level input, and default to an entra credential otherwise. Their YAML schemas have been similarly altered.
  - Client-side credential-type validation added for some workspace connection types.
  - Added new credential type: `AadCredentialConfiguration`
  - Renamed WorkspaceHub class as Hub.
  - Added Project entity class and YAML support.
  - Project and Hub operations supported by workspace operations.
  - workspace list operation supports type filtering.
  - Add support for Microsoft Entra token (`aad_token`) auth in `invoke` and `get-credentials` operations.
  - Add experimental support for working with indexes: `ml_client.indexes`





  - Removed WorkspaceHubConfig entity, and renamed WorkspaceHub to Hub.
  - workspace_hub input of Workspace class hidden, renamed to hub_id, and re-surfaced in child class Project.
  - Removed Workspace Hub Operations from ML Client.







  - The following classes will still be able to be imported from `azure.ai.ml`, but the import is deprecated and emits a warning. Instead, please import them from `azure.ai.ml.entities`.
    - `AmlTokenConfiguration`
    - `ManagedIdentityConfiguration`
    - `UserIdentityConfiguration`
  - The following classes will still be able to be imported from `azure.ai.ml.entities`, but the import is deprecated and emits a warning. Instead, please import them from `azure.ai.ml.sweep`.
    - `Choice`
    - `Uniform`
    - `LogUniform`
    - `QLogUniform`
    - `QUniform`
    - `QLogNormal`
    - `QNormal`
    - `LogNormal`
    - `Normal`
    - `Randint`





  - Remove `experimental` tag for  `ml_client.jobs.validate`.
  - Workspace Connection has new read-only subclass: AzureBlobStoreWorkspaceConnectionSchema.
  - Workspace Connection supports 2 new types under main class: gen 2 and azure_one_lake.
  - Workspace Connection LIST operation can return data connections via new optional flag: include_data_connections.
  - Support `ml_client.schedules.trigger(name='my_schedule')` function to trigger a schedule once.



  - Fix pipeline job `outputs` not load correctly when `component: <local-file>` exists in pipeline job yaml.
  - Workspace ListKey operation serialization issue fixed.
  - Workspace Diagnose result now can be print in to Json format.





  - Support for Python 3.12















  - Workspace Connections had 3 child classes added for open AI, cog search, and cog service connections.
  - Workspace Connections replaced metadata with tags, and surfaced api_version, api_type, and kind for certain connection types.



  - Workspace Hubs now properly create various endpoints, and surface a variable to select the resource they connect to via the
    'endpoint_resource_id' kwarg.









  - pydash dependency version was upgraded to >=6.0.0 to patch [security vulnerability in versions below 6.0.0](https://github.com/advisories/GHSA-8mjr-6c96-39w8)
  - Workspace hub deletion no longer fails if delete_dependent_resources is true.





  - Now, when you specify `delete_dependent_resources` as True when deleting a workspace, the log analytics resource
    associated with the workspace application insights resource will also be deleted.
  - Now, when creating or updating a workspace, you can provide a `serverless_compute` configuration object. This allows configuring a custom subnet in which all Serverless computes will be created. You can also specify whether or not these Serverless computes will have public IP addresses or not.



  - [Python 3.7 reached end-of-life on June 27th 2023](https://devguide.python.org/versions/). Consequently, 3.7 will be deprecated in azure-ai-ml starting in October 2023 and azure-ai-ml will end support for 3.7 in February 2024.





  - Feature sets can now be registers after being dumped and reloaded.
  - SDK feature store create/update can now assign materialization identities to cross RG offline stores and online stores.





  - Added support of features that are known into the future/at forecast time for dnn in AutoML Forecasting jobs.
  - Added support for new workspace connection types: azure_open_ai, cognitive_search, and cognitive_service.
  - Added support for new credential type: ApiKeyConfiguration.
  - Added support of `download` for component operations.



  - Local job runs will no longer fail if Docker registry has no username/password
  - Fixed an issue that code asset doesn't work with relative symbol links.
  - Fixed [Issue 31319](https://github.com/Azure/azure-sdk-for-python/issues/31319): can't accept `PathLike` for `CommandComponent.code`.



  - `azure-ai-ml` now performs all file i/o on `utf-8` encoded files per Azure SDK guidance.
    (instead of the default behavior for python < 3.15, which uses locale specific encodings)
  - Removed references to deprecated "feature_store" workspace connection type.





  - Added support to enable gpu access (local_enable_gpu) for local deployment.



  - Improved the output when printing a workspace object to be more clean and readable.
  - Log level of unknown field notifications for pipeline nodes raised from INFO to WARNING.





  - Added support to enable set workspace connection secret expiry time.
  - Added support for `stage` on model version



  - Fixed an issue affecting authentication to registry-related services in sovereign regions.
  - Made job_tier and priority values case insensitive





  - Public preview support for new schedule type `MonitorSchedule`





  - Fixed an issue where `OnlineDeployment.provisioning_state` was incorrectly deserialized and set as `None`





  - Added data import schedule. The class added is `ImportDataSchedule`.
  - Added support to enable data isolation feature at workspace creation stage.
  - Added auto_delete_setting support for asset version in data import job.
  - Switched code snapshot upload from directory-based to container-based design in order to allow finer RBAC within workspaces. A container will be created for each new snapshot. This change does not affect storage costs or snapshot functionality.











  - Added experimental scatter gather node to DSL package. This node has a unique mldesigner dependency.
  - Added support to make JobService and ServiceInstance objects serializable when printed
  - Support Singularity compute in pipeline job
  - Added purge operation support for workspace resource
  - Added Feature Store, its dedicated classes and updated the docstrings, now available in public interface. The classes added are `FeatureStoreOperations, FeatureSetOperations, FeatureStoreEntityOperations` with properties classes specific to the new features.
  - Support additional_includes in command component
  - Added experimental `distribution: ray` support in command job.



  - Fixed issue where show_progress=False was not being respected for uploads when set via MLClient
  - Fixed issue of spark input/output mode validation doesn't take effect because of wrong type assertion
  - Fixed the bug when setting `node.limits.timeout` to a pipeline input.
  - Removed Experimental Tag from Idle Shutdown, Custom Applications, Setup Scripts, and Image Metadata on Compute Instances.
  - Removed Experimental Tag from JobService classes



  - Renamed `JobServiceBase.job_service_type` to `type`



  - Remove the default placeholder for CommandComponent.code





  - Added support for `tags` on Compute Resources.
  - Added support for promoting data asset from a workspace to a registry
  - Added support for registering named asset from job output or node output by specifying name and version settings.
  - Added support for data binding on outputs inside dynamic arguments for dsl pipeline
  - Added support for serverless compute in pipeline, command, automl and sweep job
  - Added support for `job_tier` and `priority` in standalone job
  - Added support for passing `locations` via command function and set it to `JobResourceConfiguration.locations`
  - Added support for modifying SSH key values after creation on Compute Resources.
  - Added WorkspaceConnection types `s3`, `snowflake`, `azure_sql_db`, `azure_synapse_analytics`, `azure_my_sql_db`, `azure_postgres_db`
  - Added WorkspaceConnection auth type `access_key` for `s3`
  - Added DataImport class and DataOperations.import_data.
  - Added DataOperations.list_materialization_status - list status of data import jobs that create asset versions via asset name.



  - Fix experiment name wrongly set to 'Default' when schedule existing job.
  - Error message improvement when a local path fails to match with data asset type.
  - Error message improvement when an asset does not exist in a registry
  - Fix an issue when submit spark pipeline job with referring a registered component
  - Fix an issue that prevented Job.download from downloading the output of a BatchJob



  - Added dependency on `azure-mgmt-resource`
  - Added dependency on `azure-mgmt-resourcegraph`
  - Added dependency on `opencensus-ext-azure<2.0.0`
  - Update job types to use MFE Dec preview rest objects.
  - Added classifiers for Python version 3.11.
  - Added warning for reserved keywords in IO names in pipeline job nodes.
  - Added telemetry logging for SDK Jupyter Notebook scenarios with opt-out option (see README.md)





  - Added dedicated classes for each type of job service and updated the docstrings. The classes added are `JupyterLabJobService, SshJobService, TensorBoardJobService, VsCodeJobService` with a few properties specific to the type.
  - Added Custom Applications Support to Compute Instances.
  - Update data asset list, show and create operations to support data assets in registry.
  - Added Managed Network features to workspace to include `ManagedNetwork`, `FqdnDestination`, `PrivateEndpointDestination`, `ServiceTagDestination` as well as relevant schema.



  - Fixed an issue where the ordering of `.amlignore` and `.gitignore` files are not respected.
  - Fixed an issue that attributes with a value of `False` in `PipelineJobSettings` are not respected.
  - Fixed an issue where ignore files weren't considered during upload directory size calculations.
  - Fixed an issue where symlinks crashed upload directory size calculations.
  - Fixes a bug where enable_node_public_ip returned an improper value when fetching a Compute.



  - Update workspace creation to use Log Analytics-Based Application Insights when the user does not specify/bring their own App Insights.
  - Upgraded minimum azure-core version to 1.23.0.





  - Change print behavior of entity classes to show object yaml in notebooks, can be configured on in other contexts.
  - Added property to enable/disable public ip addresses to Compute Instances and AML Computes.
  - `Deployment` and `ScheduleOperations` added to public interface.



  - Fixed issue with date-time format for utc_time_created field when creating models.
  - Added stricter behavior for ArmStr schemas when parsing 'azureml:' prefix.
  - Fixed issue where AmlComputes could only be created in a workspace's default region.
  - Improved intellisense with VS Code for fields supporting local paths and datastores.
  - Added validation for token generation with aml scope when user_identity is used in job definition aka OBO flow.
  - Fixed duplicate node name error in pipeline when two node names assigned to the same node and get renamed by node.name='xx'.
  - Resolve the cross references for MLClient, Resource and OnlineDeployment.
  - Explicit use of Optional (or a Union with None), as per PEP 484.
  - Fixed print on Command objects when job id is empty
  - Fixed issue where `SasTokenConfiguration` cannot be used as credential for `WorkspaceConnection`



  - Removed dependency on API version 2021-10-01 and 2022-06-01-preview to reduce side of azure-ai-ml package.





  - Removed description from Registry.
  - Disable sdk telemetry logging



  - Enable updating the CMK encryption key (workspace.encryption.keyVaultProperties.keyIdentifier) for a workspace.
  - Mark JobService class and services param to command() as experimental.
  - Added a replication_count value to the schema of SystemCreatedStorageAccount in Registry.
  - Added support for Fairfax and MoonCake cloud for the registry discovery baseurl.
  - Added support for variable args as pipeline input in DSL Pipeline.
  - Added OS Patching Parameters to Compute Instance.



  - Update the upper bound dependencies version for tqdm, strictyaml, colorama and opencensus-ext-azure.
  - Added missing "properties" to batch deployment.
  - Retain the cases for the names of system job services (Tracking and Studio).
  - Update registry begin_delete method return type.
  - Fixed sweep job optional input cannot be empty.
  - Fixed bool test for output in download operation.
  - Fixed Compute Instance schedule not being created
  - Removed erroneous experimental warning from Compute Schedules





  - Restored idle_time_before_shutdown property for Compute Instances.
  - Deprecated idle_time_before_shutdown property in favor of idle_time_before_shutdown_minutes.



  - Fixed idle_time_before_shutdown appearing as None for Compute Instances returned by `show` or `list`.
  - Fixed idle_time_before_shutdown_minutes preventing creation of Compute Instances when set to None.





  - Renamed idle_time_before_shutdown to idle_time_before_shutdown_minutes and changed input type to int.



  - Fixed idle_time_before_shutdown_minutes not appearing in GET calls for Compute Instances.





  - Registry list operation now accepts scope value to allow subscription-only based requests.
  - Most configuration classes from the entity package now implement the standard mapping protocol.
  - Add registry delete operation.
  - The values of JobService.job_service_type are now using the snake case. e.g jupyter_lab, ssh, tensor_board, vs_code.
  - Command function now accepts services param of type Dict[str, JobService] instead of dict.



  - MLClient.from_config can now find the default config.json on Compute Instance when running sample notebooks.
  - Fixed job inputs not accepting datastores or job inputs.
  - Registries now assign managed tags to match registry's tags.
  - Adjust registry experimental tags and imports to avoid warning printouts for unrelated operations.
  - Make registry delete operation return an LROPoller, and change name to begin_delete.
  - Prevent registering an already existing environment that references conda file.
  - Fix ARM ID logic for registry environments (ex: Creating a registry component that references a registry environment).
  - Fix ARM ID logic for passing models and environments with ID (ex: Creating endpoint deployment for a registry model should return said model's ID immediately)



  - Switched compute operations to go through 2022-10-01-preview API version.



  - GA release
  - Dropped support for Python 3.6. The Python versions supported for this release are 3.7-3.10.





  - OnlineDeploymentOperations.delete has been renamed to begin_delete.
  - Datastore credentials are switched to use unified credential configuration classes.
  - UserAssignedIdentity is replaced by ManagedIdentityConfiguration
  - Endpoint and Job use unified identity classes.
  - Workspace ManagedServiceIdentity has been replaced by IdentityConfiguration.



  - Switched Compute operations to use Oct preview API version.
  - Updated batch deployment/endpoint invoke and list-jobs function signatures with curated BatchJob class.





  - Support passing JobService as argument to Command()
  - Added support for custom setup scripts on compute instances.
  - Added a `show_progress` parameter to MLClient for enable/disable progress bars of long running operations.
  - Support `month_days` in `RecurrencePattern` when using `RecurrenceSchedule`.
  - Support `ml_client.schedules.list` with `list_view_type`, default to `ENABLED_ONLY`.
  - Add support for model sweeping and hyperparameter tuning in AutoML NLP jobs.
  - Added `ml_client.jobs.show_services()` operation.



  - ComputeOperations.attach has been renamed to begin_attach.
  - Deprecated parameter path has been removed from load and dump methods.
  - JobOperations.cancel() is renamed to JobOperations.begin_cancel() and it returns LROPoller
  - Workspace.list_keys renamed to Workspace.get_keys.



  - Fix identity passthrough job with single file code
  - MLClient.from_config can now find the default config.json on Compute Instance when running sample notebooks.



  - Removed declaration on Python 3.6 support
  - Added support for custom setup scripts on compute instances.
  - Updated dependencies upper bounds to be major versions.





  - Spark job submission.
  - Command and sweep job docker config (shmSize and dockerArgs) spec support.
  - Entity load and dump now also accept a file pointer as input.
  - Load and dump input names changed from path to 'source' and 'dest', respectively.
  - Load and dump 'path' input still works, but is deprecated and emits a warning.
  - Managed Identity Support for Compute Instance (experimental).
  - Enable using @dsl.pipeline without brackets when no additional parameters.
  - Expose Azure subscription Id and resource group name from MLClient objects.
  - Added Idle Shutdown support for Compute Instances, allowing instances to shutdown after a set period of inactivity.
  - Online Deployment Data Collection for eventhub and data storage will be supported.
  - Syntax validation on scoring scripts of Batch Deployment and Online Deployment will prevent the user from submitting bad deployments.



  - Change (begin_)create_or_update typehints to use generics.
  - Remove invalid option from create_or_update typehints.
  - Change error returned by (begin_)create_or_update invalid input to TypeError.
  - Rename set_image_model APIs for all vision tasks to set_training_parameters
  - JobOperations.download defaults to "." instead of Path.cwd()





  - Show 'properties' on data assets





  - Support for AutoML Component
  - Added skip_validation for Job/Component create_or_update



  - Dataset removed from public interface.



  - Fixed mismatch errors when updating scale_settings for KubernetesOnlineDeployment.
  - Removed az CLI command that was printed when deleting OnlineEndpoint





  - Allow Input/Output objects to be used by CommandComponent.
  - Added MoonCake cloud support.
  - Unified inputs/outputs building and validation logic in BaseNode.
  - Allow Git repo URLs to be used as code for jobs and components.
  - Updated AutoML YAML schema to use InputSchema.
  - Added end_time to job schedule.
  - MIR and pipeline job now support registry assets.



  - Have mldesigner use argparser to parse incoming args.
  - Bumped pyjwt version to <3.0.0.
  - Reverted "upload support for symlinks".
  - Error message improvement when a YAML UnionField fails to match.
  - Reintroduced support for symlinks when uploading.
  - Hard coded registry base URL to eastus region to support preview.







  - First preview.


pkgId: 66b17a1eb8ab5eed350bee1e72568096b2157230a3053133c2d3fa48d8d10b36
name: python-azure-ai-ml
arch: src
version: 1.22.1
epoch: 0
release: 1
summary: Microsoft Azure Machine Learning Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-ml-1.22.1-1.src.rpm
checksum_type: sha256
description:
  We are excited to introduce the GA of Azure Machine Learning Python SDK v2. The Python SDK v2 introduces new SDK capabilities like standalone local jobs, reusable components for pipelines and managed online/batch inferencing. Python SDK v2 allows you to move from simple to complex tasks easily and incrementally. This is enabled by using a common object model which brings concept reuse and consistency of actions across various tasks. The SDK v2 shares its foundation with the CLI v2 which is also GA.

  [Source code][source_code]
  | [Package (PyPI)][ml_pypi]
  | [Package (Conda)][ml_conda]
  | [API reference documentation][ml_ref_docs]
  | [Product documentation][product_documentation]
  | [Samples][ml_samples]


  This package has been tested with Python 3.8, 3.9, 3.10, 3.11 and 3.12.

  For a more complete set of Azure libraries, see https://aka.ms/azsdk/python/all





  - Python 3.7 or later is required to use this package.
  - You must have an [Azure subscription][azure_subscription].
  - An [Azure Machine Learning Workspace][workspace].



  Install the Azure ML client library for Python with [pip][pip_link]:

  ```bash
  pip install azure-ai-ml
  pip install azure-identity
  ```



  ```python
  from azure.ai.ml import MLClient
  from azure.identity import DefaultAzureCredential

  ml_client = MLClient(
      DefaultAzureCredential(), subscription_id, resource_group, workspace
  )
  ```



  Azure Machine Learning Python SDK v2 comes with many new features like standalone local jobs, reusable components for pipelines and managed online/batch inferencing. The SDK v2 brings consistency and ease of use across all assets of the platform. The Python SDK v2 offers the following capabilities:
  * Run **Standalone Jobs** - run a discrete ML activity as Job. This job can be run locally or on the cloud. We currently support the following types of jobs:
    * Command - run a command (Python, R, Windows Command, Linux Shell etc.)
    * Sweep - run a hyperparameter sweep on your Command
  * Run multiple jobs using our **improved Pipelines**
    * Run a series of commands stitched into a pipeline (**New**)
    * **Components** - run pipelines using reusable components (**New**)
  * Use your models for **Managed Online inferencing** (**New**)
  * Use your models for Managed **batch inferencing**
  * Manage AML resources – workspace, compute, datastores
  * Manage AML assets - Datasets, environments, models
  * **AutoML** - run standalone AutoML training for various ml-tasks:
    - Classification (Tabular data)
    - Regression (Tabular data)
    - Time Series Forecasting (Tabular data)
    - Image Classification (Multi-class) (**New**)
    - Image Classification (Multi-label) (**New**)
    - Image Object Detection (**New**)
    - Image Instance Segmentation (**New**)
    - NLP Text Classification (Multi-class) (**New**)
    - NLP Text Classification (Multi-label) (**New**)
    - NLP Text Named Entity Recognition (NER) (**New**)



  - View our [samples][ml_samples].





  Azure ML clients raise exceptions defined in [Azure Core][azure_core_readme].

  ```python
  from azure.core.exceptions import HttpResponseError

  try:
      ml_client.compute.get("cpu-cluster")
  except HttpResponseError as error:
      print("Request failed: {}".format(error.message))
  ```



  This library uses the standard
  [logging][python_logging] library for logging.
  Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
  level.

  Detailed DEBUG level logging, including request/response bodies and unredacted
  headers, can be enabled on a client with the `logging_enable` argument.

  See full SDK logging documentation with examples [here][sdk_logging_docs].



  The Azure ML Python SDK includes a telemetry feature that collects usage and failure data about the SDK and sends it to Microsoft when you use the SDK in a Jupyter Notebook only.
  <u>Telemetry will **not** be collected for any use of the Python SDK outside of a Jupyter Notebook.</u>

  Telemetry data helps the SDK team understand how the SDK is used so it can be improved and the information about failures helps the team resolve problems and fix bugs.
  The SDK telemetry feature is enabled by default for Jupyter Notebook usage and cannot be enabled for non-Jupyter scenarios. To opt out of the telemetry feature in a Jupyter scenario, pass in `enable_telemetry=False` when constructing your MLClient object.



  - View our [samples][ml_samples].



  This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.

  <!-- LINKS -->

  [source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ml/azure-ai-ml
  [ml_pypi]: https://pypi.org/project/azure-ai-ml/
  [ml_conda]: https://anaconda.org/microsoft/azure-ai-ml/
  [ml_ref_docs]: https://learn.microsoft.com/python/api/azure-ai-ml/?view=azure-python
  [ml_samples]: https://github.com/Azure/azureml-examples/tree/main/sdk/python
  [product_documentation]: https://docs.microsoft.com/azure/machine-learning/
  [azure_subscription]: https://azure.microsoft.com/free/
  [workspace]: https://docs.microsoft.com/azure/machine-learning/concept-workspace
  [python_logging]: https://docs.python.org/3/library/logging.html
  [sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/azure-sdk-logging
  [azure_core_readme]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [pip_link]: https://pypi.org/project/pip/
  [azure_core_ref_docs]: https://aka.ms/azsdk-python-core-policies
  [azure_core]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity
  [cla]: https://cla.microsoft.com
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
  [coc_contact]: mailto:opencode@microsoft.com







    - **#38493** - Fix error NoneType object is not subscriptable




    - Update TLS version from 1.0 to 1.2
    - Added support for Distillation jobs. Can be created by importing `disillation` from `azure.ai.ml.model_customization`

    - Fix send email notification issue in model monitoring







  - **#37857** - Fix online deployment registry issue






  - Cross subscription storage account support for workspace and feature store. Developer can provide a storage account from another subscription while creating a workspace or storage account.



  - #35820 - using compute location attribute to fill compute location to align the experience with UI.





  - When a workspace is created with `managed_network` enabled or has `public_network_access` set to disabled, the resources created with the workspace (Key Vault, Storage Account) will be set to have restricted network access settings. This is only applicable when the user does not specify existing resources.
  - Added support of `fqdns` property for managed network `PrivateEndpointDestination` outbound rule objects. Enabling the support of Application Gateway as a Private Endpoint target in the workspace managed network.
  - Added support of `address_prefixes` property for managed network `ServiceTagDestination` outbound rule objects.
  - Removed experimental tag from `managed_network` which is a GA feature.





  - Added enable_sso operation under compute operation that will allow user to enable sso setting of a compute instance without any write permission set on compute.



  - Workspace update no longer broken for older workspaces due to deprecated tags.
  - Support credential-less fileshare datastore





  - Expose `public_ip_address` in `AmlComputeNodeInfo`, to get the public ip address with the ssh port when calling `ml_client.compute.list_nodes`
  - Uploads to account key access datastores will be authorized via a SAS token retrieved from a call to `DatastoreOperations._list_secrets`. Key-based authentication for uploads for such datastores is no longer used. Identity-based datastores will use user identity authentication retrieved from the MLClient.
  - Support `update_sso_settings` in `ComputeOperations`, to enable or disable single sign-on settings of a compute instance.



  - InputTypes exported in constants module
  - WorkspaceConnection tags are now listed as deprecated, and the erroneously-deprecated metadata field has been un-deprecated and added as a initialization field. These two fields still point to the same underlying object property, and actual API usage of this value is unchanged.
  - Workspace Create operation works without an application insights being provided, and creates a default appIn resource for normal workspaces in that case.
  - Project create operations works in general.



  - WorkspaceConnections are officially GA'd and no longer experimental. But its much newer subclasses remain experimental.





  - Workspace Create operation works without an application insights being provided, and creates a default appIn resource for normal workspaces in that case.
  - Project create operations works in general.







  - Add experimental support for working with Promptflow evaluators: `ml_client.evaluators`.
  - Many changes to the Connection entity class and its associated operations.
  - Workspace Connection `list`, `get`, and `create_or_update` operations now include an optional `populate_secrets` input, which causes the operations to try making a secondary call to fill in the returned connections' credential info if possible. Only works with api key-based credentials for now.
  - Many workspace connection subtypes added. The full list of subclasses is now:
    - `AzureBlobStoreConnection`
    - `AzureBlobStoreConnection`
    - `MicrosoftOneLakeConnection`
    - `AzureOpenAIConnection`
    - `AzureAIServicesConnection`
    - `AzureAISearchConnection`
    - `AzureContentSafetyConnection`
    - `AzureSpeechServicesConnection`
    - `APIKeyConnection`
    - `OpenAIConnection`
    - `SerpConnection`
    - `ServerlessConnection`
  - Many workspace connections only accept api keys or entra ids for credentials. Since Entra IDs require not inputs, these have been refactored to not required a full credential object. Instead they only accept an api_key as a top-level input, and default to an entra credential otherwise. Their YAML schemas have been similarly altered.
  - Client-side credential-type validation added for some workspace connection types.
  - Added new credential type: `AadCredentialConfiguration`
  - Renamed WorkspaceHub class as Hub.
  - Added Project entity class and YAML support.
  - Project and Hub operations supported by workspace operations.
  - workspace list operation supports type filtering.
  - Add support for Microsoft Entra token (`aad_token`) auth in `invoke` and `get-credentials` operations.
  - Add experimental support for working with indexes: `ml_client.indexes`





  - Removed WorkspaceHubConfig entity, and renamed WorkspaceHub to Hub.
  - workspace_hub input of Workspace class hidden, renamed to hub_id, and re-surfaced in child class Project.
  - Removed Workspace Hub Operations from ML Client.







  - The following classes will still be able to be imported from `azure.ai.ml`, but the import is deprecated and emits a warning. Instead, please import them from `azure.ai.ml.entities`.
    - `AmlTokenConfiguration`
    - `ManagedIdentityConfiguration`
    - `UserIdentityConfiguration`
  - The following classes will still be able to be imported from `azure.ai.ml.entities`, but the import is deprecated and emits a warning. Instead, please import them from `azure.ai.ml.sweep`.
    - `Choice`
    - `Uniform`
    - `LogUniform`
    - `QLogUniform`
    - `QUniform`
    - `QLogNormal`
    - `QNormal`
    - `LogNormal`
    - `Normal`
    - `Randint`





  - Remove `experimental` tag for  `ml_client.jobs.validate`.
  - Workspace Connection has new read-only subclass: AzureBlobStoreWorkspaceConnectionSchema.
  - Workspace Connection supports 2 new types under main class: gen 2 and azure_one_lake.
  - Workspace Connection LIST operation can return data connections via new optional flag: include_data_connections.
  - Support `ml_client.schedules.trigger(name='my_schedule')` function to trigger a schedule once.



  - Fix pipeline job `outputs` not load correctly when `component: <local-file>` exists in pipeline job yaml.
  - Workspace ListKey operation serialization issue fixed.
  - Workspace Diagnose result now can be print in to Json format.





  - Support for Python 3.12















  - Workspace Connections had 3 child classes added for open AI, cog search, and cog service connections.
  - Workspace Connections replaced metadata with tags, and surfaced api_version, api_type, and kind for certain connection types.



  - Workspace Hubs now properly create various endpoints, and surface a variable to select the resource they connect to via the
    'endpoint_resource_id' kwarg.









  - pydash dependency version was upgraded to >=6.0.0 to patch [security vulnerability in versions below 6.0.0](https://github.com/advisories/GHSA-8mjr-6c96-39w8)
  - Workspace hub deletion no longer fails if delete_dependent_resources is true.





  - Now, when you specify `delete_dependent_resources` as True when deleting a workspace, the log analytics resource
    associated with the workspace application insights resource will also be deleted.
  - Now, when creating or updating a workspace, you can provide a `serverless_compute` configuration object. This allows configuring a custom subnet in which all Serverless computes will be created. You can also specify whether or not these Serverless computes will have public IP addresses or not.



  - [Python 3.7 reached end-of-life on June 27th 2023](https://devguide.python.org/versions/). Consequently, 3.7 will be deprecated in azure-ai-ml starting in October 2023 and azure-ai-ml will end support for 3.7 in February 2024.





  - Feature sets can now be registers after being dumped and reloaded.
  - SDK feature store create/update can now assign materialization identities to cross RG offline stores and online stores.





  - Added support of features that are known into the future/at forecast time for dnn in AutoML Forecasting jobs.
  - Added support for new workspace connection types: azure_open_ai, cognitive_search, and cognitive_service.
  - Added support for new credential type: ApiKeyConfiguration.
  - Added support of `download` for component operations.



  - Local job runs will no longer fail if Docker registry has no username/password
  - Fixed an issue that code asset doesn't work with relative symbol links.
  - Fixed [Issue 31319](https://github.com/Azure/azure-sdk-for-python/issues/31319): can't accept `PathLike` for `CommandComponent.code`.



  - `azure-ai-ml` now performs all file i/o on `utf-8` encoded files per Azure SDK guidance.
    (instead of the default behavior for python < 3.15, which uses locale specific encodings)
  - Removed references to deprecated "feature_store" workspace connection type.





  - Added support to enable gpu access (local_enable_gpu) for local deployment.



  - Improved the output when printing a workspace object to be more clean and readable.
  - Log level of unknown field notifications for pipeline nodes raised from INFO to WARNING.





  - Added support to enable set workspace connection secret expiry time.
  - Added support for `stage` on model version



  - Fixed an issue affecting authentication to registry-related services in sovereign regions.
  - Made job_tier and priority values case insensitive





  - Public preview support for new schedule type `MonitorSchedule`





  - Fixed an issue where `OnlineDeployment.provisioning_state` was incorrectly deserialized and set as `None`





  - Added data import schedule. The class added is `ImportDataSchedule`.
  - Added support to enable data isolation feature at workspace creation stage.
  - Added auto_delete_setting support for asset version in data import job.
  - Switched code snapshot upload from directory-based to container-based design in order to allow finer RBAC within workspaces. A container will be created for each new snapshot. This change does not affect storage costs or snapshot functionality.











  - Added experimental scatter gather node to DSL package. This node has a unique mldesigner dependency.
  - Added support to make JobService and ServiceInstance objects serializable when printed
  - Support Singularity compute in pipeline job
  - Added purge operation support for workspace resource
  - Added Feature Store, its dedicated classes and updated the docstrings, now available in public interface. The classes added are `FeatureStoreOperations, FeatureSetOperations, FeatureStoreEntityOperations` with properties classes specific to the new features.
  - Support additional_includes in command component
  - Added experimental `distribution: ray` support in command job.



  - Fixed issue where show_progress=False was not being respected for uploads when set via MLClient
  - Fixed issue of spark input/output mode validation doesn't take effect because of wrong type assertion
  - Fixed the bug when setting `node.limits.timeout` to a pipeline input.
  - Removed Experimental Tag from Idle Shutdown, Custom Applications, Setup Scripts, and Image Metadata on Compute Instances.
  - Removed Experimental Tag from JobService classes



  - Renamed `JobServiceBase.job_service_type` to `type`



  - Remove the default placeholder for CommandComponent.code





  - Added support for `tags` on Compute Resources.
  - Added support for promoting data asset from a workspace to a registry
  - Added support for registering named asset from job output or node output by specifying name and version settings.
  - Added support for data binding on outputs inside dynamic arguments for dsl pipeline
  - Added support for serverless compute in pipeline, command, automl and sweep job
  - Added support for `job_tier` and `priority` in standalone job
  - Added support for passing `locations` via command function and set it to `JobResourceConfiguration.locations`
  - Added support for modifying SSH key values after creation on Compute Resources.
  - Added WorkspaceConnection types `s3`, `snowflake`, `azure_sql_db`, `azure_synapse_analytics`, `azure_my_sql_db`, `azure_postgres_db`
  - Added WorkspaceConnection auth type `access_key` for `s3`
  - Added DataImport class and DataOperations.import_data.
  - Added DataOperations.list_materialization_status - list status of data import jobs that create asset versions via asset name.



  - Fix experiment name wrongly set to 'Default' when schedule existing job.
  - Error message improvement when a local path fails to match with data asset type.
  - Error message improvement when an asset does not exist in a registry
  - Fix an issue when submit spark pipeline job with referring a registered component
  - Fix an issue that prevented Job.download from downloading the output of a BatchJob



  - Added dependency on `azure-mgmt-resource`
  - Added dependency on `azure-mgmt-resourcegraph`
  - Added dependency on `opencensus-ext-azure<2.0.0`
  - Update job types to use MFE Dec preview rest objects.
  - Added classifiers for Python version 3.11.
  - Added warning for reserved keywords in IO names in pipeline job nodes.
  - Added telemetry logging for SDK Jupyter Notebook scenarios with opt-out option (see README.md)





  - Added dedicated classes for each type of job service and updated the docstrings. The classes added are `JupyterLabJobService, SshJobService, TensorBoardJobService, VsCodeJobService` with a few properties specific to the type.
  - Added Custom Applications Support to Compute Instances.
  - Update data asset list, show and create operations to support data assets in registry.
  - Added Managed Network features to workspace to include `ManagedNetwork`, `FqdnDestination`, `PrivateEndpointDestination`, `ServiceTagDestination` as well as relevant schema.



  - Fixed an issue where the ordering of `.amlignore` and `.gitignore` files are not respected.
  - Fixed an issue that attributes with a value of `False` in `PipelineJobSettings` are not respected.
  - Fixed an issue where ignore files weren't considered during upload directory size calculations.
  - Fixed an issue where symlinks crashed upload directory size calculations.
  - Fixes a bug where enable_node_public_ip returned an improper value when fetching a Compute.



  - Update workspace creation to use Log Analytics-Based Application Insights when the user does not specify/bring their own App Insights.
  - Upgraded minimum azure-core version to 1.23.0.





  - Change print behavior of entity classes to show object yaml in notebooks, can be configured on in other contexts.
  - Added property to enable/disable public ip addresses to Compute Instances and AML Computes.
  - `Deployment` and `ScheduleOperations` added to public interface.



  - Fixed issue with date-time format for utc_time_created field when creating models.
  - Added stricter behavior for ArmStr schemas when parsing 'azureml:' prefix.
  - Fixed issue where AmlComputes could only be created in a workspace's default region.
  - Improved intellisense with VS Code for fields supporting local paths and datastores.
  - Added validation for token generation with aml scope when user_identity is used in job definition aka OBO flow.
  - Fixed duplicate node name error in pipeline when two node names assigned to the same node and get renamed by node.name='xx'.
  - Resolve the cross references for MLClient, Resource and OnlineDeployment.
  - Explicit use of Optional (or a Union with None), as per PEP 484.
  - Fixed print on Command objects when job id is empty
  - Fixed issue where `SasTokenConfiguration` cannot be used as credential for `WorkspaceConnection`



  - Removed dependency on API version 2021-10-01 and 2022-06-01-preview to reduce side of azure-ai-ml package.





  - Removed description from Registry.
  - Disable sdk telemetry logging



  - Enable updating the CMK encryption key (workspace.encryption.keyVaultProperties.keyIdentifier) for a workspace.
  - Mark JobService class and services param to command() as experimental.
  - Added a replication_count value to the schema of SystemCreatedStorageAccount in Registry.
  - Added support for Fairfax and MoonCake cloud for the registry discovery baseurl.
  - Added support for variable args as pipeline input in DSL Pipeline.
  - Added OS Patching Parameters to Compute Instance.



  - Update the upper bound dependencies version for tqdm, strictyaml, colorama and opencensus-ext-azure.
  - Added missing "properties" to batch deployment.
  - Retain the cases for the names of system job services (Tracking and Studio).
  - Update registry begin_delete method return type.
  - Fixed sweep job optional input cannot be empty.
  - Fixed bool test for output in download operation.
  - Fixed Compute Instance schedule not being created
  - Removed erroneous experimental warning from Compute Schedules





  - Restored idle_time_before_shutdown property for Compute Instances.
  - Deprecated idle_time_before_shutdown property in favor of idle_time_before_shutdown_minutes.



  - Fixed idle_time_before_shutdown appearing as None for Compute Instances returned by `show` or `list`.
  - Fixed idle_time_before_shutdown_minutes preventing creation of Compute Instances when set to None.





  - Renamed idle_time_before_shutdown to idle_time_before_shutdown_minutes and changed input type to int.



  - Fixed idle_time_before_shutdown_minutes not appearing in GET calls for Compute Instances.





  - Registry list operation now accepts scope value to allow subscription-only based requests.
  - Most configuration classes from the entity package now implement the standard mapping protocol.
  - Add registry delete operation.
  - The values of JobService.job_service_type are now using the snake case. e.g jupyter_lab, ssh, tensor_board, vs_code.
  - Command function now accepts services param of type Dict[str, JobService] instead of dict.



  - MLClient.from_config can now find the default config.json on Compute Instance when running sample notebooks.
  - Fixed job inputs not accepting datastores or job inputs.
  - Registries now assign managed tags to match registry's tags.
  - Adjust registry experimental tags and imports to avoid warning printouts for unrelated operations.
  - Make registry delete operation return an LROPoller, and change name to begin_delete.
  - Prevent registering an already existing environment that references conda file.
  - Fix ARM ID logic for registry environments (ex: Creating a registry component that references a registry environment).
  - Fix ARM ID logic for passing models and environments with ID (ex: Creating endpoint deployment for a registry model should return said model's ID immediately)



  - Switched compute operations to go through 2022-10-01-preview API version.



  - GA release
  - Dropped support for Python 3.6. The Python versions supported for this release are 3.7-3.10.





  - OnlineDeploymentOperations.delete has been renamed to begin_delete.
  - Datastore credentials are switched to use unified credential configuration classes.
  - UserAssignedIdentity is replaced by ManagedIdentityConfiguration
  - Endpoint and Job use unified identity classes.
  - Workspace ManagedServiceIdentity has been replaced by IdentityConfiguration.



  - Switched Compute operations to use Oct preview API version.
  - Updated batch deployment/endpoint invoke and list-jobs function signatures with curated BatchJob class.





  - Support passing JobService as argument to Command()
  - Added support for custom setup scripts on compute instances.
  - Added a `show_progress` parameter to MLClient for enable/disable progress bars of long running operations.
  - Support `month_days` in `RecurrencePattern` when using `RecurrenceSchedule`.
  - Support `ml_client.schedules.list` with `list_view_type`, default to `ENABLED_ONLY`.
  - Add support for model sweeping and hyperparameter tuning in AutoML NLP jobs.
  - Added `ml_client.jobs.show_services()` operation.



  - ComputeOperations.attach has been renamed to begin_attach.
  - Deprecated parameter path has been removed from load and dump methods.
  - JobOperations.cancel() is renamed to JobOperations.begin_cancel() and it returns LROPoller
  - Workspace.list_keys renamed to Workspace.get_keys.



  - Fix identity passthrough job with single file code
  - MLClient.from_config can now find the default config.json on Compute Instance when running sample notebooks.



  - Removed declaration on Python 3.6 support
  - Added support for custom setup scripts on compute instances.
  - Updated dependencies upper bounds to be major versions.





  - Spark job submission.
  - Command and sweep job docker config (shmSize and dockerArgs) spec support.
  - Entity load and dump now also accept a file pointer as input.
  - Load and dump input names changed from path to 'source' and 'dest', respectively.
  - Load and dump 'path' input still works, but is deprecated and emits a warning.
  - Managed Identity Support for Compute Instance (experimental).
  - Enable using @dsl.pipeline without brackets when no additional parameters.
  - Expose Azure subscription Id and resource group name from MLClient objects.
  - Added Idle Shutdown support for Compute Instances, allowing instances to shutdown after a set period of inactivity.
  - Online Deployment Data Collection for eventhub and data storage will be supported.
  - Syntax validation on scoring scripts of Batch Deployment and Online Deployment will prevent the user from submitting bad deployments.



  - Change (begin_)create_or_update typehints to use generics.
  - Remove invalid option from create_or_update typehints.
  - Change error returned by (begin_)create_or_update invalid input to TypeError.
  - Rename set_image_model APIs for all vision tasks to set_training_parameters
  - JobOperations.download defaults to "." instead of Path.cwd()





  - Show 'properties' on data assets





  - Support for AutoML Component
  - Added skip_validation for Job/Component create_or_update



  - Dataset removed from public interface.



  - Fixed mismatch errors when updating scale_settings for KubernetesOnlineDeployment.
  - Removed az CLI command that was printed when deleting OnlineEndpoint





  - Allow Input/Output objects to be used by CommandComponent.
  - Added MoonCake cloud support.
  - Unified inputs/outputs building and validation logic in BaseNode.
  - Allow Git repo URLs to be used as code for jobs and components.
  - Updated AutoML YAML schema to use InputSchema.
  - Added end_time to job schedule.
  - MIR and pipeline job now support registry assets.



  - Have mldesigner use argparser to parse incoming args.
  - Bumped pyjwt version to <3.0.0.
  - Reverted "upload support for symlinks".
  - Error message improvement when a YAML UnionField fails to match.
  - Reintroduced support for symlinks when uploading.
  - Hard coded registry base URL to eastus region to support preview.







  - First preview.


pkgId: 7db020c0f00d3fe1117e6ae80488fec89edb2fc7aedfb99b1e400d0cfed5ee37
name: python-azure-ai-ml
arch: src
version: 1.22.2
epoch: 0
release: 1
summary: Microsoft Azure Machine Learning Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-ml-1.22.2-1.src.rpm
checksum_type: sha256
description:
  We are excited to introduce the GA of Azure Machine Learning Python SDK v2. The Python SDK v2 introduces new SDK capabilities like standalone local jobs, reusable components for pipelines and managed online/batch inferencing. Python SDK v2 allows you to move from simple to complex tasks easily and incrementally. This is enabled by using a common object model which brings concept reuse and consistency of actions across various tasks. The SDK v2 shares its foundation with the CLI v2 which is also GA.

  [Source code][source_code]
  | [Package (PyPI)][ml_pypi]
  | [Package (Conda)][ml_conda]
  | [API reference documentation][ml_ref_docs]
  | [Product documentation][product_documentation]
  | [Samples][ml_samples]


  This package has been tested with Python 3.8, 3.9, 3.10, 3.11 and 3.12.

  For a more complete set of Azure libraries, see https://aka.ms/azsdk/python/all





  - Python 3.7 or later is required to use this package.
  - You must have an [Azure subscription][azure_subscription].
  - An [Azure Machine Learning Workspace][workspace].



  Install the Azure ML client library for Python with [pip][pip_link]:

  ```bash
  pip install azure-ai-ml
  pip install azure-identity
  ```



  ```python
  from azure.ai.ml import MLClient
  from azure.identity import DefaultAzureCredential

  ml_client = MLClient(
      DefaultAzureCredential(), subscription_id, resource_group, workspace
  )
  ```



  Azure Machine Learning Python SDK v2 comes with many new features like standalone local jobs, reusable components for pipelines and managed online/batch inferencing. The SDK v2 brings consistency and ease of use across all assets of the platform. The Python SDK v2 offers the following capabilities:
  * Run **Standalone Jobs** - run a discrete ML activity as Job. This job can be run locally or on the cloud. We currently support the following types of jobs:
    * Command - run a command (Python, R, Windows Command, Linux Shell etc.)
    * Sweep - run a hyperparameter sweep on your Command
  * Run multiple jobs using our **improved Pipelines**
    * Run a series of commands stitched into a pipeline (**New**)
    * **Components** - run pipelines using reusable components (**New**)
  * Use your models for **Managed Online inferencing** (**New**)
  * Use your models for Managed **batch inferencing**
  * Manage AML resources – workspace, compute, datastores
  * Manage AML assets - Datasets, environments, models
  * **AutoML** - run standalone AutoML training for various ml-tasks:
    - Classification (Tabular data)
    - Regression (Tabular data)
    - Time Series Forecasting (Tabular data)
    - Image Classification (Multi-class) (**New**)
    - Image Classification (Multi-label) (**New**)
    - Image Object Detection (**New**)
    - Image Instance Segmentation (**New**)
    - NLP Text Classification (Multi-class) (**New**)
    - NLP Text Classification (Multi-label) (**New**)
    - NLP Text Named Entity Recognition (NER) (**New**)



  - View our [samples][ml_samples].





  Azure ML clients raise exceptions defined in [Azure Core][azure_core_readme].

  ```python
  from azure.core.exceptions import HttpResponseError

  try:
      ml_client.compute.get("cpu-cluster")
  except HttpResponseError as error:
      print("Request failed: {}".format(error.message))
  ```



  This library uses the standard
  [logging][python_logging] library for logging.
  Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
  level.

  Detailed DEBUG level logging, including request/response bodies and unredacted
  headers, can be enabled on a client with the `logging_enable` argument.

  See full SDK logging documentation with examples [here][sdk_logging_docs].



  The Azure ML Python SDK includes a telemetry feature that collects usage and failure data about the SDK and sends it to Microsoft when you use the SDK in a Jupyter Notebook only.
  <u>Telemetry will **not** be collected for any use of the Python SDK outside of a Jupyter Notebook.</u>

  Telemetry data helps the SDK team understand how the SDK is used so it can be improved and the information about failures helps the team resolve problems and fix bugs.
  The SDK telemetry feature is enabled by default for Jupyter Notebook usage and cannot be enabled for non-Jupyter scenarios. To opt out of the telemetry feature in a Jupyter scenario, pass in `enable_telemetry=False` when constructing your MLClient object.



  - View our [samples][ml_samples].



  This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.

  <!-- LINKS -->

  [source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ml/azure-ai-ml
  [ml_pypi]: https://pypi.org/project/azure-ai-ml/
  [ml_conda]: https://anaconda.org/microsoft/azure-ai-ml/
  [ml_ref_docs]: https://learn.microsoft.com/python/api/azure-ai-ml/?view=azure-python
  [ml_samples]: https://github.com/Azure/azureml-examples/tree/main/sdk/python
  [product_documentation]: https://docs.microsoft.com/azure/machine-learning/
  [azure_subscription]: https://azure.microsoft.com/free/
  [workspace]: https://docs.microsoft.com/azure/machine-learning/concept-workspace
  [python_logging]: https://docs.python.org/3/library/logging.html
  [sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/azure-sdk-logging
  [azure_core_readme]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [pip_link]: https://pypi.org/project/pip/
  [azure_core_ref_docs]: https://aka.ms/azsdk-python-core-policies
  [azure_core]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity
  [cla]: https://cla.microsoft.com
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
  [coc_contact]: mailto:opencode@microsoft.com







    - **#3620407** - Fix Datastore credentials show up as NoneCredentials




    - **#38493** - Fix error NoneType object is not subscriptable




    - Update TLS version from 1.0 to 1.2
    - Added support for Distillation jobs. Can be created by importing `disillation` from `azure.ai.ml.model_customization`

    - Fix send email notification issue in model monitoring







  - **#37857** - Fix online deployment registry issue






  - Cross subscription storage account support for workspace and feature store. Developer can provide a storage account from another subscription while creating a workspace or storage account.



  - #35820 - using compute location attribute to fill compute location to align the experience with UI.





  - When a workspace is created with `managed_network` enabled or has `public_network_access` set to disabled, the resources created with the workspace (Key Vault, Storage Account) will be set to have restricted network access settings. This is only applicable when the user does not specify existing resources.
  - Added support of `fqdns` property for managed network `PrivateEndpointDestination` outbound rule objects. Enabling the support of Application Gateway as a Private Endpoint target in the workspace managed network.
  - Added support of `address_prefixes` property for managed network `ServiceTagDestination` outbound rule objects.
  - Removed experimental tag from `managed_network` which is a GA feature.





  - Added enable_sso operation under compute operation that will allow user to enable sso setting of a compute instance without any write permission set on compute.



  - Workspace update no longer broken for older workspaces due to deprecated tags.
  - Support credential-less fileshare datastore





  - Expose `public_ip_address` in `AmlComputeNodeInfo`, to get the public ip address with the ssh port when calling `ml_client.compute.list_nodes`
  - Uploads to account key access datastores will be authorized via a SAS token retrieved from a call to `DatastoreOperations._list_secrets`. Key-based authentication for uploads for such datastores is no longer used. Identity-based datastores will use user identity authentication retrieved from the MLClient.
  - Support `update_sso_settings` in `ComputeOperations`, to enable or disable single sign-on settings of a compute instance.



  - InputTypes exported in constants module
  - WorkspaceConnection tags are now listed as deprecated, and the erroneously-deprecated metadata field has been un-deprecated and added as a initialization field. These two fields still point to the same underlying object property, and actual API usage of this value is unchanged.
  - Workspace Create operation works without an application insights being provided, and creates a default appIn resource for normal workspaces in that case.
  - Project create operations works in general.



  - WorkspaceConnections are officially GA'd and no longer experimental. But its much newer subclasses remain experimental.





  - Workspace Create operation works without an application insights being provided, and creates a default appIn resource for normal workspaces in that case.
  - Project create operations works in general.







  - Add experimental support for working with Promptflow evaluators: `ml_client.evaluators`.
  - Many changes to the Connection entity class and its associated operations.
  - Workspace Connection `list`, `get`, and `create_or_update` operations now include an optional `populate_secrets` input, which causes the operations to try making a secondary call to fill in the returned connections' credential info if possible. Only works with api key-based credentials for now.
  - Many workspace connection subtypes added. The full list of subclasses is now:
    - `AzureBlobStoreConnection`
    - `AzureBlobStoreConnection`
    - `MicrosoftOneLakeConnection`
    - `AzureOpenAIConnection`
    - `AzureAIServicesConnection`
    - `AzureAISearchConnection`
    - `AzureContentSafetyConnection`
    - `AzureSpeechServicesConnection`
    - `APIKeyConnection`
    - `OpenAIConnection`
    - `SerpConnection`
    - `ServerlessConnection`
  - Many workspace connections only accept api keys or entra ids for credentials. Since Entra IDs require not inputs, these have been refactored to not required a full credential object. Instead they only accept an api_key as a top-level input, and default to an entra credential otherwise. Their YAML schemas have been similarly altered.
  - Client-side credential-type validation added for some workspace connection types.
  - Added new credential type: `AadCredentialConfiguration`
  - Renamed WorkspaceHub class as Hub.
  - Added Project entity class and YAML support.
  - Project and Hub operations supported by workspace operations.
  - workspace list operation supports type filtering.
  - Add support for Microsoft Entra token (`aad_token`) auth in `invoke` and `get-credentials` operations.
  - Add experimental support for working with indexes: `ml_client.indexes`





  - Removed WorkspaceHubConfig entity, and renamed WorkspaceHub to Hub.
  - workspace_hub input of Workspace class hidden, renamed to hub_id, and re-surfaced in child class Project.
  - Removed Workspace Hub Operations from ML Client.







  - The following classes will still be able to be imported from `azure.ai.ml`, but the import is deprecated and emits a warning. Instead, please import them from `azure.ai.ml.entities`.
    - `AmlTokenConfiguration`
    - `ManagedIdentityConfiguration`
    - `UserIdentityConfiguration`
  - The following classes will still be able to be imported from `azure.ai.ml.entities`, but the import is deprecated and emits a warning. Instead, please import them from `azure.ai.ml.sweep`.
    - `Choice`
    - `Uniform`
    - `LogUniform`
    - `QLogUniform`
    - `QUniform`
    - `QLogNormal`
    - `QNormal`
    - `LogNormal`
    - `Normal`
    - `Randint`





  - Remove `experimental` tag for  `ml_client.jobs.validate`.
  - Workspace Connection has new read-only subclass: AzureBlobStoreWorkspaceConnectionSchema.
  - Workspace Connection supports 2 new types under main class: gen 2 and azure_one_lake.
  - Workspace Connection LIST operation can return data connections via new optional flag: include_data_connections.
  - Support `ml_client.schedules.trigger(name='my_schedule')` function to trigger a schedule once.



  - Fix pipeline job `outputs` not load correctly when `component: <local-file>` exists in pipeline job yaml.
  - Workspace ListKey operation serialization issue fixed.
  - Workspace Diagnose result now can be print in to Json format.





  - Support for Python 3.12















  - Workspace Connections had 3 child classes added for open AI, cog search, and cog service connections.
  - Workspace Connections replaced metadata with tags, and surfaced api_version, api_type, and kind for certain connection types.



  - Workspace Hubs now properly create various endpoints, and surface a variable to select the resource they connect to via the
    'endpoint_resource_id' kwarg.









  - pydash dependency version was upgraded to >=6.0.0 to patch [security vulnerability in versions below 6.0.0](https://github.com/advisories/GHSA-8mjr-6c96-39w8)
  - Workspace hub deletion no longer fails if delete_dependent_resources is true.





  - Now, when you specify `delete_dependent_resources` as True when deleting a workspace, the log analytics resource
    associated with the workspace application insights resource will also be deleted.
  - Now, when creating or updating a workspace, you can provide a `serverless_compute` configuration object. This allows configuring a custom subnet in which all Serverless computes will be created. You can also specify whether or not these Serverless computes will have public IP addresses or not.



  - [Python 3.7 reached end-of-life on June 27th 2023](https://devguide.python.org/versions/). Consequently, 3.7 will be deprecated in azure-ai-ml starting in October 2023 and azure-ai-ml will end support for 3.7 in February 2024.





  - Feature sets can now be registers after being dumped and reloaded.
  - SDK feature store create/update can now assign materialization identities to cross RG offline stores and online stores.





  - Added support of features that are known into the future/at forecast time for dnn in AutoML Forecasting jobs.
  - Added support for new workspace connection types: azure_open_ai, cognitive_search, and cognitive_service.
  - Added support for new credential type: ApiKeyConfiguration.
  - Added support of `download` for component operations.



  - Local job runs will no longer fail if Docker registry has no username/password
  - Fixed an issue that code asset doesn't work with relative symbol links.
  - Fixed [Issue 31319](https://github.com/Azure/azure-sdk-for-python/issues/31319): can't accept `PathLike` for `CommandComponent.code`.



  - `azure-ai-ml` now performs all file i/o on `utf-8` encoded files per Azure SDK guidance.
    (instead of the default behavior for python < 3.15, which uses locale specific encodings)
  - Removed references to deprecated "feature_store" workspace connection type.





  - Added support to enable gpu access (local_enable_gpu) for local deployment.



  - Improved the output when printing a workspace object to be more clean and readable.
  - Log level of unknown field notifications for pipeline nodes raised from INFO to WARNING.





  - Added support to enable set workspace connection secret expiry time.
  - Added support for `stage` on model version



  - Fixed an issue affecting authentication to registry-related services in sovereign regions.
  - Made job_tier and priority values case insensitive





  - Public preview support for new schedule type `MonitorSchedule`





  - Fixed an issue where `OnlineDeployment.provisioning_state` was incorrectly deserialized and set as `None`





  - Added data import schedule. The class added is `ImportDataSchedule`.
  - Added support to enable data isolation feature at workspace creation stage.
  - Added auto_delete_setting support for asset version in data import job.
  - Switched code snapshot upload from directory-based to container-based design in order to allow finer RBAC within workspaces. A container will be created for each new snapshot. This change does not affect storage costs or snapshot functionality.











  - Added experimental scatter gather node to DSL package. This node has a unique mldesigner dependency.
  - Added support to make JobService and ServiceInstance objects serializable when printed
  - Support Singularity compute in pipeline job
  - Added purge operation support for workspace resource
  - Added Feature Store, its dedicated classes and updated the docstrings, now available in public interface. The classes added are `FeatureStoreOperations, FeatureSetOperations, FeatureStoreEntityOperations` with properties classes specific to the new features.
  - Support additional_includes in command component
  - Added experimental `distribution: ray` support in command job.



  - Fixed issue where show_progress=False was not being respected for uploads when set via MLClient
  - Fixed issue of spark input/output mode validation doesn't take effect because of wrong type assertion
  - Fixed the bug when setting `node.limits.timeout` to a pipeline input.
  - Removed Experimental Tag from Idle Shutdown, Custom Applications, Setup Scripts, and Image Metadata on Compute Instances.
  - Removed Experimental Tag from JobService classes



  - Renamed `JobServiceBase.job_service_type` to `type`



  - Remove the default placeholder for CommandComponent.code





  - Added support for `tags` on Compute Resources.
  - Added support for promoting data asset from a workspace to a registry
  - Added support for registering named asset from job output or node output by specifying name and version settings.
  - Added support for data binding on outputs inside dynamic arguments for dsl pipeline
  - Added support for serverless compute in pipeline, command, automl and sweep job
  - Added support for `job_tier` and `priority` in standalone job
  - Added support for passing `locations` via command function and set it to `JobResourceConfiguration.locations`
  - Added support for modifying SSH key values after creation on Compute Resources.
  - Added WorkspaceConnection types `s3`, `snowflake`, `azure_sql_db`, `azure_synapse_analytics`, `azure_my_sql_db`, `azure_postgres_db`
  - Added WorkspaceConnection auth type `access_key` for `s3`
  - Added DataImport class and DataOperations.import_data.
  - Added DataOperations.list_materialization_status - list status of data import jobs that create asset versions via asset name.



  - Fix experiment name wrongly set to 'Default' when schedule existing job.
  - Error message improvement when a local path fails to match with data asset type.
  - Error message improvement when an asset does not exist in a registry
  - Fix an issue when submit spark pipeline job with referring a registered component
  - Fix an issue that prevented Job.download from downloading the output of a BatchJob



  - Added dependency on `azure-mgmt-resource`
  - Added dependency on `azure-mgmt-resourcegraph`
  - Added dependency on `opencensus-ext-azure<2.0.0`
  - Update job types to use MFE Dec preview rest objects.
  - Added classifiers for Python version 3.11.
  - Added warning for reserved keywords in IO names in pipeline job nodes.
  - Added telemetry logging for SDK Jupyter Notebook scenarios with opt-out option (see README.md)





  - Added dedicated classes for each type of job service and updated the docstrings. The classes added are `JupyterLabJobService, SshJobService, TensorBoardJobService, VsCodeJobService` with a few properties specific to the type.
  - Added Custom Applications Support to Compute Instances.
  - Update data asset list, show and create operations to support data assets in registry.
  - Added Managed Network features to workspace to include `ManagedNetwork`, `FqdnDestination`, `PrivateEndpointDestination`, `ServiceTagDestination` as well as relevant schema.



  - Fixed an issue where the ordering of `.amlignore` and `.gitignore` files are not respected.
  - Fixed an issue that attributes with a value of `False` in `PipelineJobSettings` are not respected.
  - Fixed an issue where ignore files weren't considered during upload directory size calculations.
  - Fixed an issue where symlinks crashed upload directory size calculations.
  - Fixes a bug where enable_node_public_ip returned an improper value when fetching a Compute.



  - Update workspace creation to use Log Analytics-Based Application Insights when the user does not specify/bring their own App Insights.
  - Upgraded minimum azure-core version to 1.23.0.





  - Change print behavior of entity classes to show object yaml in notebooks, can be configured on in other contexts.
  - Added property to enable/disable public ip addresses to Compute Instances and AML Computes.
  - `Deployment` and `ScheduleOperations` added to public interface.



  - Fixed issue with date-time format for utc_time_created field when creating models.
  - Added stricter behavior for ArmStr schemas when parsing 'azureml:' prefix.
  - Fixed issue where AmlComputes could only be created in a workspace's default region.
  - Improved intellisense with VS Code for fields supporting local paths and datastores.
  - Added validation for token generation with aml scope when user_identity is used in job definition aka OBO flow.
  - Fixed duplicate node name error in pipeline when two node names assigned to the same node and get renamed by node.name='xx'.
  - Resolve the cross references for MLClient, Resource and OnlineDeployment.
  - Explicit use of Optional (or a Union with None), as per PEP 484.
  - Fixed print on Command objects when job id is empty
  - Fixed issue where `SasTokenConfiguration` cannot be used as credential for `WorkspaceConnection`



  - Removed dependency on API version 2021-10-01 and 2022-06-01-preview to reduce side of azure-ai-ml package.





  - Removed description from Registry.
  - Disable sdk telemetry logging



  - Enable updating the CMK encryption key (workspace.encryption.keyVaultProperties.keyIdentifier) for a workspace.
  - Mark JobService class and services param to command() as experimental.
  - Added a replication_count value to the schema of SystemCreatedStorageAccount in Registry.
  - Added support for Fairfax and MoonCake cloud for the registry discovery baseurl.
  - Added support for variable args as pipeline input in DSL Pipeline.
  - Added OS Patching Parameters to Compute Instance.



  - Update the upper bound dependencies version for tqdm, strictyaml, colorama and opencensus-ext-azure.
  - Added missing "properties" to batch deployment.
  - Retain the cases for the names of system job services (Tracking and Studio).
  - Update registry begin_delete method return type.
  - Fixed sweep job optional input cannot be empty.
  - Fixed bool test for output in download operation.
  - Fixed Compute Instance schedule not being created
  - Removed erroneous experimental warning from Compute Schedules





  - Restored idle_time_before_shutdown property for Compute Instances.
  - Deprecated idle_time_before_shutdown property in favor of idle_time_before_shutdown_minutes.



  - Fixed idle_time_before_shutdown appearing as None for Compute Instances returned by `show` or `list`.
  - Fixed idle_time_before_shutdown_minutes preventing creation of Compute Instances when set to None.





  - Renamed idle_time_before_shutdown to idle_time_before_shutdown_minutes and changed input type to int.



  - Fixed idle_time_before_shutdown_minutes not appearing in GET calls for Compute Instances.





  - Registry list operation now accepts scope value to allow subscription-only based requests.
  - Most configuration classes from the entity package now implement the standard mapping protocol.
  - Add registry delete operation.
  - The values of JobService.job_service_type are now using the snake case. e.g jupyter_lab, ssh, tensor_board, vs_code.
  - Command function now accepts services param of type Dict[str, JobService] instead of dict.



  - MLClient.from_config can now find the default config.json on Compute Instance when running sample notebooks.
  - Fixed job inputs not accepting datastores or job inputs.
  - Registries now assign managed tags to match registry's tags.
  - Adjust registry experimental tags and imports to avoid warning printouts for unrelated operations.
  - Make registry delete operation return an LROPoller, and change name to begin_delete.
  - Prevent registering an already existing environment that references conda file.
  - Fix ARM ID logic for registry environments (ex: Creating a registry component that references a registry environment).
  - Fix ARM ID logic for passing models and environments with ID (ex: Creating endpoint deployment for a registry model should return said model's ID immediately)



  - Switched compute operations to go through 2022-10-01-preview API version.



  - GA release
  - Dropped support for Python 3.6. The Python versions supported for this release are 3.7-3.10.





  - OnlineDeploymentOperations.delete has been renamed to begin_delete.
  - Datastore credentials are switched to use unified credential configuration classes.
  - UserAssignedIdentity is replaced by ManagedIdentityConfiguration
  - Endpoint and Job use unified identity classes.
  - Workspace ManagedServiceIdentity has been replaced by IdentityConfiguration.



  - Switched Compute operations to use Oct preview API version.
  - Updated batch deployment/endpoint invoke and list-jobs function signatures with curated BatchJob class.





  - Support passing JobService as argument to Command()
  - Added support for custom setup scripts on compute instances.
  - Added a `show_progress` parameter to MLClient for enable/disable progress bars of long running operations.
  - Support `month_days` in `RecurrencePattern` when using `RecurrenceSchedule`.
  - Support `ml_client.schedules.list` with `list_view_type`, default to `ENABLED_ONLY`.
  - Add support for model sweeping and hyperparameter tuning in AutoML NLP jobs.
  - Added `ml_client.jobs.show_services()` operation.



  - ComputeOperations.attach has been renamed to begin_attach.
  - Deprecated parameter path has been removed from load and dump methods.
  - JobOperations.cancel() is renamed to JobOperations.begin_cancel() and it returns LROPoller
  - Workspace.list_keys renamed to Workspace.get_keys.



  - Fix identity passthrough job with single file code
  - MLClient.from_config can now find the default config.json on Compute Instance when running sample notebooks.



  - Removed declaration on Python 3.6 support
  - Added support for custom setup scripts on compute instances.
  - Updated dependencies upper bounds to be major versions.





  - Spark job submission.
  - Command and sweep job docker config (shmSize and dockerArgs) spec support.
  - Entity load and dump now also accept a file pointer as input.
  - Load and dump input names changed from path to 'source' and 'dest', respectively.
  - Load and dump 'path' input still works, but is deprecated and emits a warning.
  - Managed Identity Support for Compute Instance (experimental).
  - Enable using @dsl.pipeline without brackets when no additional parameters.
  - Expose Azure subscription Id and resource group name from MLClient objects.
  - Added Idle Shutdown support for Compute Instances, allowing instances to shutdown after a set period of inactivity.
  - Online Deployment Data Collection for eventhub and data storage will be supported.
  - Syntax validation on scoring scripts of Batch Deployment and Online Deployment will prevent the user from submitting bad deployments.



  - Change (begin_)create_or_update typehints to use generics.
  - Remove invalid option from create_or_update typehints.
  - Change error returned by (begin_)create_or_update invalid input to TypeError.
  - Rename set_image_model APIs for all vision tasks to set_training_parameters
  - JobOperations.download defaults to "." instead of Path.cwd()





  - Show 'properties' on data assets





  - Support for AutoML Component
  - Added skip_validation for Job/Component create_or_update



  - Dataset removed from public interface.



  - Fixed mismatch errors when updating scale_settings for KubernetesOnlineDeployment.
  - Removed az CLI command that was printed when deleting OnlineEndpoint





  - Allow Input/Output objects to be used by CommandComponent.
  - Added MoonCake cloud support.
  - Unified inputs/outputs building and validation logic in BaseNode.
  - Allow Git repo URLs to be used as code for jobs and components.
  - Updated AutoML YAML schema to use InputSchema.
  - Added end_time to job schedule.
  - MIR and pipeline job now support registry assets.



  - Have mldesigner use argparser to parse incoming args.
  - Bumped pyjwt version to <3.0.0.
  - Reverted "upload support for symlinks".
  - Error message improvement when a YAML UnionField fails to match.
  - Reintroduced support for symlinks when uploading.
  - Hard coded registry base URL to eastus region to support preview.







  - First preview.


pkgId: 4faf7cc25754b426f21ca53b5aa3a39b285dcee97a5a4c678fe082b1909ed07a
name: python-azure-ai-nspkg
arch: src
version: 1.0.0
epoch: 0
release: 1
summary: Microsoft Azure ai Namespace Package [Internal]
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-nspkg-1.0.0-1.src.rpm
checksum_type: sha256
description:
  This is the Microsoft Azure ai Services namespace package.

  This package is not intended to be installed directly by the end user.

  Since version 3.0, this is Python 2 package only, Python 3.x SDKs will use `PEP420 <https://www.python.org/dev/peps/pep-0420/>` as namespace package strategy.
  To avoid issues with package servers that does not support `python_requires`, a Python 3 package is installed but is empty.

  It provides the necessary files for other packages to extend the azure.ai namespace.

  If you are looking to install the Azure client libraries, see the
  `azure <https://pypi.python.org/pypi/azure>`__ bundle package.


  ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fsdk%2Ftextanalytics%2Fazure-ai-nspkg%2FREADME.png)


pkgId: 4a45efe5de38938c3336bbe55d324077a422a05f739d6e708e31ceb7dad52c6f
name: python-azure-ai-projects
arch: src
version: 1.0.0b1
epoch: 0
release: 1
summary: Microsoft Azure AI Projects Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-projects
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-projects-1.0.0b1-1.src.rpm
checksum_type: sha256
description:
  Use the AI Projects client library (in preview) to:

  * **Enumerate connections** in your Azure AI Studio project and get connection properties.
  For example, get the inference endpoint URL and credentials associated with your Azure OpenAI connection.
  * **Get an authenticated Inference client** to do chat completions, for the default Azure OpenAI or AI Services connections in your Azure AI Studio project. Supports the AzureOpenAI client from the `openai` package, or clients from the `azure-ai-inference` package.
  * **Develop Agents using the Azure AI Agent Service**, leveraging an extensive ecosystem of models, tools, and capabilities from OpenAI, Microsoft, and other LLM providers. The Azure AI Agent Service enables the building of Agents for a wide range of generative AI use cases. The package is currently in private preview.
  * **Run Evaluations** to assess the performance of generative AI applications using various evaluators and metrics. It includes built-in evaluators for quality, risk, and safety, and allows custom evaluators for specific needs.
  * **Enable OpenTelemetry tracing**.

  [Product documentation](https://aka.ms/azsdk/azure-ai-projects/product-doc)
  | [Samples][samples]
  | [API reference documentation](https://aka.ms/azsdk/azure-ai-projects/python/reference)
  | [Package (PyPI)](https://aka.ms/azsdk/azure-ai-projects/python/package)
  | [SDK source code](https://aka.ms/azsdk/azure-ai-projects/python/code)
  | [AI Starter Template](https://aka.ms/azsdk/azure-ai-projects/python/ai-starter-template)



  - [Getting started](#getting-started)
    - [Prerequisite](#prerequisite)
    - [Install the package](#install-the-package)
  - [Key concepts](#key-concepts)
    - [Create and authenticate the client](#create-and-authenticate-the-client)
  - [Examples](#examples)
    - [Enumerate connections](#enumerate-connections)
      - [Get properties of all connections](#get-properties-of-all-connections)
      - [Get properties of all connections of a particular type](#get-properties-of-all-connections-of-a-particular-type)
      - [Get properties of a default connection](#get-properties-of-a-default-connection)
      - [Get properties of a connection by its connection name](#get-properties-of-a-connection-by-its-connection-name)
    - [Get an authenticated ChatCompletionsClient](#get-an-authenticated-chatcompletionsclient)
    - [Get an authenticated AzureOpenAI client](#get-an-authenticated-azureopenai-client)
    - [Agents (Private Preview)](#agents-private-preview)
      - [Create an Agent](#create-agent) with:
        - [File Search](#create-agent-with-file-search)
        - [Code interpreter](#create-agent-with-code-interpreter)
        - [Bing grounding](#create-agent-with-bing-grounding)
        - [Azure AI Search](#create-agent-with-azure-ai-search)
        - [Function call](#create-agent-with-function-call)
      - [Create thread](#create-thread) with
        - [Tool resource](#create-thread-with-tool-resource)
      - [Create message](#create-message) with:
        - [File search attachment](#create-message-with-file-search-attachment)
        - [Code interpreter attachment](#create-message-with-code-interpreter-attachment)
      - [Execute Run, Run_and_Process, or Stream](#create-run-run_and_process-or-stream)
      - [Retrieve message](#retrieve-message)
      - [Retrieve file](#retrieve-file)
      - [Tear down by deleting resource](#teardown)
      - [Tracing](#tracing)
    - [Evaluation](#evaluation)
      - [Evaluator](#evaluator)
      - [Run Evaluation in the cloud](#run-evaluation-in-the-cloud)
        - [Evaluators](#evaluators)
        - [Data to be evaluated](#data-to-be-evaluated)
          - [[Optional] Azure OpenAI Model](#optional-azure-openai-model)
          - [Example Remote Evaluation](#example-remote-evaluation)
    - [Tracing](#tracing)
      - [Installation](#installation)
      - [Tracing example](#tracing-example)
  - [Troubleshooting](#troubleshooting)
    - [Exceptions](#exceptions)
    - [Logging](#logging)
    - [Reporting issues](#reporting-issues)
  - [Next steps](#next-steps)
  - [Contributing](#contributing)





  - Python 3.8 or later.
  - An [Azure subscription][azure_sub].
  - A [project in Azure AI Studio](https://learn.microsoft.com/azure/ai-studio/how-to/create-projects?tabs=ai-studio).
  - The project connection string. It can be found in your Azure AI Studio project overview page, under "Project details". Below we will assume the environment variable `PROJECT_CONNECTION_STRING` was defined to hold this value.
  - Entra ID is needed to authenticate the client. Your application needs an object that implements the [TokenCredential](https://learn.microsoft.com/python/api/azure-core/azure.core.credentials.tokencredential) interface. Code samples here use [DefaultAzureCredential](https://learn.microsoft.com/python/api/azure-identity/azure.identity.defaultazurecredential). To get that working, you will need:
    * The `Contributor` role. Role assigned can be done via the "Access Control (IAM)" tab of your Azure AI Project resource in the Azure portal.
    * [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli) installed.
    * You are logged into your Azure account by running `az login`.
    * Note that if you have multiple Azure subscriptions, the subscription that contains your Azure AI Project resource must be your default subscription. Run `az account list --output table` to list all your subscription and see which one is the default. Run `az account set --subscription "Your Subscription ID or Name"` to change your default subscription.



  ```bash
  pip install azure-ai-projects
  ```





  The class factory method `from_connection_string` is used to construct the client. To construct a synchronous client:

  ```python
  import os
  from azure.ai.projects import AIProjectClient
  from azure.identity import DefaultAzureCredential

  project_client = AIProjectClient.from_connection_string(
      credential=DefaultAzureCredential(),
      conn_str=os.environ["PROJECT_CONNECTION_STRING"],
  )
  ```

  To construct an asynchronous client, Install the additional package [aiohttp](https://pypi.org/project/aiohttp/):

  ```bash
  pip install aiohttp
  ```

  and update the code above to import `asyncio`, and import `AIProjectClient` from the `azure.ai.projects.aio` namespace:

  ```python
  import os
  import asyncio
  from azure.ai.projects.aio import AIProjectClient
  from azure.core.credentials import AzureKeyCredential

  project_client = AIProjectClient.from_connection_string(
      credential=DefaultAzureCredential(),
      conn_str=os.environ["PROJECT_CONNECTION_STRING"],
  )
  ```





  Your Azure AI Studio project has a "Management center". When you enter it, you will see a tab named "Connected resources" under your project. The `.connections` operations on the client allow you to enumerate the connections and get connection properties. Connection properties include the resource URL and authentication credentials, among other things.

  Below are code examples of the connection operations. Full samples can be found under the "connetions" folder in the [package samples][samples].



  To list the properties of all the connections in the Azure AI Studio project:

  ```python
  connections = project_client.connections.list()
  for connection in connections:
      print(connection)
  ```



  To list the properties of connections of a certain type (here Azure OpenAI):

  ```python
  connections = project_client.connections.list(
      connection_type=ConnectionType.AZURE_OPEN_AI,
  )
  for connection in connections:
      print(connection)

  ```



  To get the properties of the default connection of a certain type (here Azure OpenAI),
  with its authentication credentials:

  ```python
  connection = project_client.connections.get_default(
      connection_type=ConnectionType.AZURE_OPEN_AI,
      include_credentials=True,  # Optional. Defaults to "False".
  )
  print(connection)
  ```

  If the call was made with `include_credentials=True`, depending on the value of `connection.authentication_type`, either `connection.key` or `connection.token_credential`
  will be populated. Otherwise both will be `None`.



  To get the connection properties of a connection named `connection_name`:

  ```python
  connection = project_client.connections.get(
      connection_name=connection_name,
      include_credentials=True  # Optional. Defaults to "False"
  )
  print(connection)
  ```



  Your Azure AI Studio project may have one or more AI models deployed that support chat completions. These could be OpenAI models, Microsoft models, or models from other providers. Use the code below to get an already authenticated [ChatCompletionsClient](https://learn.microsoft.com/python/api/azure-ai-inference/azure.ai.inference.chatcompletionsclient?view=azure-python-preview) from the [azure-ai-inference](https://pypi.org/project/azure-ai-inference/) package, and execute a chat completions call.

  First, install the package:

  ```bash
  pip install azure-ai-inference
  ```

  Then run this code (replace "gpt-4o" with your model deployment name):

  ```python
  inference_client = project_client.inference.get_chat_completions_client()

  response = inference_client.complete(
      model="gpt-4o", # Model deployment name
      messages=[UserMessage(content="How many feet are in a mile?")]
  )

  print(response.choices[0].message.content)
  ```

  See the "inference" folder in the [package samples][samples] for additional samples, including getting an authenticated [EmbeddingsClient](https://learn.microsoft.com/python/api/azure-ai-inference/azure.ai.inference.embeddingsclient?view=azure-python-preview).



  Your Azure AI Studio project may have one or more OpenAI models deployed that support chat completions. Use the code below to get an already authenticated [AzureOpenAI](https://github.com/openai/openai-python?tab=readme-ov-file#microsoft-azure-openai) from the [openai](https://pypi.org/project/openai/) package, and execute a chat completions call.

  First, install the package:

  ```bash
  pip install openai
  ```

  Then run the code below. Replace `gpt-4o` with your model deployment name, and update the `api_version` value with one found in the "Data plane - inference" row [in this table](https://learn.microsoft.com/azure/ai-services/openai/reference#api-specs).

  ```python
  aoai_client = project_client.inference.get_azure_openai_client(api_version="2024-06-01")

  response = aoai_client.chat.completions.create(
      model="gpt-4o", # Model deployment name
      messages=[
          {
              "role": "user",
              "content": "How many feet are in a mile?",
          },
      ],
  )

  print(response.choices[0].message.content)
  ```

  See the "inference" folder in the [package samples][samples] for additional samples.



  Agents in the Azure AI Projects client library are designed to facilitate various interactions and operations within your AI projects. They serve as the core components that manage and execute tasks, leveraging different tools and resources to achieve specific goals. The following steps outline the typical sequence for interacting with Agents. See the "agents" folder in the [package samples][samples] for additional Agent samples.

  Agents are actively being developed. A sign-up form for private preview is coming soon.



  Here is an example of how to create an Agent:
  <!-- SNIPPET:sample_agents_basics.create_agent -->

  ```python
  agent = project_client.agents.create_agent(
      model="gpt-4-1106-preview",
      name="my-assistant",
      instructions="You are helpful assistant",
  )
  ```

  <!-- END SNIPPET -->

  To allow Agents to access your resources or custom functions, you need tools. You can pass tools to `create_agent` by either `toolset` or combination of `tools` and `tool_resources`.

  Here is an example of `toolset`:
  <!-- SNIPPET:sample_agents_run_with_toolset.create_agent_toolset -->

  ```python
  functions = FunctionTool(user_functions)
  code_interpreter = CodeInterpreterTool()

  toolset = ToolSet()
  toolset.add(functions)
  toolset.add(code_interpreter)

  agent = project_client.agents.create_agent(
      model="gpt-4-1106-preview", name="my-assistant", instructions="You are a helpful assistant", toolset=toolset
  )
  ```

  <!-- END SNIPPET -->

  Also notices that if you use asynchronous client, you use `AsyncToolSet` instead.  Additional information related to `AsyncFunctionTool` be discussed in the later sections.

  Here is an example to use `tools` and `tool_resources`:
  <!-- SNIPPET:sample_agents_vector_store_batch_file_search.create_agent_with_tools_and_tool_resources -->

  ```python
  file_search_tool = FileSearchTool(vector_store_ids=[vector_store.id])


  agent = project_client.agents.create_agent(
      model="gpt-4-1106-preview",
      name="my-assistant",
      instructions="You are helpful assistant",
      tools=file_search_tool.definitions,
      tool_resources=file_search_tool.resources,
  )
  ```

  <!-- END SNIPPET -->

  In the following sections, we show you sample code in either `toolset` or combination of `tools` and `tool_resources`.



  To perform file search by an Agent, we first need to upload a file, create a vector store, and associate the file to the vector store. Here is an example:

  <!-- SNIPPET:sample_agents_file_search.upload_file_create_vector_store_and_agent_with_file_search_tool -->

  ```python
  file = project_client.agents.upload_file_and_poll(file_path="product_info_1.md", purpose="assistants")
  print(f"Uploaded file, file ID: {file.id}")

  vector_store = project_client.agents.create_vector_store_and_poll(file_ids=[file.id], name="my_vectorstore")
  print(f"Created vector store, vector store ID: {vector_store.id}")


  file_search = FileSearchTool(vector_store_ids=[vector_store.id])

  agent = project_client.agents.create_agent(
      model="gpt-4-1106-preview",
      name="my-assistant",
      instructions="Hello, you are helpful assistant and can search information from uploaded files",
      tools=file_search.definitions,
      tool_resources=file_search.resources,
  )
  ```

  <!-- END SNIPPET -->



  Here is an example to upload a file and use it for code interpreter by an Agent:

  <!-- SNIPPET:sample_agents_code_interpreter.upload_file_and_create_agent_with_code_interpreter -->

  ```python
  file = project_client.agents.upload_file_and_poll(
      file_path="nifty_500_quarterly_results.csv", purpose=FilePurpose.AGENTS
  )
  print(f"Uploaded file, file ID: {file.id}")

  code_interpreter = CodeInterpreterTool(file_ids=[file.id])


  agent = project_client.agents.create_agent(
      model="gpt-4-1106-preview",
      name="my-assistant",
      instructions="You are helpful assistant",
      tools=code_interpreter.definitions,
      tool_resources=code_interpreter.resources,
  )
  ```

  <!-- END SNIPPET -->



  To enable your Agent to perform search through Bing search API, you use `BingGroundingTool` along with a connection.

  Here is an example:

  <!-- SNIPPET:sample_agents_bing_grounding.create_agent_with_bing_grounding_tool -->

  ```python
  bing_connection = project_client.connections.get(connection_name=os.environ["BING_CONNECTION_NAME"])
  conn_id = bing_connection.id

  print(conn_id)


  bing = BingGroundingTool(connection_id=conn_id)


  with project_client:
      agent = project_client.agents.create_agent(
          model="gpt-4-1106-preview",
          name="my-assistant",
          instructions="You are a helpful assistant",
          tools=bing.definitions,
          headers={"x-ms-enable-preview": "true"},
      )
  ```

  <!-- END SNIPPET -->



  Azure AI Search is an enterprise search system for high-performance applications. It integrates with Azure OpenAI Service and Azure Machine Learning, offering advanced search technologies like vector search and full-text search. Ideal for knowledge base insights, information discovery, and automation

  Here is an example to integrate Azure AI Search:

  <!-- SNIPPET:sample_agents_azure_ai_search.create_agent_with_azure_ai_search_tool -->

  ```python
  conn_list = project_client.connections.list()
  conn_id = ""
  for conn in conn_list:
      if conn.connection_type == "CognitiveSearch":
          conn_id = conn.id
          break

  print(conn_id)


  ai_search = AzureAISearchTool()
  ai_search.add_index(conn_id, "sample_index")


  with project_client:
      agent = project_client.agents.create_agent(
          model="gpt-4-1106-preview",
          name="my-assistant",
          instructions="You are a helpful assistant",
          tools=ai_search.definitions,
          headers={"x-ms-enable-preview": "true"},
      )
  ```

  <!-- END SNIPPET -->



  You can enhance your Agents by defining callback functions as function tools. These can be provided to `create_agent` via either the `toolset` parameter or the combination of `tools` and `tool_resources`. Here are the distinctions:

  - `toolset`: When using the `toolset` parameter, you provide not only the function definitions and descriptions but also their implementations. The SDK will execute these functions within `create_and_run_process` or `streaming` . These functions will be invoked based on their definitions.
  - `tools` and `tool_resources`: When using the `tools` and `tool_resources` parameters, only the function definitions and descriptions are provided to `create_agent`, without the implementations. The `Run` or `event handler of stream` will raise a `requires_action` status based on the function definitions. Your code must handle this status and call the appropriate functions.

  For more details about calling functions by code, refer to [`sample_agents_stream_eventhandler_with_functions.py`](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/agents/sample_agents_stream_eventhandler_with_functions.py) and [`sample_agents_functions.py`](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/agents/sample_agents_functions.py).

  Here is an example to use [user functions](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/agents/user_functions.py) in `toolset`:
  <!-- SNIPPET:sample_agents_stream_eventhandler_with_toolset.create_agent_with_function_tool -->

  ```python
  functions = FunctionTool(user_functions)
  toolset = ToolSet()
  toolset.add(functions)

  agent = project_client.agents.create_agent(
      model="gpt-4-1106-preview", name="my-assistant", instructions="You are a helpful assistant", toolset=toolset
  )
  ```

  <!-- END SNIPPET -->

  For asynchronous functions, you must import `AIProjectClient` from `azure.ai.projects.aio` and use `AsyncFunctionTool`.   Here is an example using [asynchronous user functions](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/agents/async_samples/user_async_functions.py):

  ```python
  from azure.ai.projects.aio import AIProjectClient
  ```

  <!-- SNIPPET:sample_agents_run_with_toolset_async.create_agent_with_async_function_tool -->

  ```python
  functions = AsyncFunctionTool(user_async_functions)

  toolset = AsyncToolSet()
  toolset.add(functions)

  agent = await project_client.agents.create_agent(
      model="gpt-4-1106-preview", name="my-assistant", instructions="You are a helpful assistant", toolset=toolset
  )
  ```

  <!-- END SNIPPET -->



  For each session or conversation, a thread is required.   Here is an example:

  <!-- SNIPPET:sample_agents_basics.create_thread -->

  ```python
  thread = project_client.agents.create_thread()
  ```

  <!-- END SNIPPET -->



  In some scenarios, you might need to assign specific resources to individual threads. To achieve this, you provide the `tool_resources` argument to `create_thread`. In the following example, you create a vector store and upload a file, enable an Agent for file search using the `tools` argument, and then associate the file with the thread using the `tool_resources` argument.

  <!-- SNIPPET:sample_agents_with_resources_in_thread.create_agent_and_thread_for_file_search -->

  ```python
  file = project_client.agents.upload_file_and_poll(file_path="product_info_1.md", purpose="assistants")
  print(f"Uploaded file, file ID: {file.id}")

  vector_store = project_client.agents.create_vector_store_and_poll(file_ids=[file.id], name="my_vectorstore")
  print(f"Created vector store, vector store ID: {vector_store.id}")


  file_search = FileSearchTool(vector_store_ids=[vector_store.id])

  agent = project_client.agents.create_agent(
      model="gpt-4-1106-preview",
      name="my-assistant",
      instructions="Hello, you are helpful assistant and can search information from uploaded files",
      tools=file_search.definitions,
  )

  print(f"Created agent, ID: {agent.id}")



  thread = project_client.agents.create_thread(tool_resources=file_search.resources)
  ```

  <!-- END SNIPPET -->


  To create a message for assistant to process, you pass `user` as `role` and a question as `content`:

  <!-- SNIPPET:sample_agents_basics.create_message -->

  ```python
  message = project_client.agents.create_message(thread_id=thread.id, role="user", content="Hello, tell me a joke")
  ```

  <!-- END SNIPPET -->



  To attach a file to a message for content searching, you use `MessageAttachment` and `FileSearchTool`:

  <!-- SNIPPET:sample_agents_with_file_search_attachment.create_message_with_attachment -->

  ```python
  attachment = MessageAttachment(file_id=file.id, tools=FileSearchTool().definitions)
  message = project_client.agents.create_message(
      thread_id=thread.id, role="user", content="What feature does Smart Eyewear offer?", attachments=[attachment]
  )
  ```

  <!-- END SNIPPET -->



  To attach a file to a message for data analysis, you use `MessageAttachment` and `CodeInterpreterTool`. You must pass `CodeInterpreterTool` as `tools` or `toolset` in `create_agent` call or the file attachment cannot be opened for code interpreter.

  Here is an example to pass `CodeInterpreterTool` as tool:

  <!-- SNIPPET:sample_agents_with_code_interpreter_file_attachment.create_agent_and_message_with_code_interpreter_file_attachment -->

  ```python


  agent = project_client.agents.create_agent(
      model="gpt-4-1106-preview",
      name="my-assistant",
      instructions="You are helpful assistant",
      tools=CodeInterpreterTool().definitions,
  )
  print(f"Created agent, agent ID: {agent.id}")

  thread = project_client.agents.create_thread()
  print(f"Created thread, thread ID: {thread.id}")


  attachment = MessageAttachment(file_id=file.id, tools=CodeInterpreterTool().definitions)


  message = project_client.agents.create_message(
      thread_id=thread.id,
      role="user",
      content="Could you please create bar chart in TRANSPORTATION sector for the operating profit from the uploaded csv file and provide file to me?",
      attachments=[attachment],
  )
  ```

  <!-- END SNIPPET -->



  To process your message, you can use `create_run`, `create_and_process_run`, or `create_stream`.

  `create_run` requests the Agent to process the message without polling for the result. If you are using `function tools` regardless as `toolset` or not, your code is responsible for polling for the result and acknowledging the status of `Run`. When the status is `requires_action`, your code is responsible for calling the function tools. For a code sample, visit [`sample_agents_functions.py`](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/agents/sample_agents_functions.py).

  Here is an example of `create_run` and poll until the run is completed:

  <!-- SNIPPET:sample_agents_basics.create_run -->

  ```python
  run = project_client.agents.create_run(thread_id=thread.id, assistant_id=agent.id)


  while run.status in ["queued", "in_progress", "requires_action"]:
      
      time.sleep(1)
      run = project_client.agents.get_run(thread_id=thread.id, run_id=run.id)
  ```

  <!-- END SNIPPET -->

  To have the SDK poll on your behalf and call `function tools`, use the `create_and_process_run` method. Note that `function tools` will only be invoked if they are provided as `toolset` during the `create_agent` call.

  Here is an example:

  <!-- SNIPPET:sample_agents_run_with_toolset.create_and_process_run -->

  ```python
  run = project_client.agents.create_and_process_run(thread_id=thread.id, assistant_id=agent.id)
  ```

  <!-- END SNIPPET -->

  With streaming, polling also need not be considered. If `function tools` are provided as `toolset` during the `create_agent` call, they will be invoked by the SDK.

  Here is an example:

  <!-- SNIPPET:sample_agents_stream_eventhandler.create_stream -->

  ```python
  with project_client.agents.create_stream(
      thread_id=thread.id, assistant_id=agent.id, event_handler=MyEventHandler()
  ) as stream:
      stream.until_done()
  ```

  <!-- END SNIPPET -->

  The event handler is optional. Here is an example:

  <!-- SNIPPET:sample_agents_stream_eventhandler.stream_event_handler -->

  ```python
  class MyEventHandler(AgentEventHandler):
      def on_message_delta(self, delta: "MessageDeltaChunk") -> None:
          for content_part in delta.delta.content:
              if isinstance(content_part, MessageDeltaTextContent):
                  text_value = content_part.text.value if content_part.text else "No text"
                  print(f"Text delta received: {text_value}")

      def on_thread_message(self, message: "ThreadMessage") -> None:
          print(f"ThreadMessage created. ID: {message.id}, Status: {message.status}")

      def on_thread_run(self, run: "ThreadRun") -> None:
          print(f"ThreadRun status: {run.status}")

      def on_run_step(self, step: "RunStep") -> None:
          print(f"RunStep type: {step.type}, Status: {step.status}")

      def on_error(self, data: str) -> None:
          print(f"An error occurred. Data: {data}")

      def on_done(self) -> None:
          print("Stream completed.")

      def on_unhandled_event(self, event_type: str, event_data: Any) -> None:
          print(f"Unhandled Event Type: {event_type}, Data: {event_data}")
  ```

  <!-- END SNIPPET -->



  To retrieve messages from agents, use the following example:

  <!-- SNIPPET:sample_agents_basics.list_messages -->

  ```python
  messages = project_client.agents.list_messages(thread_id=thread.id)



  for data_point in reversed(messages.data):
      last_message_content = data_point.content[-1]
      if isinstance(last_message_content, MessageTextContent):
          print(f"{data_point.role}: {last_message_content.text.value}")
  ```

  <!-- END SNIPPET -->

  Depending on the use case, if you expect the Agents to return only text messages, `list_messages` should be sufficient.
  If you are using tools, consider using the `get_messages` function instead. This function classifies the message content and returns properties such as `text_messages`, `image_contents`, `file_citation_annotations`, and `file_path_annotations`.



  Files uploaded by Agents cannot be retrieved back. If your use case need to access the file content uploaded by the Agents, you are advised to keep an additional copy accessible by your application. However, files generated by Agents are retrievable by `save_file` or `get_file_content`.

  Here is an example retrieving file ids from messages and save to the local drive:

  <!-- SNIPPET:sample_agents_code_interpreter.get_messages_and_save_files -->

  ```python
  messages = project_client.agents.get_messages(thread_id=thread.id)
  print(f"Messages: {messages}")

  for image_content in messages.image_contents:
      file_id = image_content.image_file.file_id
      print(f"Image File ID: {file_id}")
      file_name = f"{file_id}_image_file.png"
      project_client.agents.save_file(file_id=file_id, file_name=file_name)
      print(f"Saved image file to: {Path.cwd() / file_name}")

  for file_path_annotation in messages.file_path_annotations:
      print(f"File Paths:")
      print(f"Type: {file_path_annotation.type}")
      print(f"Text: {file_path_annotation.text}")
      print(f"File ID: {file_path_annotation.file_path.file_id}")
      print(f"Start Index: {file_path_annotation.start_index}")
      print(f"End Index: {file_path_annotation.end_index}")
  ```

  <!-- END SNIPPET -->

  Here is an example to use `get_file_content`:

  ```python
  from pathlib import Path

  async def save_file_content(client, file_id: str, file_name: str, target_dir: Optional[Union[str, Path]] = None):
      
      path = Path(target_dir).expanduser().resolve() if target_dir else Path.cwd()
      path.mkdir(parents=True, exist_ok=True)

      
      file_content_stream = await client.get_file_content(file_id)
      if not file_content_stream:
          raise RuntimeError(f"No content retrievable for file ID '{file_id}'.")

      
      chunks = []
      async for chunk in file_content_stream:
          if isinstance(chunk, (bytes, bytearray)):
              chunks.append(chunk)
          else:
              raise TypeError(f"Expected bytes or bytearray, got {type(chunk).__name__}")

      target_file_path = path / file_name

      
      with open(target_file_path, "wb") as file:
          for chunk in chunks:
              file.write(chunk)
  ```



  To remove resources after completing tasks, use the following functions:

  <!-- SNIPPET:sample_agents_file_search.teardown -->

  ```python

  project_client.agents.delete_vector_store(vector_store.id)
  print("Deleted vector store")

  project_client.agents.delete_file(file_id=file.id)
  print("Deleted file")


  project_client.agents.delete_agent(agent.id)
  print("Deleted agent")
  ```

  <!-- END SNIPPET -->



  Evaluation in Azure AI Project client library is designed to assess the performance of generative AI applications in the cloud. The output of Generative AI application is quantitively measured with mathematical based metrics, AI-assisted quality and safety metrics. Metrics are defined as evaluators. Built-in or custom evaluators can provide comprehensive insights into the application's capabilities and limitations.



  Evaluators are custom or prebuilt classes or functions that are designed to measure the quality of the outputs from language models or generative AI applications.

  Evaluators are made available via [azure-ai-evaluation][azure_ai_evaluation] SDK for local experience and also in [Evaluator Library][evaluator_library] in Azure AI Studio for using them in the cloud.

  More details on built-in and custom evaluators can be found [here][evaluators].



  To run evaluation in the cloud the following are needed:

  - Evaluators
  - Data to be evaluated
  - [Optional] Azure Open AI model.



  For running evaluator in the cloud, evaluator `ID` is needed. To get it via code you use [azure-ai-evaluation][azure_ai_evaluation]

  ```python


  from azure.ai.evaluation import RelevanceEvaluator

  evaluator_id = RelevanceEvaluator.id
  ```



  Evaluation in the cloud supports data in form of `jsonl` file. Data can be uploaded via the helper method `upload_file` on the project client.

  ```python

  data_id, _ = project_client.upload_file("<data_file.jsonl>")
  ```



  Azure AI Studio project comes with a default Azure Open AI endpoint which can be easily accessed using following code. This gives you the endpoint details for you Azure OpenAI endpoint. Some of the evaluators need model that supports chat completion.

  ```python
  default_connection = project_client.connections.get_default(connection_type=ConnectionType.AZURE_OPEN_AI)
  ```



  ```python
  import os
  from azure.ai.projects import AIProjectClient
  from azure.identity import DefaultAzureCredential
  from azure.ai.projects.models import Evaluation, Dataset, EvaluatorConfiguration, ConnectionType
  from azure.ai.evaluation import F1ScoreEvaluator, RelevanceEvaluator, HateUnfairnessEvaluator



  project_client = AIProjectClient.from_connection_string(
      credential=DefaultAzureCredential(),
      conn_str=os.environ["PROJECT_CONNECTION_STRING"],
  )


  data_id, _ = project_client.upload_file("<data_file.jsonl>")

  deployment_name = "<deployment_name>"
  api_version = "<api_version>"


  evaluation = Evaluation(
      display_name="Remote Evaluation",
      description="Evaluation of dataset",
      data=Dataset(id=data_id),
      evaluators={
          "f1_score": EvaluatorConfiguration(
              id=F1ScoreEvaluator.id,
          ),
          "relevance": EvaluatorConfiguration(
              id=RelevanceEvaluator.id,
              init_params={
                  "model_config": default_connection.to_evaluator_model_config(
                      deployment_name=deployment_name, api_version=api_version
                  )
              },
          ),
          "violence": EvaluatorConfiguration(
              id=ViolenceEvaluator.id,
              init_params={"azure_ai_project": project_client.scope},
          ),
      },
  )


  evaluation_response = project_client.evaluations.create(
      evaluation=evaluation,
  )


  get_evaluation_response = project_client.evaluations.get(evaluation_response.id)

  print("----------------------------------------------------------------")
  print("Created evaluation, evaluation ID: ", get_evaluation_response.id)
  print("Evaluation status: ", get_evaluation_response.status)
  if isinstance(get_evaluation_response.properties, dict):
      print("AI Studio URI: ", get_evaluation_response.properties["AiStudioEvaluationUri"])
  print("----------------------------------------------------------------")
  ```

  NOTE: For running evaluators locally refer to [Evaluate with the Azure AI Evaluation SDK][evaluators].



  You can add an Application Insights Azure resource to your Azure AI Studio project. See the Tracing tab in your studio. If one was enabled, you can get the Application Insights connection string, configure your Agents, and observe the full execution path through Azure Monitor. Typically, you might want to start tracing before you create an Agent.



  Make sure to install OpenTelemetry and the Azure SDK tracing plugin via

  ```bash
  pip install opentelemetry
  pip install azure-core-tracing-opentelemetry
  ```

  You will also need an exporter to send telemetry to your observability backend. You can print traces to the console or use a local viewer such as [Aspire Dashboard](https://learn.microsoft.com/dotnet/aspire/fundamentals/dashboard/standalone?tabs=bash).

  To connect to Aspire Dashboard or another OpenTelemetry compatible backend, install OTLP exporter:

  ```bash
  pip install opentelemetry-exporter-otlp
  ```



  Here is a code sample to be included above `create_agent`:

  <!-- SNIPPET:sample_agents_basics_with_azure_monitor_tracing.enable_tracing -->

  ```python
  from opentelemetry import trace
  from azure.monitor.opentelemetry import configure_azure_monitor


  application_insights_connection_string = project_client.telemetry.get_connection_string()
  if not application_insights_connection_string:
      print("Application Insights was not enabled for this project.")
      print("Enable it via the 'Tracing' tab in your AI Studio project page.")
      exit()
  configure_azure_monitor(connection_string=application_insights_connection_string)

  scenario = os.path.basename(__file__)
  tracer = trace.get_tracer(__name__)

  with tracer.start_as_current_span(scenario):
      with project_client:
  ```

  <!-- END SNIPPET -->

  In additional, you might find helpful to see the tracing logs in console. You can achieve by the following code:

  ```python
  project_client.telemetry.enable(destination=sys.stdout)
  ```





  Client methods that make service calls raise an [HttpResponseError](https://learn.microsoft.com/python/api/azure-core/azure.core.exceptions.httpresponseerror) exception for a non-success HTTP status code response from the service. The exception's `status_code` will hold the HTTP response status code (with `reason` showing the friendly name). The exception's `error.message` contains a detailed message that may be helpful in diagnosing the issue:

  ```python
  from azure.core.exceptions import HttpResponseError

  ...

  try:
      result = project_client.connections.list()
  except HttpResponseError as e:
      print(f"Status code: {e.status_code} ({e.reason})")
      print(e.message)
  ```

  For example, when you provide wrong credentials:

  ```text
  Status code: 401 (Unauthorized)
  Operation returned an invalid status 'Unauthorized'
  ```



  The client uses the standard [Python logging library](https://docs.python.org/3/library/logging.html). The SDK logs HTTP request and response details, which may be useful in troubleshooting. To log to stdout, add the following:

  ```python
  import sys
  import logging



  logger = logging.getLogger("azure")


  logger.setLevel(logging.DEBUG)


  handler = logging.StreamHandler(stream=sys.stdout)


  logger.addHandler(handler)




  ```

  By default logs redact the values of URL query strings, the values of some HTTP request and response headers (including `Authorization` which holds the key or token), and the request and response payloads. To create logs without redaction, add `logging_enable = True` to the client constructor:

  ```python
  project_client = AIProjectClient.from_connection_string(
      credential=DefaultAzureCredential(),
      conn_str=os.environ["PROJECT_CONNECTION_STRING"],
      logging_enable = True
  )
  ```

  Note that the log level must be set to `logging.DEBUG` (see above code). Logs will be redacted with any other log level.

  Be sure to protect non redacted logs to avoid compromising security.

  For more information, see [Configure logging in the Azure libraries for Python](https://aka.ms/azsdk/python/logging)



  To report issues with the client library, or request additional features, please open a GitHub issue [here](https://github.com/Azure/azure-sdk-for-python/issues)



  Have a look at the [Samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-projects/samples) folder, containing fully runnable Python code for synchronous and asynchronous clients.

  Explore the [AI Starter Template](https://aka.ms/azsdk/azure-ai-projects/python/ai-starter-template). This template creates an Azure AI Studio hub, project and connected resources including Azure OpenAI Service, AI Search and more. It also deploys a simple chat application to Azure Container Apps.



  This project welcomes contributions and suggestions. Most contributions require
  you to agree to a Contributor License Agreement (CLA) declaring that you have
  the right to, and actually do, grant us the rights to use your contribution.
  For details, visit https://cla.microsoft.com.

  When you submit a pull request, a CLA-bot will automatically determine whether
  you need to provide a CLA and decorate the PR appropriately (e.g., label,
  comment). Simply follow the instructions provided by the bot. You will only
  need to do this once across all repos using our CLA.

  This project has adopted the
  [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information,
  see the Code of Conduct FAQ or contact opencode@microsoft.com with any
  additional questions or comments.

  <!-- LINKS -->
  [samples]: https://aka.ms/azsdk/azure-ai-projects/python/samples/
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [entra_id]: https://learn.microsoft.com/azure/ai-services/authentication?tabs=powershell#authenticate-with-microsoft-entra-id
  [azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
  [azure_identity_pip]: https://pypi.org/project/azure-identity/
  [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
  [pip]: https://pypi.org/project/pip/
  [azure_sub]: https://azure.microsoft.com/free/
  [evaluators]: https://learn.microsoft.com/azure/ai-studio/how-to/develop/evaluate-sdk
  [azure_ai_evaluation]: https://learn.microsoft.com/python/api/overview/azure/ai-evaluation-readme?view=azure-python-preview
  [evaluator_library]: https://learn.microsoft.com/azure/ai-studio/how-to/evaluate-generative-ai-app#view-and-manage-the-evaluators-in-the-evaluator-library


pkgId: 30e872d053d0366d6e9b407df046842b43a409d25d24cb6477e00bfe7992d73a
name: python-azure-ai-resources
arch: src
version: 1.0.0b8
epoch: 0
release: 1
summary: Microsoft Azure Azure AI control plane SDK Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-resources-1.0.0b8-1.src.rpm
checksum_type: sha256
description:
  The Azure AI Resources package is part of the Azure AI SDK for Python and contains functionality for connecting to and managing your Azure AI resources and projects. Within your Azure AI projects it provides control plane operations for creating and managing data, indexes, models and deployments.


  [Source code][source_code]
  | [Package (PyPI)][ai_pypi]
  | [API reference documentation][ai_ref_docs]
  | [Product documentation][product_documentation]
  | [Samples][generative_samples]

  This package has been tested with Python 3.8, 3.9, 3.10, 3.11 and 3.12.

  For a more complete set of Azure libraries, see https://aka.ms/azsdk/python/all.





  - Python 3.7 or later is required to use this package.
  - You must have an [Azure subscription][azure_subscription].
  - An [Azure Machine Learning Workspace][workspace].
  - An [Azure AI Studio project][ai_project].


  Install the Azure AI generative package for Python with pip:

  ```
  pip install azure-ai-resources
  pip install azure-identity
  ```


  ```python
  from azure.ai.resources.client import AIClient
  from azure.identity import DefaultAzureCredential

  ai_client = AIClient(credential=DefaultAzureCredential(), subscription_id='subscription_id',
                       resource_group_name='resource_group', project_name='project_name')
  ```


  Use this library within your Azure AI projects to provide control plane operations for creating and managing data, indexes, models and deployments.



  View our [samples repository][generative_samples] on GitHub for examples demonstrating how to use the Azure AI Generative Python SDK.



  Azure AI clients raise exceptions defined in Azure Core.

  ```python
  from azure.core.exceptions import HttpResponseError

  try:
      ai_client.compute.get("cpu-cluster")
  except HttpResponseError as error:
      print("Request failed: {}".format(error.message))
  ```


  This library uses the standard logging library for logging. Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO level.

  Detailed DEBUG level logging, including request/response bodies and unredacted headers, can be enabled on a client with the `logging_enable` argument.

  See full SDK logging documentation with examples here.


  The Azure AI Generative Python SDK includes a telemetry feature that collects usage and failure data about the SDK and sends it to Microsoft when you use the SDK in a Jupyter Notebook only. <u>Telemetry will not be collected for any use of the Python SDK outside of a Jupyter Notebook.</u>

  Telemetry data helps the SDK team understand how the SDK is used so it can be improved and the information about failures helps the team resolve problems and fix bugs. The SDK telemetry feature is enabled by default for Jupyter Notebook usage and cannot be enabled for non-Jupyter scenarios. To opt out of the telemetry feature in a Jupyter scenario, set the environment variable `"AZURE_AI_RESOURCES_ENABLE_LOGGING"` to `"False"`.



  View our [samples repository][generative_samples] on GitHub for examples demonstrating how to use the Azure AI Generative Python SDK.



  If you encounter any bugs or have suggestions, please file an issue in the [Issues](<https://github.com/Azure/azure-sdk-for-python/issues>) section of the project.

  ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fsdk%2Ftemplate%2Fazure-template%2FREADME.png)


  <!-- LINKS -->

  [source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-resources
  [ai_project]: https://aka.ms/azureaistudio
  [ai_pypi]: https://pypi.org/project/azure-ai-resources/
  [ai_ref_docs]: https://learn.microsoft.com/python/api/azure-ai-resources/?view=azure-python-preview
  [generative_samples]: https://github.com/Azure-Samples/azureai-samples
  [product_documentation]: https://docs.microsoft.com/azure/machine-learning/
  [azure_subscription]: https://azure.microsoft.com/free/
  [workspace]: https://docs.microsoft.com/azure/machine-learning/concept-workspace
  [python_logging]: https://docs.python.org/3/library/logging.html
  [sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/azure-sdk-logging
  [azure_core_readme]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [pip_link]: https://pypi.org/project/pip/
  [azure_core_ref_docs]: https://aka.ms/azsdk-python-core-policies
  [azure_core]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity
  [cla]: https://cla.microsoft.com
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
  [coc_contact]: mailto:opencode@microsoft.com






  - Connections LIST operation now supports returning data connections via new optional flag: include_data_connections.
  - Connections have read-only support for 3 new connection types: gen 2, data lake, and azure blob.


  - Connections docstrings now discuss scope field.


  - Bug fixes





  - Bug fixes





  - Bug fixes





  - Duplicate cleanup





  - Use openai v1 environment variable





  - AzureOpenAIConnection.set_current_environment supports openai 1.0 and above.



  - Support for Python 3.12





  - Dependency improvements.





  - First preview.


pkgId: cafe0bae11b1867bb9b65f5fca8f8adf48d65af1c25f25acbf5fe00dbcfe51f1
name: python-azure-ai-search-haystack
arch: src
version: 0.1.0
epoch: 0
release: 1
summary: Haystack 2.x Document Store for Azure AI Search
url: https://pypi.org/project/azure-ai-search-haystack/
rpm_license: Apache-2.0
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-search-haystack-0.1.0-1.src.rpm
checksum_type: sha256
description:
  **Table of Contents**
  - [Azure AI Search Document Store for Haystack](#azure-ai-search-document-store-for-haystack)
    - [Installation](#installation)
    - [Examples](#examples)
    - [License](#license)

  ```console
  pip install azure-ai-search-haystack
  ```

  You can find a code example showing how to use the Document Store and the Retriever in the documentation or in [this Colab](https://colab.research.google.com/drive/1YpDetI8BRbObPDEVdfqUcwhEX9UUXP-m?usp=sharing).

  `azure-ai-search-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license.


pkgId: f853db6a69bf0d5885de0d68d3c99516bc904504780d969e0a172d72435f7078
name: python-azure-ai-textanalytics
arch: src
version: 5.3.0
epoch: 0
release: 1
summary: Microsoft Azure Text Analytics Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-textanalytics-5.3.0-1.src.rpm
checksum_type: sha256
description:
  The Azure Cognitive Service for Language is a cloud-based service that provides Natural Language Processing (NLP) features for understanding and analyzing text, and includes the following main features:

  - Sentiment Analysis
  - Named Entity Recognition
  - Language Detection
  - Key Phrase Extraction
  - Entity Linking
  - Multiple Analysis
  - Personally Identifiable Information (PII) Detection
  - Text Analytics for Health
  - Custom Named Entity Recognition
  - Custom Text Classification
  - Extractive Text Summarization
  - Abstractive Text Summarization

  [Source code][source_code]
  | [Package (PyPI)][ta_pypi]
  | [Package (Conda)](https://anaconda.org/microsoft/azure-ai-textanalytics/)
  | [API reference documentation][ta_ref_docs]
  | [Product documentation][language_product_documentation]
  | [Samples][ta_samples]





  - Python 3.7 later is required to use this package.
  - You must have an [Azure subscription][azure_subscription] and a
    [Cognitive Services or Language service resource][ta_or_cs_resource] to use this package.



  The Language service supports both [multi-service and single-service access][multi_and_single_service].
  Create a Cognitive Services resource if you plan to access multiple cognitive services under a single endpoint/key. For Language service access only, create a Language service resource.
  You can create the resource using the [Azure Portal][azure_portal_create_ta_resource] or [Azure CLI][azure_cli] following the steps in [this document][azure_cli_create_ta_resource].

  Interaction with the service using the client library begins with a [client](#textanalyticsclient "TextAnalyticsClient").
  To create a client object, you will need the Cognitive Services or Language service `endpoint` to
  your resource and a `credential` that allows you access:

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.textanalytics import TextAnalyticsClient

  credential = AzureKeyCredential("<api_key>")
  text_analytics_client = TextAnalyticsClient(endpoint="https://<resource-name>.cognitiveservices.azure.com/", credential=credential)
  ```

  Note that for some Cognitive Services resources the endpoint might look different from the above code snippet.
  For example, `https://<region>.api.cognitive.microsoft.com/`.



  Install the Azure Text Analytics client library for Python with [pip][pip]:

  ```bash
  pip install azure-ai-textanalytics
  ```

  <!-- SNIPPET:sample_authentication.create_ta_client_with_key -->

  ```python
  import os
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.textanalytics import TextAnalyticsClient
  endpoint = os.environ["AZURE_LANGUAGE_ENDPOINT"]
  key = os.environ["AZURE_LANGUAGE_KEY"]

  text_analytics_client = TextAnalyticsClient(endpoint, AzureKeyCredential(key))
  ```

  <!-- END SNIPPET -->

  > Note that `5.2.X` and newer targets the Azure Cognitive Service for Language APIs. These APIs include the text analysis and natural language processing features found in the previous versions of the Text Analytics client library.
  In addition, the service API has changed from semantic to date-based versioning. This version of the client library defaults to the latest supported API version, which currently is `2023-04-01`.

  This table shows the relationship between SDK versions and supported API versions of the service

  | SDK version  | Supported API version of service  |
  | ------------ | --------------------------------- |
  | 5.3.X - Latest stable release | 3.0, 3.1, 2022-05-01, 2023-04-01 (default) |
  | 5.2.X  | 3.0, 3.1, 2022-05-01 (default) |
  | 5.1.0  | 3.0, 3.1 (default) |
  | 5.0.0  | 3.0 |

  API version can be selected by passing the [api_version][text_analytics_client] keyword argument into the client.
  For the latest Language service features, consider selecting the most recent beta API version. For production scenarios, the latest stable version is recommended. Setting to an older version may result in reduced feature compatibility.





  You can find the endpoint for your Language service resource using the
  [Azure Portal][azure_portal_get_endpoint]
  or [Azure CLI][azure_cli_endpoint_lookup]:

  ```bash

  az cognitiveservices account show --name "resource-name" --resource-group "resource-group-name" --query "properties.endpoint"
  ```



  You can get the [API key][cognitive_authentication_api_key] from the Cognitive Services or Language service resource in the [Azure Portal][azure_portal_get_endpoint].
  Alternatively, you can use [Azure CLI][azure_cli_endpoint_lookup] snippet below to get the API key of your resource.

  `az cognitiveservices account keys list --name "resource-name" --resource-group "resource-group-name"`



  Once you have the value for the API key, you can pass it as a string into an instance of [AzureKeyCredential][azure-key-credential]. Use the key as the credential parameter
  to authenticate the client:

  <!-- SNIPPET:sample_authentication.create_ta_client_with_key -->

  ```python
  import os
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.textanalytics import TextAnalyticsClient
  endpoint = os.environ["AZURE_LANGUAGE_ENDPOINT"]
  key = os.environ["AZURE_LANGUAGE_KEY"]

  text_analytics_client = TextAnalyticsClient(endpoint, AzureKeyCredential(key))
  ```

  <!-- END SNIPPET -->



  To use an [Azure Active Directory (AAD) token credential][cognitive_authentication_aad],
  provide an instance of the desired credential type obtained from the
  [azure-identity][azure_identity_credentials] library.
  Note that regional endpoints do not support AAD authentication. Create a [custom subdomain][custom_subdomain]
  name for your resource in order to use this type of authentication.

  Authentication with AAD requires some initial setup:

  - [Install azure-identity][install_azure_identity]
  - [Register a new AAD application][register_aad_app]
  - [Grant access][grant_role_access] to the Language service by assigning the `"Cognitive Services Language Reader"` role to your service principal.

  After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use.
  As an example, [DefaultAzureCredential][default_azure_credential]
  can be used to authenticate the client:

  Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
  AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET

  Use the returned token credential to authenticate the client:

  <!-- SNIPPET:sample_authentication.create_ta_client_with_aad -->

  ```python
  import os
  from azure.ai.textanalytics import TextAnalyticsClient
  from azure.identity import DefaultAzureCredential

  endpoint = os.environ["AZURE_LANGUAGE_ENDPOINT"]
  credential = DefaultAzureCredential()

  text_analytics_client = TextAnalyticsClient(endpoint, credential=credential)
  ```

  <!-- END SNIPPET -->





  The Text Analytics client library provides a [TextAnalyticsClient][text_analytics_client] to do analysis on [batches of documents](#examples "Examples").
  It provides both synchronous and asynchronous operations to access a specific use of text analysis, such as language detection or key phrase extraction.



  A **document** is a single unit to be analyzed by the predictive models in the Language service.
  The input for each operation is passed as a **list** of documents.

  Each document can be passed as a string in the list, e.g.

  ```python
  documents = ["I hated the movie. It was so slow!", "The movie made it into my top ten favorites. What a great movie!"]
  ```

  or, if you wish to pass in a per-item document `id` or `language`/`country_hint`, they can be passed as a list of
  [DetectLanguageInput][detect_language_input] or
  [TextDocumentInput][text_document_input]
  or a dict-like representation of the object:

  ```python
  documents = [
      {"id": "1", "language": "en", "text": "I hated the movie. It was so slow!"},
      {"id": "2", "language": "en", "text": "The movie made it into my top ten favorites. What a great movie!"},
  ]
  ```

  See [service limitations][service_limits] for the input, including document length limits, maximum batch size, and supported text encoding.



  The return value for a single document can be a result or error object.
  A heterogeneous list containing a collection of result and error objects is returned from each operation.
  These results/errors are index-matched with the order of the provided documents.

  A **result**, such as [AnalyzeSentimentResult][analyze_sentiment_result],
  is the result of a text analysis operation and contains a prediction or predictions about a document input.

  The **error** object, [DocumentError][document_error], indicates that the service had trouble processing the document and contains
  the reason it was unsuccessful.



  You can filter for a result or error object in the list by using the `is_error` attribute. For a result object this is always `False` and for a
  [DocumentError][document_error] this is `True`.

  For example, to filter out all DocumentErrors you might use list comprehension:

  ```python
  response = text_analytics_client.analyze_sentiment(documents)
  successful_responses = [doc for doc in response if not doc.is_error]
  ```

  You can also use the `kind` attribute to filter between result types:

  ```python
  poller = text_analytics_client.begin_analyze_actions(documents, actions)
  response = poller.result()
  for result in response:
      if result.kind == "SentimentAnalysis":
          print(f"Sentiment is {result.sentiment}")
      elif result.kind == "KeyPhraseExtraction":
          print(f"Key phrases: {result.key_phrases}")
      elif result.is_error is True:
          print(f"Document error: {result.code}, {result.message}")
  ```



  Long-running operations are operations which consist of an initial request sent to the service to start an operation,
  followed by polling the service at intervals to determine whether the operation has completed or failed, and if it has
  succeeded, to get the result.

  Methods that support healthcare analysis, custom text analysis, or multiple analyses are modeled as long-running operations.
  The client exposes a `begin_<method-name>` method that returns a poller object. Callers should wait
  for the operation to complete by calling `result()` on the poller object returned from the `begin_<method-name>` method.
  Sample code snippets are provided to illustrate using long-running operations [below](#examples "Examples").



  The following section provides several code snippets covering some of the most common Language service tasks, including:

  - [Analyze Sentiment](#analyze-sentiment "Analyze sentiment")
  - [Recognize Entities](#recognize-entities "Recognize entities")
  - [Recognize Linked Entities](#recognize-linked-entities "Recognize linked entities")
  - [Recognize PII Entities](#recognize-pii-entities "Recognize pii entities")
  - [Extract Key Phrases](#extract-key-phrases "Extract key phrases")
  - [Detect Language](#detect-language "Detect language")
  - [Healthcare Entities Analysis](#healthcare-entities-analysis "Healthcare Entities Analysis")
  - [Multiple Analysis](#multiple-analysis "Multiple analysis")
  - [Custom Entity Recognition][recognize_custom_entities_sample]
  - [Custom Single Label Classification][single_label_classify_sample]
  - [Custom Multi Label Classification][multi_label_classify_sample]
  - [Extractive Summarization][extract_summary_sample]
  - [Abstractive Summarization][abstract_summary_sample]



  [analyze_sentiment][analyze_sentiment] looks at its input text and determines whether its sentiment is positive, negative, neutral or mixed. It's response includes per-sentence sentiment analysis and confidence scores.

  <!-- SNIPPET:sample_analyze_sentiment.analyze_sentiment -->

  ```python
  import os
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.textanalytics import TextAnalyticsClient

  endpoint = os.environ["AZURE_LANGUAGE_ENDPOINT"]
  key = os.environ["AZURE_LANGUAGE_KEY"]

  text_analytics_client = TextAnalyticsClient(endpoint=endpoint, credential=AzureKeyCredential(key))

  documents = [
      """I had the best day of my life. I decided to go sky-diving and it made me appreciate my whole life so much more.
      I developed a deep-connection with my instructor as well, and I feel as if I've made a life-long friend in her.""",
      """This was a waste of my time. All of the views on this drop are extremely boring, all I saw was grass. 0/10 would
      not recommend to any divers, even first timers.""",
      """This was pretty good! The sights were ok, and I had fun with my instructors! Can't complain too much about my experience""",
      """I only have one word for my experience: WOW!!! I can't believe I have had such a wonderful skydiving company right
      in my backyard this whole time! I will definitely be a repeat customer, and I want to take my grandmother skydiving too,
      I know she'll love it!"""
  ]


  result = text_analytics_client.analyze_sentiment(documents, show_opinion_mining=True)
  docs = [doc for doc in result if not doc.is_error]

  print("Let's visualize the sentiment of each of these documents")
  for idx, doc in enumerate(docs):
      print(f"Document text: {documents[idx]}")
      print(f"Overall sentiment: {doc.sentiment}")
  ```

  <!-- END SNIPPET -->

  The returned response is a heterogeneous list of result and error objects: list[[AnalyzeSentimentResult][analyze_sentiment_result], [DocumentError][document_error]]

  Please refer to the service documentation for a conceptual discussion of [sentiment analysis][sentiment_analysis]. To see how to conduct more granular analysis into the opinions related to individual aspects (such as attributes of a product or service) in a text, see [here][opinion_mining_sample].



  [recognize_entities][recognize_entities] recognizes and categories entities in its input text as people, places, organizations, date/time, quantities, percentages, currencies, and more.

  <!-- SNIPPET:sample_recognize_entities.recognize_entities -->

  ```python
  import os
  import typing
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.textanalytics import TextAnalyticsClient

  endpoint = os.environ["AZURE_LANGUAGE_ENDPOINT"]
  key = os.environ["AZURE_LANGUAGE_KEY"]

  text_analytics_client = TextAnalyticsClient(endpoint=endpoint, credential=AzureKeyCredential(key))
  reviews = [
      """I work for Foo Company, and we hired Contoso for our annual founding ceremony. The food
      was amazing and we all can't say enough good words about the quality and the level of service.""",
      """We at the Foo Company re-hired Contoso after all of our past successes with the company.
      Though the food was still great, I feel there has been a quality drop since their last time
      catering for us. Is anyone else running into the same problem?""",
      """Bar Company is over the moon about the service we received from Contoso, the best sliders ever!!!!"""
  ]

  result = text_analytics_client.recognize_entities(reviews)
  result = [review for review in result if not review.is_error]
  organization_to_reviews: typing.Dict[str, typing.List[str]] = {}

  for idx, review in enumerate(result):
      for entity in review.entities:
          print(f"Entity '{entity.text}' has category '{entity.category}'")
          if entity.category == 'Organization':
              organization_to_reviews.setdefault(entity.text, [])
              organization_to_reviews[entity.text].append(reviews[idx])

  for organization, reviews in organization_to_reviews.items():
      print(
          "\n\nOrganization '{}' has left us the following review(s): {}".format(
              organization, "\n\n".join(reviews)
          )
      )
  ```

  <!-- END SNIPPET -->

  The returned response is a heterogeneous list of result and error objects: list[[RecognizeEntitiesResult][recognize_entities_result], [DocumentError][document_error]]

  Please refer to the service documentation for a conceptual discussion of [named entity recognition][named_entity_recognition]
  and [supported types][named_entity_categories].



  [recognize_linked_entities][recognize_linked_entities] recognizes and disambiguates the identity of each entity found in its input text (for example,
  determining whether an occurrence of the word Mars refers to the planet, or to the
  Roman god of war). Recognized entities are associated with URLs to a well-known knowledge base, like Wikipedia.

  <!-- SNIPPET:sample_recognize_linked_entities.recognize_linked_entities -->

  ```python
  import os
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.textanalytics import TextAnalyticsClient

  endpoint = os.environ["AZURE_LANGUAGE_ENDPOINT"]
  key = os.environ["AZURE_LANGUAGE_KEY"]

  text_analytics_client = TextAnalyticsClient(endpoint=endpoint, credential=AzureKeyCredential(key))
  documents = [
      """
      Microsoft was founded by Bill Gates with some friends he met at Harvard. One of his friends,
      Steve Ballmer, eventually became CEO after Bill Gates as well. Steve Ballmer eventually stepped
      down as CEO of Microsoft, and was succeeded by Satya Nadella.
      Microsoft originally moved its headquarters to Bellevue, Washington in January 1979, but is now
      headquartered in Redmond.
      """
  ]

  result = text_analytics_client.recognize_linked_entities(documents)
  docs = [doc for doc in result if not doc.is_error]

  print(
      "Let's map each entity to it's Wikipedia article. I also want to see how many times each "
      "entity is mentioned in a document\n\n"
  )
  entity_to_url = {}
  for doc in docs:
      for entity in doc.entities:
          print("Entity '{}' has been mentioned '{}' time(s)".format(
              entity.name, len(entity.matches)
          ))
          if entity.data_source == "Wikipedia":
              entity_to_url[entity.name] = entity.url
  ```

  <!-- END SNIPPET -->

  The returned response is a heterogeneous list of result and error objects: list[[RecognizeLinkedEntitiesResult][recognize_linked_entities_result], [DocumentError][document_error]]

  Please refer to the service documentation for a conceptual discussion of [entity linking][linked_entity_recognition]
  and [supported types][linked_entities_categories].



  [recognize_pii_entities][recognize_pii_entities] recognizes and categorizes Personally Identifiable Information (PII) entities in its input text, such as
  Social Security Numbers, bank account information, credit card numbers, and more.

  <!-- SNIPPET:sample_recognize_pii_entities.recognize_pii_entities -->

  ```python
  import os
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.textanalytics import TextAnalyticsClient

  endpoint = os.environ["AZURE_LANGUAGE_ENDPOINT"]
  key = os.environ["AZURE_LANGUAGE_KEY"]

  text_analytics_client = TextAnalyticsClient(
      endpoint=endpoint, credential=AzureKeyCredential(key)
  )
  documents = [
      """Parker Doe has repaid all of their loans as of 2020-04-25.
      Their SSN is 859-98-0987. To contact them, use their phone number
      555-555-5555. They are originally from Brazil and have Brazilian CPF number 998.214.865-68"""
  ]

  result = text_analytics_client.recognize_pii_entities(documents)
  docs = [doc for doc in result if not doc.is_error]

  print(
      "Let's compare the original document with the documents after redaction. "
      "I also want to comb through all of the entities that got redacted"
  )
  for idx, doc in enumerate(docs):
      print(f"Document text: {documents[idx]}")
      print(f"Redacted document text: {doc.redacted_text}")
      for entity in doc.entities:
          print("...Entity '{}' with category '{}' got redacted".format(
              entity.text, entity.category
          ))
  ```

  <!-- END SNIPPET -->

  The returned response is a heterogeneous list of result and error objects: list[[RecognizePiiEntitiesResult][recognize_pii_entities_result], [DocumentError][document_error]]

  Please refer to the service documentation for [supported PII entity types][pii_entity_categories].

  Note: The Recognize PII Entities service is available in API version v3.1 and newer.



  [extract_key_phrases][extract_key_phrases] determines the main talking points in its input text. For example, for the input text "The food was delicious and there were wonderful staff", the API returns: "food" and "wonderful staff".

  <!-- SNIPPET:sample_extract_key_phrases.extract_key_phrases -->

  ```python
  import os
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.textanalytics import TextAnalyticsClient

  endpoint = os.environ["AZURE_LANGUAGE_ENDPOINT"]
  key = os.environ["AZURE_LANGUAGE_KEY"]

  text_analytics_client = TextAnalyticsClient(endpoint=endpoint, credential=AzureKeyCredential(key))
  articles = [
      """
      Washington, D.C. Autumn in DC is a uniquely beautiful season. The leaves fall from the trees
      in a city chock-full of forests, leaving yellow leaves on the ground and a clearer view of the
      blue sky above...
      """,
      """
      Redmond, WA. In the past few days, Microsoft has decided to further postpone the start date of
      its United States workers, due to the pandemic that rages with no end in sight...
      """,
      """
      Redmond, WA. Employees at Microsoft can be excited about the new coffee shop that will open on campus
      once workers no longer have to work remotely...
      """
  ]

  result = text_analytics_client.extract_key_phrases(articles)
  for idx, doc in enumerate(result):
      if not doc.is_error:
          print("Key phrases in article #{}: {}".format(
              idx + 1,
              ", ".join(doc.key_phrases)
          ))
  ```

  <!-- END SNIPPET -->

  The returned response is a heterogeneous list of result and error objects: list[[ExtractKeyPhrasesResult][extract_key_phrases_result], [DocumentError][document_error]]

  Please refer to the service documentation for a conceptual discussion of [key phrase extraction][key_phrase_extraction].



  [detect_language][detect_language] determines the language of its input text, including the confidence score of the predicted language.

  <!-- SNIPPET:sample_detect_language.detect_language -->

  ```python
  import os
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.textanalytics import TextAnalyticsClient

  endpoint = os.environ["AZURE_LANGUAGE_ENDPOINT"]
  key = os.environ["AZURE_LANGUAGE_KEY"]

  text_analytics_client = TextAnalyticsClient(endpoint=endpoint, credential=AzureKeyCredential(key))
  documents = [
      """
      The concierge Paulette was extremely helpful. Sadly when we arrived the elevator was broken, but with Paulette's help we barely noticed this inconvenience.
      She arranged for our baggage to be brought up to our room with no extra charge and gave us a free meal to refurbish all of the calories we lost from
      walking up the stairs :). Can't say enough good things about my experience!
      """,
      """
      最近由于工作压力太大，我们决定去富酒店度假。那儿的温泉实在太舒服了，我跟我丈夫都完全恢复了工作前的青春精神！加油！
      """
  ]

  result = text_analytics_client.detect_language(documents)
  reviewed_docs = [doc for doc in result if not doc.is_error]

  print("Let's see what language each review is in!")

  for idx, doc in enumerate(reviewed_docs):
      print("Review #{} is in '{}', which has ISO639-1 name '{}'\n".format(
          idx, doc.primary_language.name, doc.primary_language.iso6391_name
      ))
  ```

  <!-- END SNIPPET -->

  The returned response is a heterogeneous list of result and error objects: list[[DetectLanguageResult][detect_language_result], [DocumentError][document_error]]

  Please refer to the service documentation for a conceptual discussion of [language detection][language_detection]
  and [language and regional support][language_and_regional_support].



  [Long-running operation](#long-running-operations) [begin_analyze_healthcare_entities][analyze_healthcare_entities] extracts entities recognized within the healthcare domain, and identifies relationships between entities within the input document and links to known sources of information in various well known databases, such as UMLS, CHV, MSH, etc.

  <!-- SNIPPET:sample_analyze_healthcare_entities.analyze_healthcare_entities -->

  ```python
  import os
  import typing
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.textanalytics import TextAnalyticsClient, HealthcareEntityRelation

  endpoint = os.environ["AZURE_LANGUAGE_ENDPOINT"]
  key = os.environ["AZURE_LANGUAGE_KEY"]

  text_analytics_client = TextAnalyticsClient(
      endpoint=endpoint,
      credential=AzureKeyCredential(key),
  )

  documents = [
      """
      Patient needs to take 100 mg of ibuprofen, and 3 mg of potassium. Also needs to take
      10 mg of Zocor.
      """,
      """
      Patient needs to take 50 mg of ibuprofen, and 2 mg of Coumadin.
      """
  ]

  poller = text_analytics_client.begin_analyze_healthcare_entities(documents)
  result = poller.result()

  docs = [doc for doc in result if not doc.is_error]

  print("Let's first visualize the outputted healthcare result:")
  for doc in docs:
      for entity in doc.entities:
          print(f"Entity: {entity.text}")
          print(f"...Normalized Text: {entity.normalized_text}")
          print(f"...Category: {entity.category}")
          print(f"...Subcategory: {entity.subcategory}")
          print(f"...Offset: {entity.offset}")
          print(f"...Confidence score: {entity.confidence_score}")
          if entity.data_sources is not None:
              print("...Data Sources:")
              for data_source in entity.data_sources:
                  print(f"......Entity ID: {data_source.entity_id}")
                  print(f"......Name: {data_source.name}")
          if entity.assertion is not None:
              print("...Assertion:")
              print(f"......Conditionality: {entity.assertion.conditionality}")
              print(f"......Certainty: {entity.assertion.certainty}")
              print(f"......Association: {entity.assertion.association}")
      for relation in doc.entity_relations:
          print(f"Relation of type: {relation.relation_type} has the following roles")
          for role in relation.roles:
              print(f"...Role '{role.name}' with entity '{role.entity.text}'")
      print("------------------------------------------")

  print("Now, let's get all of medication dosage relations from the documents")
  dosage_of_medication_relations = [
      entity_relation
      for doc in docs
      for entity_relation in doc.entity_relations if entity_relation.relation_type == HealthcareEntityRelation.DOSAGE_OF_MEDICATION
  ]
  ```

  <!-- END SNIPPET -->

  Note: Healthcare Entities Analysis is only available with API version v3.1 and newer.



  [Long-running operation](#long-running-operations) [begin_analyze_actions][analyze_actions] performs multiple analyses over one set of documents in a single request. Currently it is supported using any combination of the following Language APIs in a single request:

  - Entities Recognition
  - PII Entities Recognition
  - Linked Entity Recognition
  - Key Phrase Extraction
  - Sentiment Analysis
  - Custom Entity Recognition (API version 2022-05-01 and newer)
  - Custom Single Label Classification (API version 2022-05-01 and newer)
  - Custom Multi Label Classification (API version 2022-05-01 and newer)
  - Healthcare Entities Analysis (API version 2022-05-01 and newer)
  - Extractive Summarization (API version 2023-04-01 and newer)
  - Abstractive Summarization (API version 2023-04-01 and newer)

  <!-- SNIPPET:sample_analyze_actions.analyze -->

  ```python
  import os
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.textanalytics import (
      TextAnalyticsClient,
      RecognizeEntitiesAction,
      RecognizeLinkedEntitiesAction,
      RecognizePiiEntitiesAction,
      ExtractKeyPhrasesAction,
      AnalyzeSentimentAction,
  )

  endpoint = os.environ["AZURE_LANGUAGE_ENDPOINT"]
  key = os.environ["AZURE_LANGUAGE_KEY"]

  text_analytics_client = TextAnalyticsClient(
      endpoint=endpoint,
      credential=AzureKeyCredential(key),
  )

  documents = [
      'We went to Contoso Steakhouse located at midtown NYC last week for a dinner party, and we adore the spot! '
      'They provide marvelous food and they have a great menu. The chief cook happens to be the owner (I think his name is John Doe) '
      'and he is super nice, coming out of the kitchen and greeted us all.'
      ,

      'We enjoyed very much dining in the place! '
      'The Sirloin steak I ordered was tender and juicy, and the place was impeccably clean. You can even pre-order from their '
      'online menu at www.contososteakhouse.com, call 312-555-0176 or send email to order@contososteakhouse.com! '
      'The only complaint I have is the food didn\'t come fast enough. Overall I highly recommend it!'
  ]

  poller = text_analytics_client.begin_analyze_actions(
      documents,
      display_name="Sample Text Analysis",
      actions=[
          RecognizeEntitiesAction(),
          RecognizePiiEntitiesAction(),
          ExtractKeyPhrasesAction(),
          RecognizeLinkedEntitiesAction(),
          AnalyzeSentimentAction(),
      ],
  )

  document_results = poller.result()
  for doc, action_results in zip(documents, document_results):
      print(f"\nDocument text: {doc}")
      for result in action_results:
          if result.kind == "EntityRecognition":
              print("...Results of Recognize Entities Action:")
              for entity in result.entities:
                  print(f"......Entity: {entity.text}")
                  print(f".........Category: {entity.category}")
                  print(f".........Confidence Score: {entity.confidence_score}")
                  print(f".........Offset: {entity.offset}")

          elif result.kind == "PiiEntityRecognition":
              print("...Results of Recognize PII Entities action:")
              for pii_entity in result.entities:
                  print(f"......Entity: {pii_entity.text}")
                  print(f".........Category: {pii_entity.category}")
                  print(f".........Confidence Score: {pii_entity.confidence_score}")

          elif result.kind == "KeyPhraseExtraction":
              print("...Results of Extract Key Phrases action:")
              print(f"......Key Phrases: {result.key_phrases}")

          elif result.kind == "EntityLinking":
              print("...Results of Recognize Linked Entities action:")
              for linked_entity in result.entities:
                  print(f"......Entity name: {linked_entity.name}")
                  print(f".........Data source: {linked_entity.data_source}")
                  print(f".........Data source language: {linked_entity.language}")
                  print(
                      f".........Data source entity ID: {linked_entity.data_source_entity_id}"
                  )
                  print(f".........Data source URL: {linked_entity.url}")
                  print(".........Document matches:")
                  for match in linked_entity.matches:
                      print(f"............Match text: {match.text}")
                      print(f"............Confidence Score: {match.confidence_score}")
                      print(f"............Offset: {match.offset}")
                      print(f"............Length: {match.length}")

          elif result.kind == "SentimentAnalysis":
              print("...Results of Analyze Sentiment action:")
              print(f"......Overall sentiment: {result.sentiment}")
              print(
                  f"......Scores: positive={result.confidence_scores.positive}; \
                  neutral={result.confidence_scores.neutral}; \
                  negative={result.confidence_scores.negative} \n"
              )

          elif result.is_error is True:
              print(
                  f"...Is an error with code '{result.error.code}' and message '{result.error.message}'"
              )

      print("------------------------------------------")
  ```

  <!-- END SNIPPET -->

  The returned response is an object encapsulating multiple iterables, each representing results of individual analyses.

  Note: Multiple analysis is available in API version v3.1 and newer.



  Optional keyword arguments can be passed in at the client and per-operation level.
  The azure-core [reference documentation][azure_core_ref_docs]
  describes available configurations for retries, logging, transport protocols, and more.





  The Text Analytics client will raise exceptions defined in [Azure Core][azure_core].



  This library uses the standard
  [logging][python_logging] library for logging.
  Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
  level.

  Detailed DEBUG level logging, including request/response bodies and unredacted
  headers, can be enabled on a client with the `logging_enable` keyword argument:

  ```python
  import sys
  import logging
  from azure.identity import DefaultAzureCredential
  from azure.ai.textanalytics import TextAnalyticsClient


  logger = logging.getLogger('azure')
  logger.setLevel(logging.DEBUG)


  handler = logging.StreamHandler(stream=sys.stdout)
  logger.addHandler(handler)

  endpoint = "https://<resource-name>.cognitiveservices.azure.com/"
  credential = DefaultAzureCredential()


  text_analytics_client = TextAnalyticsClient(endpoint, credential, logging_enable=True)
  result = text_analytics_client.analyze_sentiment(["I did not like the restaurant. The food was too spicy."])
  ```

  Similarly, `logging_enable` can enable detailed logging for a single operation,
  even when it isn't enabled for the client:

  ```python
  result = text_analytics_client.analyze_sentiment(documents, logging_enable=True)
  ```





  These code samples show common scenario operations with the Azure Text Analytics client library.

  Authenticate the client with a Cognitive Services/Language service API key or a token credential from [azure-identity][azure_identity]:

  - [sample_authentication.py][sample_authentication] ([async version][sample_authentication_async])

  Common scenarios

  - Analyze sentiment: [sample_analyze_sentiment.py][analyze_sentiment_sample] ([async version][analyze_sentiment_sample_async])
  - Recognize entities: [sample_recognize_entities.py][recognize_entities_sample] ([async version][recognize_entities_sample_async])
  - Recognize personally identifiable information: [sample_recognize_pii_entities.py][recognize_pii_entities_sample] ([async version][recognize_pii_entities_sample_async])
  - Recognize linked entities: [sample_recognize_linked_entities.py][recognize_linked_entities_sample] ([async version][recognize_linked_entities_sample_async])
  - Extract key phrases: [sample_extract_key_phrases.py][extract_key_phrases_sample] ([async version][extract_key_phrases_sample_async])
  - Detect language: [sample_detect_language.py][detect_language_sample] ([async version][detect_language_sample_async])
  - Healthcare Entities Analysis: [sample_analyze_healthcare_entities.py][analyze_healthcare_entities_sample] ([async version][analyze_healthcare_entities_sample_async])
  - Multiple Analysis: [sample_analyze_actions.py][analyze_sample] ([async version][analyze_sample_async])
  - Custom Entity Recognition: [sample_recognize_custom_entities.py][recognize_custom_entities_sample] ([async_version][recognize_custom_entities_sample_async])
  - Custom Single Label Classification: [sample_single_label_classify.py][single_label_classify_sample] ([async_version][single_label_classify_sample_async])
  - Custom Multi Label Classification: [sample_multi_label_classify.py][multi_label_classify_sample] ([async_version][multi_label_classify_sample_async])
  - Extractive text summarization: [sample_extract_summary.py][extract_summary_sample] ([async version][extract_summary_sample_async])
  - Abstractive text summarization: [sample_abstract_summary.py][abstract_summary_sample] ([async version][abstract_summary_sample_async])

  Advanced scenarios

  - Opinion Mining: [sample_analyze_sentiment_with_opinion_mining.py][opinion_mining_sample] ([async_version][opinion_mining_sample_async])



  For more extensive documentation on Azure Cognitive Service for Language, see the [Language Service documentation][language_product_documentation] on docs.microsoft.com.



  This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.

  <!-- LINKS -->

  [source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics
  [ta_pypi]: https://pypi.org/project/azure-ai-textanalytics/
  [ta_ref_docs]: https://aka.ms/azsdk-python-textanalytics-ref-docs
  [ta_samples]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples
  [language_product_documentation]: https://docs.microsoft.com/azure/cognitive-services/language-service
  [azure_subscription]: https://azure.microsoft.com/free/
  [ta_or_cs_resource]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows
  [pip]: https://pypi.org/project/pip/
  [azure_portal_create_ta_resource]: https://ms.portal.azure.com/#create/Microsoft.CognitiveServicesTextAnalytics
  [azure_cli]: https://docs.microsoft.com/cli/azure
  [azure_cli_create_ta_resource]: https://learn.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account-cli
  [multi_and_single_service]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows
  [azure_cli_endpoint_lookup]: https://docs.microsoft.com/cli/azure/cognitiveservices/account?view=azure-cli-latest#az-cognitiveservices-account-show
  [azure_portal_get_endpoint]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows#get-the-keys-for-your-resource
  [cognitive_authentication]: https://docs.microsoft.com/azure/cognitive-services/authentication
  [cognitive_authentication_api_key]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows#get-the-keys-for-your-resource
  [install_azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#install-the-package
  [register_aad_app]: https://docs.microsoft.com/azure/cognitive-services/authentication#assign-a-role-to-a-service-principal
  [grant_role_access]: https://docs.microsoft.com/azure/cognitive-services/authentication#assign-a-role-to-a-service-principal
  [cognitive_custom_subdomain]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-custom-subdomains
  [custom_subdomain]: https://docs.microsoft.com/azure/cognitive-services/authentication#create-a-resource-with-a-custom-subdomain
  [cognitive_authentication_aad]: https://docs.microsoft.com/azure/cognitive-services/authentication#authenticate-with-azure-active-directory
  [azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
  [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
  [service_limits]: https://aka.ms/azsdk/textanalytics/data-limits
  [azure-key-credential]: https://aka.ms/azsdk-python-core-azurekeycredential
  [document_error]: https://aka.ms/azsdk-python-textanalytics-documenterror
  [detect_language_result]: https://aka.ms/azsdk-python-textanalytics-detectlanguageresult
  [recognize_entities_result]: https://aka.ms/azsdk-python-textanalytics-recognizeentitiesresult
  [recognize_pii_entities_result]: https://aka.ms/azsdk-python-textanalytics-recognizepiientitiesresult
  [recognize_linked_entities_result]: https://aka.ms/azsdk-python-textanalytics-recognizelinkedentitiesresult
  [analyze_sentiment_result]: https://aka.ms/azsdk-python-textanalytics-analyzesentimentresult
  [extract_key_phrases_result]: https://aka.ms/azsdk-python-textanalytics-extractkeyphrasesresult
  [text_document_input]: https://aka.ms/azsdk-python-textanalytics-textdocumentinput
  [detect_language_input]: https://aka.ms/azsdk-python-textanalytics-detectlanguageinput
  [text_analytics_client]: https://aka.ms/azsdk-python-textanalytics-textanalyticsclient
  [analyze_sentiment]: https://aka.ms/azsdk-python-textanalytics-analyzesentiment
  [analyze_actions]: https://aka.ms/azsdk/python/docs/ref/textanalytics#azure.ai.textanalytics.TextAnalyticsClient.begin_analyze_actions
  [analyze_healthcare_entities]: https://aka.ms/azsdk/python/docs/ref/textanalytics#azure.ai.textanalytics.TextAnalyticsClient.begin_analyze_healthcare_entities
  [recognize_entities]: https://aka.ms/azsdk-python-textanalytics-recognizeentities
  [recognize_pii_entities]: https://aka.ms/azsdk-python-textanalytics-recognizepiientities
  [recognize_linked_entities]: https://aka.ms/azsdk-python-textanalytics-recognizelinkedentities
  [extract_key_phrases]: https://aka.ms/azsdk-python-textanalytics-extractkeyphrases
  [detect_language]: https://aka.ms/azsdk-python-textanalytics-detectlanguage
  [language_detection]: https://docs.microsoft.com/azure/cognitive-services/language-service/language-detection/overview
  [language_and_regional_support]: https://docs.microsoft.com/azure/cognitive-services/language-service/language-detection/language-support
  [sentiment_analysis]: https://docs.microsoft.com/azure/cognitive-services/language-service/sentiment-opinion-mining/overview
  [key_phrase_extraction]: https://docs.microsoft.com/azure/cognitive-services/language-service/key-phrase-extraction/overview
  [linked_entities_categories]: https://aka.ms/taner
  [linked_entity_recognition]: https://docs.microsoft.com/azure/cognitive-services/language-service/entity-linking/overview
  [pii_entity_categories]: https://aka.ms/azsdk/language/pii
  [named_entity_recognition]: https://docs.microsoft.com/azure/cognitive-services/language-service/named-entity-recognition/overview
  [named_entity_categories]: https://aka.ms/taner
  [azure_core_ref_docs]: https://aka.ms/azsdk-python-core-policies
  [azure_core]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity
  [python_logging]: https://docs.python.org/3/library/logging.html
  [sample_authentication]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/sample_authentication.py
  [sample_authentication_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_authentication_async.py
  [detect_language_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/sample_detect_language.py
  [detect_language_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_detect_language_async.py
  [analyze_sentiment_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_sentiment.py
  [analyze_sentiment_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_sentiment_async.py
  [extract_key_phrases_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/sample_extract_key_phrases.py
  [extract_key_phrases_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_extract_key_phrases_async.py
  [recognize_entities_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_entities.py
  [recognize_entities_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_entities_async.py
  [recognize_linked_entities_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_linked_entities.py
  [recognize_linked_entities_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_linked_entities_async.py
  [recognize_pii_entities_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_pii_entities.py
  [recognize_pii_entities_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_pii_entities_async.py
  [analyze_healthcare_entities_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_healthcare_entities.py
  [analyze_healthcare_entities_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_healthcare_entities_async.py
  [analyze_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_actions.py
  [analyze_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_actions_async.py
  [opinion_mining_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_sentiment_with_opinion_mining.py
  [opinion_mining_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_analyze_sentiment_with_opinion_mining_async.py
  [recognize_custom_entities_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_custom_entities.py
  [recognize_custom_entities_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_recognize_custom_entities_async.py
  [single_label_classify_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/sample_single_label_classify.py
  [single_label_classify_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_single_label_classify_async.py
  [multi_label_classify_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/sample_multi_label_classify.py
  [multi_label_classify_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_multi_label_classify_async.py
  [healthcare_action_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/sample_analyze_healthcare_action.py
  [extract_summary_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/sample_extract_summary.py
  [extract_summary_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_extract_summary_async.py
  [abstract_summary_sample]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/sample_abstract_summary.py
  [abstract_summary_sample_async]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/textanalytics/azure-ai-textanalytics/samples/async_samples/sample_abstract_summary_async.py
  [cla]: https://cla.microsoft.com
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
  [coc_contact]: mailto:opencode@microsoft.com






  This version of the client library defaults to the service API version `2023-04-01`.



  > Note: The following changes are only breaking from the previous beta. They are not breaking against previous stable versions.

  - Renamed model `ExtractSummaryAction` to `ExtractiveSummaryAction`.
  - Renamed model `ExtractSummaryResult` to `ExtractiveSummaryResult`.
  - Renamed client method `begin_abstractive_summary` to `begin_abstract_summary`.
  - Removed `dynamic_classification` client method and related types: `DynamicClassificationResult` and `ClassificationType`.
  - Removed keyword arguments `fhir_version` and `document_type` from `begin_analyze_healthcare_entities` and `AnalyzeHealthcareEntitiesAction`.
  - Removed property `fhir_bundle` from `AnalyzeHealthcareEntitiesResult`.
  - Removed enum `HealthcareDocumentType`.
  - Removed property `resolutions` from `CategorizedEntity`.
  - Removed models and enums related to resolutions: `ResolutionKind`, `AgeResolution`, `AreaResolution`,
    `CurrencyResolution`, `DateTimeResolution`, `InformationResolution`, `LengthResolution`,
    `NumberResolution`, `NumericRangeResolution`, `OrdinalResolution`, `SpeedResolution`, `TemperatureResolution`,
    `TemporalSpanResolution`, `VolumeResolution`, `WeightResolution`, `AgeUnit`, `AreaUnit`, `TemporalModifier`,
    `InformationUnit`, `LengthUnit`, `NumberKind`, `RangeKind`, `RelativeTo`, `SpeedUnit`, `TemperatureUnit`,
    `VolumeUnit`, `DateTimeSubKind`, and `WeightUnit`.
  - Removed property `detected_language` from `RecognizeEntitiesResult`, `RecognizePiiEntitiesResult`, `AnalyzeHealthcareEntitiesResult`,
    `ExtractKeyPhrasesResult`, `RecognizeLinkedEntitiesResult`, `AnalyzeSentimentResult`, `RecognizeCustomEntitiesResult`,
    `ClassifyDocumentResult`, `ExtractSummaryResult`, and `AbstractSummaryResult`.
  - Removed property `script` from `DetectedLanguage`.



  - New enum values added for `HealthcareEntityCategory` and `HealthcareEntityRelation`.



  This version of the client library defaults to the service API version `2022-10-01-preview`.



  - Added `begin_extract_summary` client method to perform extractive summarization on documents.
  - Added `begin_abstractive_summary` client method to perform abstractive summarization on documents.



  - Removed models `BaseResolution` and `BooleanResolution`.
  - Removed enum value `BooleanResolution` from `ResolutionKind`.
  - Renamed model `AbstractSummaryAction` to `AbstractiveSummaryAction`.
  - Renamed model `AbstractSummaryResult` to `AbstractiveSummaryResult`.
  - Removed keyword argument `autodetect_default_language` from long-running operation APIs.



   - Improved static typing in the client library.



  This version of the client library defaults to the service API version `2022-10-01-preview`.


  - Added the Extractive Summarization feature and related models: `ExtractSummaryAction`, `ExtractSummaryResult`, and `SummarySentence`.
    Access the feature through the `begin_analyze_actions` API.
  - Added keyword arguments `fhir_version` and `document_type` to `begin_analyze_healthcare_entities` and `AnalyzeHealthcareEntitiesAction`.
  - Added property `fhir_bundle` to `AnalyzeHealthcareEntitiesResult`.
  - Added property `confidence_score` to `HealthcareRelation`.
  - Added enum `HealthcareDocumentType`.
  - Added property `resolutions` to `CategorizedEntity`.
  - Added models and enums related to resolutions: `BaseResolution`, `ResolutionKind`, `AgeResolution`, `AreaResolution`,
    `BooleanResolution`, `CurrencyResolution`, `DateTimeResolution`, `InformationResolution`, `LengthResolution`,
    `NumberResolution`, `NumericRangeResolution`, `OrdinalResolution`, `SpeedResolution`, `TemperatureResolution`,
    `TemporalSpanResolution`, `VolumeResolution`, `WeightResolution`, `AgeUnit`, `AreaUnit`, `TemporalModifier`,
    `InformationUnit`, `LengthUnit`, `NumberKind`, `RangeKind`, `RelativeTo`, `SpeedUnit`, `TemperatureUnit`,
    `VolumeUnit`, `DateTimeSubKind`, and `WeightUnit`.
  - Added the Abstractive Summarization feature and related models: `AbstractSummaryAction`, `AbstractSummaryResult`, `AbstractiveSummary`,
    and `SummaryContext`. Access the feature through the `begin_analyze_actions` API.
  - Added automatic language detection to long-running operation APIs. Pass `auto` into the document `language` hint to use this feature.
  - Added `autodetect_default_language` to long-running operation APIs. Pass as the default/fallback language for automatic language detection.
  - Added property `detected_language` to `RecognizeEntitiesResult`, `RecognizePiiEntitiesResult`, `AnalyzeHealthcareEntitiesResult`,
    `ExtractKeyPhrasesResult`, `RecognizeLinkedEntitiesResult`, `AnalyzeSentimentResult`, `RecognizeCustomEntitiesResult`,
    `ClassifyDocumentResult`, `ExtractSummaryResult`, and `AbstractSummaryResult` to indicate the language detected by automatic language detection.
  - Added property `script` to `DetectedLanguage` to indicate the script of the input document.
  - Added the `dynamic_classification` client method to perform dynamic classification on documents without needing to train a model.


  - Removed dependency on `msrest`.




  - Returns a more helpful message in the document error when all documents fail for an action in the `begin_analyze_actions` API.





  This version of the client library marks a stable release and defaults to the service API version `2022-05-01`.
  Includes all changes from `5.2.0b1` to `5.2.0b5`.



  The version of this client library defaults to the API version `2022-05-01`.



  - Added `begin_recognize_custom_entities` client method to recognize custom named entities in documents.
  - Added `begin_single_label_classify` client method to perform custom single label classification on documents.
  - Added `begin_multi_label_classify` client method to perform custom multi label classification on documents.
  - Added property `details` on returned poller objects which contain long-running operation metadata.
  - Added `TextAnalysisLROPoller` and `AsyncTextAnalysisLROPoller` protocols to describe the return types from long-running operations.
  - Added `cancel` method on the poller objects. Call it to cancel a long-running operation that's in progress.
  - Added property `kind` to `RecognizeEntitiesResult`, `RecognizePiiEntitiesResult`, `AnalyzeHealthcareEntitiesResult`,
    `DetectLanguageResult`, `ExtractKeyPhrasesResult`, `RecognizeLinkedEntitiesResult`, `AnalyzeSentimentResult`,
    `RecognizeCustomEntitiesResult`, `ClassifyDocumentResult`, and `DocumentError`.
  - Added enum `TextAnalysisKind`.



  - Removed the Extractive Text Summarization feature and related models: `ExtractSummaryAction`, `ExtractSummaryResult`, and `SummarySentence`. To access this beta feature, install the `5.2.0b4` version of the client library.
  - Removed the `FHIR` feature and related keyword argument and property: `fhir_version` and `fhir_bundle`. To access this beta feature, install the `5.2.0b4` version of the client library.
  - `SingleCategoryClassifyResult` and `MultiCategoryClassifyResult` models have been merged into one model: `ClassifyDocumentResult`.
  - Renamed `SingleCategoryClassifyAction` to `SingleLabelClassifyAction`
  - Renamed `MultiCategoryClassifyAction` to `MultiLabelClassifyAction`.



  - A `HttpResponseError` will be immediately raised when the call quota volume is exceeded in a `F0` tier Language resource.



  - Python 3.6 is no longer supported. Please use Python version 3.7 or later. For more details, see [Azure SDK for Python version support policy](https://github.com/Azure/azure-sdk-for-python/wiki/Azure-SDKs-Python-version-support-policy).




  Note that this is the first version of the client library that targets the Azure Cognitive Service for Language APIs which includes the existing text analysis and natural language processing features found in the Text Analytics client library.
  In addition, the service API has changed from semantic to date-based versioning. This version of the client library defaults to the latest supported API version, which currently is `2022-04-01-preview`. Support for `v3.2-preview.2` is removed, however, all functionalities are included in the latest version.



  - Added support for Healthcare Entities Analysis through the `begin_analyze_actions` API with the `AnalyzeHealthcareEntitiesAction` type.
  - Added keyword argument `fhir_version` to `begin_analyze_healthcare_entities` and `AnalyzeHealthcareEntitiesAction`. Use the keyword to indicate the version for the `fhir_bundle` contained on the `AnalyzeHealthcareEntitiesResult`.
  - Added property `fhir_bundle` to `AnalyzeHealthcareEntitiesResult`.
  - Added keyword argument `display_name` to `begin_analyze_healthcare_entities`.




  - `string_index_type` now correctly defaults to the Python default `UnicodeCodePoint` for `AnalyzeSentimentAction` and `RecognizeCustomEntitiesAction`.
  - Fixed a bug in `begin_analyze_actions` where incorrect action types were being sent in the request if targeting the older API version `v3.1` in the beta version of the client library.
  - `string_index_type` option `Utf16CodePoint` is corrected to `Utf16CodeUnit`.


  - Python 2.7 is no longer supported. Please use Python version 3.6 or later.



  This version of the SDK defaults to the latest supported API version, which currently is `v3.2-preview.2`.


  - Added support for Custom Entities Recognition through the `begin_analyze_actions` API with the `RecognizeCustomEntitiesAction` and `RecognizeCustomEntitiesResult` types.
  - Added support for Custom Single Classification through the `begin_analyze_actions` API with the `SingleCategoryClassifyAction` and `SingleCategoryClassifyActionResult` types.
  - Added support for Custom Multi Classification through the `begin_analyze_actions` API with the `MultiCategoryClassifyAction` and `MultiCategoryClassifyActionResult` types.
  - Multiple of the same action type is now supported with `begin_analyze_actions`.


  - Restarting a long-running operation from a saved state is now supported for the `begin_analyze_actions` and `begin_recognize_healthcare_entities` methods.
  - In the event of an action level error, available partial results are now returned for any successful actions in `begin_analyze_actions`.


  - Package requires [azure-core](https://pypi.org/project/azure-core/) version 1.19.1 or greater



  This version of the SDK defaults to the latest supported API version, which currently is `v3.2-preview.1`.


  - Added support for Extractive Summarization actions through the `ExtractSummaryAction` type.


  - `RecognizePiiEntitiesAction` option `disable_service_logs` now correctly defaults to `True`.


  - Python 3.5 is no longer supported.



  This version of the SDK defaults to the latest supported API version, which currently is `v3.1`.
  Includes all changes from `5.1.0b1` to `5.1.0b7`.

  Note: this version will be the last to officially support Python 3.5, future versions will require Python 2.7 or Python 3.6+.



  - Added `catagories_filter` to `RecognizePiiEntitiesAction`
  - Added `HealthcareEntityCategory`
  - Added AAD support for the `begin_analyze_healthcare_entities` methods.



  - Changed: the response structure of `being_analyze_actions`. Now, we return a list of results, where each result is a list of the action results for the document, in the order the documents and actions were passed.
  - Changed: `begin_analyze_actions` now accepts a single action per type. A `ValueError` is raised if duplicate actions are passed.
  - Removed: `AnalyzeActionsType`
  - Removed: `AnalyzeActionsResult`
  - Removed: `AnalyzeActionsError`
  - Removed: `HealthcareEntityRelationRoleType`
  - Changed: renamed `HealthcareEntityRelationType` to `HealthcareEntityRelation`
  - Changed: renamed `PiiEntityCategoryType` to `PiiEntityCategory`
  - Changed: renamed `PiiEntityDomainType` to `PiiEntityDomain`



  **Breaking Changes**
  - Renamed `begin_analyze_batch_actions` to `begin_analyze_actions`.
  - Renamed `AnalyzeBatchActionsType` to `AnalyzeActionsType`.
  - Renamed `AnalyzeBatchActionsResult` to `AnalyzeActionsResult`.
  - Renamed `AnalyzeBatchActionsError` to `AnalyzeActionsError`.
  - Renamed `AnalyzeHealthcareEntitiesResultItem` to `AnalyzeHealthcareEntitiesResult`.
  - Fixed `AnalyzeHealthcareEntitiesResult`'s `statistics` to be the correct type, `TextDocumentStatistics`
  - Remove `RequestStatistics`, use `TextDocumentBatchStatistics` instead

  **New Features**
  - Added enums `EntityConditionality`, `EntityCertainty`, and `EntityAssociation`.
  - Added `AnalyzeSentimentAction` as a supported action type for `begin_analyze_batch_actions`.
  - Added kwarg `disable_service_logs`. If set to true, you opt-out of having your text input logged on the service side for troubleshooting.



  **Breaking Changes**
  - By default, we now target the service's `v3.1-preview.4` endpoint through enum value `TextAnalyticsApiVersion.V3_1_PREVIEW`
  - Removed property `related_entities` on `HealthcareEntity` and added `entity_relations` onto the document response level for healthcare
  - Renamed properties `aspect` and `opinions` to `target` and `assessments` respectively in class `MinedOpinion`.
  - Renamed classes `AspectSentiment` and `OpinionSentiment` to `TargetSentiment` and `AssessmentSentiment` respectively.

  **New Features**
  - Added `RecognizeLinkedEntitiesAction` as a supported action type for `begin_analyze_batch_actions`.
  - Added parameter `categories_filter` to the `recognize_pii_entities` client method.
  - Added enum `PiiEntityCategoryType`.
  - Add property `normalized_text` to `HealthcareEntity`. This property is a normalized version of the `text` property that already
  exists on the `HealthcareEntity`
  - Add property `assertion` onto `HealthcareEntity`. This contains assertions about the entity itself, i.e. if the entity represents a diagnosis,
  is this diagnosis conditional on a symptom?

  **Known Issues**

  - `begin_analyze_healthcare_entities` is currently in gated preview and can not be used with AAD credentials. For more information, see [the Text Analytics for Health documentation](https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-for-health?tabs=ner#request-access-to-the-public-preview).
  - At time of this SDK release, the service is not respecting the value passed through `model_version` to `begin_analyze_healthcare_entities`, it only uses the latest model.



  **Breaking Changes**

  - Rename `begin_analyze` to `begin_analyze_batch_actions`.
  - Now instead of separate parameters for all of the different types of actions you can pass to `begin_analyze_batch_actions`, we accept one parameter `actions`,
  which is a list of actions you would like performed. The results of the actions are returned in the same order as when inputted.
  - The response object from `begin_analyze_batch_actions` has also changed. Now, after the completion of your long running operation, we return a paged iterable
  of action results, in the same order they've been inputted. The actual document results for each action are included under property `document_results` of
  each action result.

  **New Features**
  - Renamed `begin_analyze_healthcare` to `begin_analyze_healthcare_entities`.
  - Renamed `AnalyzeHealthcareResult` to `AnalyzeHealthcareEntitiesResult` and `AnalyzeHealthcareResultItem` to `AnalyzeHealthcareEntitiesResultItem`.
  - Renamed `HealthcareEntityLink` to `HealthcareEntityDataSource` and renamed its properties `id` to `entity_id` and `data_source` to `name`.
  - Removed `relations` from `AnalyzeHealthcareEntitiesResultItem` and added `related_entities` to `HealthcareEntity`.
  - Moved the cancellation logic for the Analyze Healthcare Entities service from
  the service client to the poller object returned from `begin_analyze_healthcare_entities`.
  - Exposed Analyze Healthcare Entities operation metadata on the poller object returned from `begin_analyze_healthcare_entities`.
  - No longer need to specify `api_version=TextAnalyticsApiVersion.V3_1_PREVIEW_3` when calling `begin_analyze` and `begin_analyze_healthcare_entities`. `begin_analyze_healthcare_entities` is still in gated preview though.
  - Added a new parameter `string_index_type` to the service client methods `begin_analyze_healthcare_entities`, `analyze_sentiment`, `recognize_entities`, `recognize_pii_entities`, and `recognize_linked_entities` which tells the service how to interpret string offsets.
  - Added property `length` to `CategorizedEntity`, `SentenceSentiment`, `LinkedEntityMatch`, `AspectSentiment`, `OpinionSentiment`, `PiiEntity` and
  `HealthcareEntity`.



  **Bug Fixes**

  - Package requires [azure-core](https://pypi.org/project/azure-core/) version 1.8.2 or greater




  **New Features**
  - We have added method `begin_analyze`, which supports long-running batch process of Named Entity Recognition, Personally identifiable Information, and Key Phrase Extraction. To use, you must specify `api_version=TextAnalyticsApiVersion.V3_1_PREVIEW_3` when creating your client.
  - We have added method `begin_analyze_healthcare`, which supports the service's Health API. Since the Health API is currently only available in a gated preview, you need to have your subscription on the service's allow list, and you must specify `api_version=TextAnalyticsApiVersion.V3_1_PREVIEW_3` when creating your client. Note that since this is a gated preview, AAD is not supported. More information [here](https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-for-health?tabs=ner#request-access-to-the-public-preview).




  **Breaking changes**
  - Removed property `length` from `CategorizedEntity`, `SentenceSentiment`, `LinkedEntityMatch`, `AspectSentiment`, `OpinionSentiment`, and `PiiEntity`.
  To get the length of the text in these models, just call `len()` on the `text` property.
  - When a parameter or endpoint is not compatible with the API version you specify, we will now return a `ValueError` instead of a `NotImplementedError`.
  - Client side validation of input is now disabled by default. This means there will be no `ValidationError`s thrown by the client SDK in the case of malformed input. The error will now be thrown by the service through an `HttpResponseError`.



  **New features**
  - We are now targeting the service's v3.1-preview API as the default. If you would like to still use version v3.0 of the service,
  pass in `v3.0` to the kwarg `api_version` when creating your TextAnalyticsClient
  - We have added an API `recognize_pii_entities` which returns entities containing personally identifiable information for a batch of documents. Only available for API version v3.1-preview and up.
  - Added `offset` and `length` properties for `CategorizedEntity`, `SentenceSentiment`, and `LinkedEntityMatch`. These properties are only available for API versions v3.1-preview and up.
    - `length` is the number of characters in the text of these models
    - `offset` is the offset of the text from the start of the document
  - We now have added support for opinion mining. To use this feature, you need to make sure you are using the service's
  v3.1-preview API. To get this support pass `show_opinion_mining` as True when calling the `analyze_sentiment` endpoint
  - Add property `bing_entity_search_api_id` to the `LinkedEntity` class. This property is only available for v3.1-preview and up, and it is to be
  used in conjunction with the Bing Entity Search API to fetch additional relevant information about the returned entity.



  - Re-release of GA version 1.0.0 with an updated version



  - First stable release of the azure-ai-textanalytics package. Targets the service's v3.0 API.



  **New features**
  - We now have a `warnings` property on each document-level response object returned from the endpoints. It is a list of `TextAnalyticsWarning`s.
  - Added `text` property to `SentenceSentiment`

  **Breaking changes**
  - Now targets only the service's v3.0 API, instead of the v3.0-preview.1 API
  - `score` attribute of `DetectedLanguage` has been renamed to `confidence_score`
  - Removed `grapheme_offset` and `grapheme_length` from `CategorizedEntity`, `SentenceSentiment`, and `LinkedEntityMatch`
  - `TextDocumentStatistics` attribute `grapheme_count` has been renamed to `character_count`



  - This was a broken release



  **Breaking changes**
  - Removed the `recognize_pii_entities` endpoint and all related models (`RecognizePiiEntitiesResult` and `PiiEntity`)
  from this library.
  - Removed `TextAnalyticsApiKeyCredential` and now using `AzureKeyCredential` from azure.core.credentials as key credential
  - `score` attribute has been renamed to `confidence_score` for the `CategorizedEntity`, `LinkedEntityMatch`, and
  `PiiEntity` models
  - All input parameters `inputs` have been renamed to `documents`



  **Breaking changes**
  - `SentimentScorePerLabel` has been renamed to `SentimentConfidenceScores`
  - `AnalyzeSentimentResult` and `SentenceSentiment` attribute `sentiment_scores` has been renamed to `confidence_scores`
  - `TextDocumentStatistics` attribute `character_count` has been renamed to `grapheme_count`
  - `LinkedEntity` attribute `id` has been renamed to `data_source_entity_id`
  - Parameters `country_hint` and `language` are now passed as keyword arguments
  - The keyword argument `response_hook` has been renamed to `raw_response_hook`
  - `length` and `offset` attributes have been renamed to `grapheme_length` and `grapheme_offset` for the `SentenceSentiment`,
  `CategorizedEntity`, `PiiEntity`, and `LinkedEntityMatch` models

  **New features**
  - Pass `country_hint="none"` to not use the default country hint of `"US"`.

  **Dependency updates**
  - Adopted [azure-core](https://pypi.org/project/azure-core/) version 1.3.0 or greater



  **Breaking changes**

  - The single text, module-level operations `single_detect_language()`, `single_recognize_entities()`, `single_extract_key_phrases()`, `single_analyze_sentiment()`, `single_recognize_pii_entities()`, and `single_recognize_linked_entities()`
  have been removed from the client library. Use the batching methods for optimal performance in production environments.
  - To use an API key as the credential for authenticating the client, a new credential class `TextAnalyticsApiKeyCredential("<api_key>")` must be passed in for the `credential` parameter.
  Passing the API key as a string is no longer supported.
  - `detect_languages()` is renamed to `detect_language()`.
  - The `TextAnalyticsError` model has been simplified to an object with only attributes `code`, `message`, and `target`.
  - `NamedEntity` has been renamed to `CategorizedEntity` and its attributes `type` to `category` and `subtype` to `subcategory`.
  - `RecognizePiiEntitiesResult` now contains on the object a list of `PiiEntity` instead of `NamedEntity`.
  - `AnalyzeSentimentResult` attribute `document_scores` has been renamed to `sentiment_scores`.
  - `SentenceSentiment` attribute `sentence_scores` has been renamed to `sentiment_scores`.
  - `SentimentConfidenceScorePerLabel` has been renamed to `SentimentScorePerLabel`.
  - `DetectLanguageResult` no longer has attribute `detected_languages`. Use `primary_language` to access the detected language in text.

  **New features**

  - Credential class `TextAnalyticsApiKeyCredential` provides an `update_key()` method which allows you to update the API key for long-lived clients.

  **Fixes and improvements**

  - `__repr__` has been added to all of the response objects.
  - If you try to access a result attribute on a `DocumentError` object, an `AttributeError` is raised with a custom error message that provides the document ID and error of the invalid document.




  Version (1.0.0b1) is the first preview of our efforts to create a user-friendly and Pythonic client library for Azure Text Analytics. For more information about this, and preview releases of other Azure SDK libraries, please visit
  https://azure.github.io/azure-sdk/releases/latest/python.html.

  **Breaking changes: New API design**

  - New namespace/package name:
    - The namespace/package name for Azure Text Analytics client library has changed from `azure.cognitiveservices.language.textanalytics` to `azure.ai.textanalytics`

  - New operations and naming:
    - `detect_language` is renamed to `detect_languages`
    - `entities` is renamed to `recognize_entities`
    - `key_phrases` is renamed to `extract_key_phrases`
    - `sentiment` is renamed to `analyze_sentiment`
    - New operation `recognize_pii_entities` finds personally identifiable information entities in text
    - New operation `recognize_linked_entities` provides links from a well-known knowledge base for each recognized entity
    - New module-level operations `single_detect_language`, `single_recognize_entities`, `single_extract_key_phrases`, `single_analyze_sentiment`, `single_recognize_pii_entities`, and `single_recognize_linked_entities` perform
    function on a single string instead of a batch of text documents and can be imported from the `azure.ai.textanalytics` namespace.
    - New client and module-level async APIs added to subnamespace `azure.ai.textanalytics.aio`.
    - `MultiLanguageInput` has been renamed to `TextDocumentInput`
    - `LanguageInput` has been renamed to `DetectLanguageInput`
    - `DocumentLanguage` has been renamed to `DetectLanguageResult`
    - `DocumentEntities` has been renamed to `RecognizeEntitiesResult`
    - `DocumentLinkedEntities` has been renamed to `RecognizeLinkedEntitiesResult`
    - `DocumentKeyPhrases` has been renamed to `ExtractKeyPhrasesResult`
    - `DocumentSentiment` has been renamed to `AnalyzeSentimentResult`
    - `DocumentStatistics` has been renamed to `TextDocumentStatistics`
    - `RequestStatistics` has been renamed to `TextDocumentBatchStatistics`
    - `Entity` has been renamed to `NamedEntity`
    - `Match` has been renamed to `LinkedEntityMatch`
    - The batching methods' `documents` parameter has been renamed `inputs`

  - New input types:
    - `detect_languages` can take as input a `list[DetectLanguageInput]` or a `list[str]`. A list of dict-like objects in the same shape as `DetectLanguageInput` is still accepted as input.
    - `recognize_entities`, `recognize_pii_entities`, `recognize_linked_entities`, `extract_key_phrases`, `analyze_sentiment` can take as input a `list[TextDocumentInput]` or `list[str]`.
    A list of dict-like objects in the same shape as `TextDocumentInput` is still accepted as input.

  - New parameters/keyword arguments:
    - All operations now take a keyword argument `model_version` which allows the user to specify a string referencing the desired model version to be used for analysis. If no string specified, it will default to the latest, non-preview version.
    - `detect_languages` now takes a parameter `country_hint` which allows you to specify the country hint for the entire batch. Any per-item country hints will take precedence over a whole batch hint.
    - `recognize_entities`, `recognize_pii_entities`, `recognize_linked_entities`, `extract_key_phrases`, `analyze_sentiment` now take a parameter `language` which allows you to specify the language for the entire batch.
    Any per-item specified language will take precedence over a whole batch hint.
    - A `default_country_hint` or `default_language` keyword argument can be passed at client instantiation to set the default values for all operations.
    - A `response_hook` keyword argument can be passed with a callback to use the raw response from the service. Additionally, values returned for `TextDocumentBatchStatistics` and `model_version` used must be retrieved using a response hook.
    - `show_stats` and `model_version` parameters move to keyword only arguments.

  - New return types
    - The return types for the batching methods (`detect_languages`, `recognize_entities`, `recognize_pii_entities`, `recognize_linked_entities`, `extract_key_phrases`, `analyze_sentiment`) now return a heterogeneous list of
    result objects and document errors in the order passed in with the request. To iterate over the list and filter for result or error, a boolean property on each object called `is_error` can be used to determine whether the returned response object at
    that index is a result or an error:
    - `detect_languages` now returns a List[Union[`DetectLanguageResult`, `DocumentError`]]
    - `recognize_entities` now returns a List[Union[`RecognizeEntitiesResult`, `DocumentError`]]
    - `recognize_pii_entities` now returns a List[Union[`RecognizePiiEntitiesResult`, `DocumentError`]]
    - `recognize_linked_entities` now returns a List[Union[`RecognizeLinkedEntitiesResult`, `DocumentError`]]
    - `extract_key_phrases` now returns a List[Union[`ExtractKeyPhrasesResult`, `DocumentError`]]
    - `analyze_sentiment` now returns a List[Union[`AnalyzeSentimentResult`, `DocumentError`]]
    - The module-level, single text operations will return a single result object or raise the error found on the document:
    - `single_detect_languages` returns a `DetectLanguageResult`
    - `single_recognize_entities` returns a `RecognizeEntitiesResult`
    - `single_recognize_pii_entities` returns a `RecognizePiiEntitiesResult`
    - `single_recognize_linked_entities` returns a `RecognizeLinkedEntitiesResult`
    - `single_extract_key_phrases` returns a `ExtractKeyPhrasesResult`
    - `single_analyze_sentiment` returns a `AnalyzeSentimentResult`

  - New underlying REST pipeline implementation, based on the new `azure-core` library.
  - Client and pipeline configuration is now available via keyword arguments at both the client level, and per-operation. See README for a full list of optional configuration arguments.
  - Authentication using `azure-identity` credentials
    - see the
    [Azure Identity documentation](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/README.md)
    for more information
  - New error hierarchy:
      - All service errors will now use the base type: `azure.core.exceptions.HttpResponseError`
      - There is one exception type derived from this base type for authentication errors:
          - `ClientAuthenticationError`: Authentication failed.



  **Features**

  - Client class can be used as a context manager to keep the underlying HTTP session open for performance
  - New method "entities"
  - Model KeyPhraseBatchResultItem has a new parameter statistics
  - Model KeyPhraseBatchResult has a new parameter statistics
  - Model LanguageBatchResult has a new parameter statistics
  - Model LanguageBatchResultItem has a new parameter statistics
  - Model SentimentBatchResult has a new parameter statistics

  **Breaking changes**

  - TextAnalyticsAPI main client has been renamed TextAnalyticsClient
  - TextAnalyticsClient parameter is no longer a region but a complete endpoint

  **General Breaking changes**

  This version uses a next-generation code generator that *might* introduce breaking changes.

  - Model signatures now use only keyword-argument syntax. All positional arguments must be re-written as keyword-arguments.
    To keep auto-completion in most cases, models are now generated for Python 2 and Python 3. Python 3 uses the "*" syntax for keyword-only arguments.
  - Enum types now use the "str" mixin (class AzureEnum(str, Enum)) to improve the behavior when unrecognized enum values are encountered.
    While this is not a breaking change, the distinctions are important, and are documented here:
    https://docs.python.org/3/library/enum.html#others
    At a glance:

    - "is" should not be used at all.
    - "format" will return the string value, where "%s" string formatting will return `NameOfEnum.stringvalue`. Format syntax should be preferred.

  **Bugfixes**

  - Compatibility of the sdist with wheel 0.31.0




  * Initial Release


pkgId: 4862f2f2d1ac2298d63207e8e152fcdf565e499f9e537698d3afc414e5edc676
name: python-azure-ai-translation-document
arch: src
version: 1.0.0
epoch: 0
release: 1
summary: Microsoft Azure Document Translation Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-translation-document-1.0.0-1.src.rpm
checksum_type: sha256
description:
  Azure Cognitive Services Document Translation is a cloud service that can be used to translate multiple and complex documents across languages and dialects while preserving original document structure and data format.
  Use the client library for Document Translation to:

  * Translate numerous, large files from an Azure Blob Storage container to a target container in your language of choice.
  * Check the translation status and progress of each document in the translation operation.
  * Apply a custom translation model or glossaries to tailor translation to your specific case.

  [Source code][python-dt-src] | [Package (PyPI)][python-dt-pypi] | [API reference documentation][python-dt-ref-docs] | [Product documentation][python-dt-product-docs] | [Samples][python-dt-samples]



  _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_




  * Python 3.6 or later is required to use this package.
  * You must have an [Azure subscription][azure_subscription] and a
  [Translator resource][DT_resource] to use this package.


  Install the Azure Document Translation client library for Python with [pip][pip]:

  ```bash
  pip install azure-ai-translation-document
  ```

  > Note: This version of the client library defaults to the v1.0 version of the service


  The Document Translation feature supports [single-service access][single_service] only.
  To access the service, create a Translator resource.

  You can create the resource using

  **Option 1:** [Azure Portal][azure_portal_create_DT_resource]

  **Option 2:** [Azure CLI][azure_cli_create_DT_resource].
  Below is an example of how you can create a Translator resource using the CLI:

  ```bash


  az group create --name my-resource-group --location westus2
  ```

  ```bash

  az cognitiveservices account create \
      --name document-translation-resource \
      --custom-domain document-translation-resource \
      --resource-group my-resource-group \
      --kind TextTranslation \
      --sku S1 \
      --location westus2 \
      --yes
  ```


  In order to interact with the Document Translation feature service, you will need to create an instance of a client.
  An **endpoint** and **credential** are necessary to instantiate the client object.



  You can find the endpoint for your Translator resource using the
  [Azure Portal][azure_portal_get_endpoint].

  > Note that the service requires a custom domain endpoint. Follow the instructions in the above link to format your endpoint:
  > https://{NAME-OF-YOUR-RESOURCE}.cognitiveservices.azure.com/



  The API key can be found in the Azure Portal or by running the following Azure CLI command:

  ```az cognitiveservices account keys list --name "resource-name" --resource-group "resource-group-name"```



  To use an [API key][cognitive_authentication_api_key] as the `credential` parameter,
  pass the key as a string into an instance of [AzureKeyCredential][azure-key-credential].

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.translation.document import DocumentTranslationClient

  endpoint = "https://<resource-name>.cognitiveservices.azure.com/"
  credential = AzureKeyCredential("<api_key>")
  document_translation_client = DocumentTranslationClient(endpoint, credential)
  ```



  `AzureKeyCredential` authentication is used in the examples in this getting started guide, but you can also
  authenticate with Azure Active Directory using the [azure-identity][azure_identity] library.

  To use the [DefaultAzureCredential][default_azure_credential] type shown below, or other credential types provided
  with the Azure SDK, please install the `azure-identity` package:

  ```pip install azure-identity```

  You will also need to [register a new AAD application and grant access][register_aad_app] to your
  Translator resource by assigning the `"Cognitive Services User"` role to your service principal.

  Once completed, set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
  `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`.

  ```python
  from azure.identity import DefaultAzureCredential
  from azure.ai.translation.document import DocumentTranslationClient
  credential = DefaultAzureCredential()

  document_translation_client = DocumentTranslationClient(
      endpoint="https://<resource-name>.cognitiveservices.azure.com/",
      credential=credential
  )
  ```



  The Document Translation service requires that you upload your files to an Azure Blob Storage source container and provide
  a target container where the translated documents can be written. Additional information about setting this up can be found in
  the service documentation:

  - [Set up Azure Blob Storage containers][source_containers] with your documents
  - Optionally apply [glossaries][glossary] or a [custom model for translation][custom_model]
  - Allow access to your storage account with either of the following options:
      - Generate [SAS tokens][sas_token] to your containers (or files) with the appropriate [permissions][sas_token_permissions]
      - Create and use a [managed identity][managed_identity] to grant access to your storage account



  Interaction with the Document Translation client library begins with an instance of the `DocumentTranslationClient`.
  The client provides operations for:

   - Creating a translation operation to translate documents in your source container(s) and write results to you target container(s).
   - Checking the status of individual documents in the translation operation and monitoring each document's progress.
   - Enumerating all past and current translation operations.
   - Identifying supported glossary and document formats.



  Input to the `begin_translation` client method can be provided in two different ways:

  1) A single source container with documents can be translated to a different language:

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.translation.document import DocumentTranslationClient

  document_translation_client = DocumentTranslationClient("<endpoint>", AzureKeyCredential("<api_key>"))
  poller = document_translation_client.begin_translation("<sas_url_to_source>", "<sas_url_to_target>", "<target_language>")
  ```

  2) Or multiple different sources can be provided each with their own targets.

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.translation.document import DocumentTranslationClient, DocumentTranslationInput, TranslationTarget

  my_input = [
      DocumentTranslationInput(
          source_url="<sas_url_to_source_A>",
          targets=[
              TranslationTarget(target_url="<sas_url_to_target_fr>", language="fr"),
              TranslationTarget(target_url="<sas_url_to_target_de>", language="de")
          ]
      ),
      DocumentTranslationInput(
          source_url="<sas_url_to_source_B>",
          targets=[
              TranslationTarget(target_url="<sas_url_to_target_fr>", language="fr"),
              TranslationTarget(target_url="<sas_url_to_target_de>", language="de")
          ]
      ),
      DocumentTranslationInput(
          source_url="<sas_url_to_source_C>",
          targets=[
              TranslationTarget(target_url="<sas_url_to_target_fr>", language="fr"),
              TranslationTarget(target_url="<sas_url_to_target_de>", language="de")
          ]
      )
  ]

  document_translation_client = DocumentTranslationClient("<endpoint>", AzureKeyCredential("<api_key>"))
  poller = document_translation_client.begin_translation(my_input)
  ```

  > Note: the target_url for each target language must be unique.

  To translate documents under a folder, or only translate certain documents, see [sample_begin_translation_with_filters.py][sample_begin_translation_with_filters].
  See the service documentation for all [supported languages][supported_languages].


  Long-running operations are operations which consist of an initial request sent to the service to start an operation,
  followed by polling the service at intervals to determine whether the operation has completed or failed, and if it has
  succeeded, to get the result.

  Methods that translate documents are modeled as long-running operations.
  The client exposes a `begin_<method-name>` method that returns a `DocumentTranslationLROPoller` or `AsyncDocumentTranslationLROPoller`. Callers should wait
  for the operation to complete by calling `result()` on the poller object returned from the `begin_<method-name>` method.
  Sample code snippets are provided to illustrate using long-running operations [below](#examples "Examples").



  The following section provides several code snippets covering some of the most common Document Translation tasks, including:

  * [Translate your documents](#translate-your-documents "Translate Your Documents")
  * [Translate multiple inputs](#translate-multiple-inputs "Translate Multiple Inputs")
  * [List translation operations](#list-translation-operations "List Translation Operations")


  Translate all the documents in your source container to the target container. To translate documents under a folder, or only translate certain documents, see [sample_begin_translation_with_filters.py][sample_begin_translation_with_filters].

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.translation.document import DocumentTranslationClient

  endpoint = "https://<resource-name>.cognitiveservices.azure.com/"
  credential = AzureKeyCredential("<api_key>")
  source_container_sas_url_en = "<sas-url-en>"
  target_container_sas_url_es = "<sas-url-es>"

  document_translation_client = DocumentTranslationClient(endpoint, credential)

  poller = document_translation_client.begin_translation(source_container_sas_url_en, target_container_sas_url_es, "es")

  result = poller.result()

  print(f"Status: {poller.status()}")
  print(f"Created on: {poller.details.created_on}")
  print(f"Last updated on: {poller.details.last_updated_on}")
  print(f"Total number of translations on documents: {poller.details.documents_total_count}")

  print("\nOf total documents...")
  print(f"{poller.details.documents_failed_count} failed")
  print(f"{poller.details.documents_succeeded_count} succeeded")

  for document in result:
      print(f"Document ID: {document.id}")
      print(f"Document status: {document.status}")
      if document.status == "Succeeded":
          print(f"Source document location: {document.source_document_url}")
          print(f"Translated document location: {document.translated_document_url}")
          print(f"Translated to language: {document.translated_to}\n")
      else:
          print(f"Error Code: {document.error.code}, Message: {document.error.message}\n")
  ```


  Begin translating with documents in multiple source containers to multiple target containers in different languages.

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.translation.document import DocumentTranslationClient, DocumentTranslationInput, TranslationTarget

  endpoint = "https://<resource-name>.cognitiveservices.azure.com/"
  credential = AzureKeyCredential("<api_key>")
  source_container_sas_url_de = "<sas-url-de>"
  source_container_sas_url_en = "<sas-url-en>"
  target_container_sas_url_es = "<sas-url-es>"
  target_container_sas_url_fr = "<sas-url-fr>"
  target_container_sas_url_ar = "<sas-url-ar>"

  document_translation_client = DocumentTranslationClient(endpoint, credential)

  poller = document_translation_client.begin_translation(
      [
          DocumentTranslationInput(
              source_url=source_container_sas_url_en,
              targets=[
                  TranslationTarget(target_url=target_container_sas_url_es, language="es"),
                  TranslationTarget(target_url=target_container_sas_url_fr, language="fr"),
              ],
          ),
          DocumentTranslationInput(
              source_url=source_container_sas_url_de,
              targets=[
                  TranslationTarget(target_url=target_container_sas_url_ar, language="ar"),
              ],
          )
      ]
  )

  result = poller.result()

  for document in result:
      print(f"Document ID: {document.id}")
      print(f"Document status: {document.status}")
      if document.status == "Succeeded":
          print(f"Source document location: {document.source_document_url}")
          print(f"Translated document location: {document.translated_document_url}")
          print(f"Translated to language: {document.translated_to}\n")
      else:
          print(f"Error Code: {document.error.code}, Message: {document.error.message}\n")
  ```


  Enumerate over the translation operations submitted for the resource.

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.translation.document import DocumentTranslationClient

  endpoint = "https://<resource-name>.cognitiveservices.azure.com/"
  credential = AzureKeyCredential("<api_key>")

  document_translation_client = DocumentTranslationClient(endpoint, credential)

  operations = document_translation_client.list_translation_statuses()  # type: ItemPaged[TranslationStatus]

  for operation in operations:
      print(f"\nID: {operation.id}")
      print(f"Status: {operation.status}")
      print(f"Created on: {operation.created_on}")
      print(f"Last updated on: {operation.last_updated_on}")
      print(f"Total number of translations on documents: {operation.documents_total_count}")
      print(f"Total number of characters charged: {operation.total_characters_charged}")

      print("Of total documents...")
      print(f"{operation.documents_failed_count} failed")
      print(f"{operation.documents_succeeded_count} succeeded")
      print(f"{operation.documents_canceled_count} canceled")
  ```

  To see how to use the Document Translation client library with Azure Storage Blob to upload documents, create SAS tokens
  for your containers, and download the finished translated documents, see this [sample][sample_translation_with_azure_blob].
  Note that you will need to install the [azure-storage-blob][azure_storage_blob] library to run this sample.



  The following section provides some insights for some advanced translation features such as glossaries and custom translation models.


  Glossaries are domain-specific dictionaries. For example, if you want to translate some medical-related documents, you may need support for the many words, terminology, and idioms in the medical field which you can't find in the standard translation dictionary, or you simply need specific translation. This is why Document Translation provides support for glossaries.



  Document Translation supports glossaries in the following formats:

  |**File Type**|**Extension**|**Description**|**Samples**|
  |---------------|---------------|---------------|---------------|
  |Tab-Separated Values/TAB|.tsv, .tab|Read more on [wikipedia][tsv_files_wikipedia]|[glossary_sample.tsv][sample_tsv_file]|
  |Comma-Separated Values|.csv|Read more on [wikipedia][csv_files_wikipedia]|[glossary_sample.csv][sample_csv_file]|
  |Localization Interchange File Format|.xlf, .xliff|Read more on [wikipedia][xlf_files_wikipedia]|[glossary_sample.xlf][sample_xlf_file]|

  View all supported formats [here][supported_glossary_formats].


  In order to use glossaries with Document Translation, you first need to upload your glossary file to a blob container, and then provide the SAS URL to the file as in the code samples [sample_translation_with_glossaries.py][sample_translation_with_glossaries].


  Instead of using Document Translation's engine for translation, you can use your own custom Azure machine/deep learning model.


  For more info on how to create, provision, and deploy your own custom Azure translation model, please follow the instructions here: [Build, deploy, and use a custom model for translation][custom_translation_article]


  In order to use a custom translation model with Document Translation, you first
  need to create and deploy your model, then follow the code sample [sample_translation_with_custom_model.py][sample_translation_with_custom_model] to use with Document Translation.





  Document Translation client library will raise exceptions defined in [Azure Core][azure_core_exceptions].


  This library uses the standard
  [logging][python_logging] library for logging.

  Basic information about HTTP sessions (URLs, headers, etc.) is logged at `INFO` level.

  Detailed `DEBUG` level logging, including request/response bodies and **unredacted**
  headers, can be enabled on the client or per-operation with the `logging_enable` keyword argument.

  See full SDK logging documentation with examples [here][sdk_logging_docs].



  Optional keyword arguments can be passed in at the client and per-operation level.
  The azure-core [reference documentation][azure_core_ref_docs]
  describes available configurations for retries, logging, transport protocols, and more.



  The following section provides several code snippets illustrating common patterns used in the Document Translation Python client library.
  More samples can be found under the [samples][samples] directory.



  These code samples show common scenario operations with the Azure Document Translation client library.

  * Client authentication: [sample_authentication.py][sample_authentication]
  * Begin translating documents: [sample_begin_translation.py][sample_begin_translation]
  * Translate with multiple inputs: [sample_translate_multiple_inputs.py][sample_translate_multiple_inputs]
  * Check the status of documents: [sample_check_document_statuses.py][sample_check_document_statuses]
  * List all submitted translation operations: [sample_list_translations.py][sample_list_translations]
  * Apply a custom glossary to translation: [sample_translation_with_glossaries.py][sample_translation_with_glossaries]
  * Use Azure Blob Storage to set up translation resources: [sample_translation_with_azure_blob.py][sample_translation_with_azure_blob]



  This library also includes a complete set of async APIs. To use them, you must
  first install an async transport, such as [aiohttp](https://pypi.org/project/aiohttp/). Async clients
  are found under the `azure.ai.translation.document.aio` namespace.

  * Client authentication: [sample_authentication_async.py][sample_authentication_async]
  * Begin translating documents: [sample_begin_translation_async.py][sample_begin_translation_async]
  * Translate with multiple inputs: [sample_translate_multiple_inputs_async.py][sample_translate_multiple_inputs_async]
  * Check the status of documents: [sample_check_document_statuses_async.py][sample_check_document_statuses_async]
  * List all submitted translation operations: [sample_list_translations_async.py][sample_list_translations_async]
  * Apply a custom glossary to translation: [sample_translation_with_glossaries_async.py][sample_translation_with_glossaries_async]
  * Use Azure Blob Storage to set up translation resources: [sample_translation_with_azure_blob_async.py][sample_translation_with_azure_blob_async]



  For more extensive documentation on Azure Cognitive Services Document Translation, see the [Document Translation documentation][python-dt-product-docs] on docs.microsoft.com.


  This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.

  <!-- LINKS -->

  [python-dt-src]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/azure/ai/translation/document
  [python-dt-pypi]: https://aka.ms/azsdk/python/texttranslation/pypi
  [python-dt-product-docs]: https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/overview
  [python-dt-ref-docs]: https://aka.ms/azsdk/python/documenttranslation/docs
  [python-dt-samples]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples

  [azure_subscription]: https://azure.microsoft.com/free/
  [DT_resource]: https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/get-started-with-document-translation?tabs=python
  [single_service]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=singleservice%2Cwindows
  [pip]: https://pypi.org/project/pip/
  [azure_portal_create_DT_resource]: https://ms.portal.azure.com/#create/Microsoft.CognitiveServicesTextTranslation
  [azure_cli_create_DT_resource]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account-cli?tabs=windows
  [azure-key-credential]: https://aka.ms/azsdk/python/core/azurekeycredential
  [supported_languages]: https://docs.microsoft.com/azure/cognitive-services/translator/language-support#translate
  [source_containers]: https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/get-started-with-document-translation?tabs=csharp#create-azure-blob-storage-containers
  [custom_model]: https://docs.microsoft.com/azure/cognitive-services/translator/custom-translator/quickstart-build-deploy-custom-model
  [glossary]: https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/overview#supported-glossary-formats
  [sas_token]: https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/create-sas-tokens?tabs=Containers#create-your-sas-tokens-with-azure-storage-explorer
  [sas_token_permissions]: https://aka.ms/azsdk/documenttranslation/sas-permissions
  [azure_storage_blob]: https://pypi.org/project/azure-storage-blob/

  [azure_core_ref_docs]: https://aka.ms/azsdk/python/core/docs
  [azure_core_exceptions]: https://aka.ms/azsdk/python/core/docs#module-azure.core.exceptions
  [python_logging]: https://docs.python.org/3/library/logging.html
  [azure_cli_endpoint_lookup]: https://docs.microsoft.com/cli/azure/cognitiveservices/account?view=azure-cli-latest#az-cognitiveservices-account-show
  [azure_portal_get_endpoint]: https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/get-started-with-document-translation?tabs=csharp#get-your-custom-domain-name-and-subscription-key
  [cognitive_authentication_api_key]: https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/get-started-with-document-translation?tabs=csharp#get-your-subscription-key
  [register_aad_app]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-azure-active-directory
  [custom_subdomain]: https://docs.microsoft.com/azure/cognitive-services/authentication#create-a-resource-with-a-custom-subdomain
  [azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity
  [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
  [managed_identity]: https://aka.ms/azsdk/documenttranslation/managed-identity
  [sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/sdk/azure-sdk-logging

  [samples]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples
  [sample_authentication]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/sample_authentication.py
  [sample_authentication_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_authentication_async.py
  [sample_begin_translation]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/sample_begin_translation.py
  [sample_begin_translation_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_begin_translation_async.py
  [sample_translate_multiple_inputs]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/sample_translate_multiple_inputs.py
  [sample_translate_multiple_inputs_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_translate_multiple_inputs_async.py
  [sample_check_document_statuses]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/sample_check_document_statuses.py
  [sample_check_document_statuses_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_check_document_statuses_async.py
  [sample_list_translations]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/sample_list_translations.py
  [sample_list_translations_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_list_translations_async.py
  [sample_translation_with_glossaries]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/sample_translation_with_glossaries.py
  [sample_translation_with_glossaries_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_translation_with_glossaries_async.py
  [sample_translation_with_azure_blob]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/sample_translation_with_azure_blob.py
  [sample_translation_with_azure_blob_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_translation_with_azure_blob_async.py
  [sample_translation_with_custom_model]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/sample_translation_with_custom_model.py
  [sample_translation_with_custom_model_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/async_samples/sample_translation_with_custom_model_async.py
  [sample_begin_translation_with_filters]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/sample_begin_translation_with_filters.py

  [supported_glossary_formats]: https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/overview#supported-glossary-formats
  [custom_translation_article]: https://docs.microsoft.com/azure/cognitive-services/translator/custom-translator/quickstart-build-deploy-custom-model
  [tsv_files_wikipedia]: https://wikipedia.org/wiki/Tab-separated_values
  [xlf_files_wikipedia]: https://wikipedia.org/wiki/XLIFF
  [csv_files_wikipedia]: https://wikipedia.org/wiki/Comma-separated_values
  [sample_tsv_file]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/assets/glossary_sample.tsv
  [sample_csv_file]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/assets/glossary_sample.csv
  [sample_xlf_file]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/assets/glossary_sample.xlf

  [cla]: https://cla.microsoft.com
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
  [coc_contact]: mailto:opencode@microsoft.com








  - Changed: `begin_translation` parameter `target_language_code` has been renamed to `target_language`.
  - Changed: `begin_translation` keyword-only argument `source_language_code` has been renamed to `source_language`.
  - Changed: `DocumentTranslationInput` keyword-only argument and property `source_language_code` has been renamed to `source_language`.
  - Changed: `TranslationTarget` keyword-only argument and property `language_code` has been renamed to `language`.
  - Changed: `TranslationStatus` property `documents_not_yet_started_count` has been renamed to `documents_not_started_count`.
  - Removed: `results_per_page` keyword-only argument from `list_translation_statuses` and `list_document_statuses`.





  - Python 2.7 is no longer supported. Please use Python version 3.6 or later.




  - Changed: `list_all_translation_statuses` has been renamed to `list_translation_statuses`
  - Changed: `list_all_document_statuses` has been renamed to `list_document_statuses`
  - Changed: `TranslationStatus` property `documents_cancelled_count` has been renamed to `documents_canceled_count`
  - Changed: `FileFormat` has been renamed to `DocumentTranslationFileFormat`
  - Changed: Operation statuses `Cancelled` and `Cancelling` have been renamed to `Canceled` and `Canceling`, respectively.


  - The operation `id` under `details` of the poller object now populates correctly.





  - The single translation input version of `begin_translation(source, target, target_language_code)` now accepts keyword arguments
  `storage_type`, `glossaries`, `category_id`, `prefix`, `suffix`, and `source_language_code`.



  - Changed: renamed kwargs `translated_before` and `translated_after` to `created_before` and `created_after`, respectively,
  for `list_all_document_statuses`.
  - Changed: renamed `order_by` sorting query option `createdDateTimeUtc` to `created_on` for `list_all_translation_statuses` and
  `list_all_document_statuses`.






  - `TranslationStatusResult` was renamed to `TranslationStatus`.
  - `DocumentStatusResult` was renamed to `DocumentStatus`.
  - `get_document_formats` was renamed to `get_supported_document_formats`.
  - `get_glossary_formats` was renamed to `get_supported_glossary_formats`.



  This version of the SDK defaults to the latest supported service version, which currently is v1.0

  **Breaking changes**

  - `create_translation_job` was removed and replaced with `begin_translation` which follows a long-running operation (LRO)
  approach. The client method now returns a `DocumentTranslationLROPoller` (or `AsyncDocumentTranslationLROPoller`) to begin the
  long-running operation. A call to `.result()` can be made on the poller object to wait until the translation is complete.
  See the [README](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/translation/azure-ai-translation-document/README.md) for more information about LROs.
  - Upon completion of the LRO, `begin_translation` now returns a pageable of `DocumentStatusResult`. All job-level metadata can still
  be found on `poller.details`.
  - `has_completed` has been removed from `JobStatusResult` and `DocumentStatusResult`. Use `poller.done()` to check if the
  translation has completed.
  - Client method `wait_until_done` has been removed. Use `poller.result()` to wait for the LRO to complete.
  - Client method `list_submitted_jobs` has been renamed to `list_all_translation_statuses`.
  - Client method `get_job_status` has been renamed to `get_translation_status`.
  - Client method `cancel_job` has been renamed to `cancel_translation`.
  - Parameter `job_id` was renamed to `translation_id` for `get_translation_status`, `cancel_translation`, `list_all_document_statuses`, and `get_document_status`.
  - `JobStatusResult` has been renamed to `TranslationStatusResult`.
  - `DocumentStatusResult` property `translate_to` has been renamed to `translated_to`

  **New features**

  - Authentication using `azure-identity` credentials now supported.
    - see the [Azure Identity documentation](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/README.md) for more information.
  - Added paging and filtering options to `list_all_document_statuses` and `list_submitted_jobs`.
  - The input to `begin_translation` now accepts either the parameter `inputs` as a `List[DocumentTranslationInput]` to
  perform multiple translations, or the parameters `source_url`, `target_url`, and `target_language_code` to perform a
  single translation of your documents.

  **Dependency updates**

  - Package requires [azure-core](https://pypi.org/project/azure-core/) version 1.14.0 or greater.



  This is the first beta package of the azure-ai-translation-document client library that targets the Document Translation
  service version `1.0-preview.1`. This package's documentation and samples demonstrate the new API.


