File: README.md

package info (click to toggle)
python-azure 20251014%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 766,472 kB
  • sloc: python: 6,314,744; ansic: 804; javascript: 287; makefile: 198; sh: 198; xml: 109
file content (133 lines) | stat: -rw-r--r-- 12,637 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
---
page_type: sample
languages:
  - python
products:
  - azure
  - azure-cognitive-services
  - language-service
urlFragment: conversationsauthoring-samples
---

# Samples for Azure Conversational Language Understanding Authoring client library for Python

These code samples show common **Conversation Authoring** operations with the Azure `azure-ai-language-conversations-authoring` client library.

You can authenticate your client with a Conversation Authoring API key:

- See [sample_authentication.py][sample_authentication] and [sample_authentication_async.py][sample_authentication_async] for how to authenticate in the above cases.

These sample programs show common scenarios for the Conversation Authoring client’s offerings.

| **File Name** | **Description** |
|-|-|
| [sample_assign_deployment_resources.py][sample_assign_deployment_resources] and [sample_assign_deployment_resources_async.py][sample_assign_deployment_resources_async] | Assign deployment resources to a project. |
| [sample_cancel_training_job.py][sample_cancel_training_job] and [sample_cancel_training_job_async.py][sample_cancel_training_job_async] | Cancel an ongoing training job. |
| [sample_create_project.py][sample_create_project] and [sample_create_project_async.py][sample_create_project_async] | Create a new conversation project. |
| [sample_delete_deployment.py][sample_delete_deployment] and [sample_delete_deployment_async.py][sample_delete_deployment_async] | Delete a specific deployment from a project. |
| [sample_delete_project.py][sample_delete_project] and [sample_delete_project_async.py][sample_delete_project_async] | Delete an existing project. |
| [sample_delete_trained_model.py][sample_delete_trained_model] and [sample_delete_trained_model_async.py][sample_delete_trained_model_async] | Delete a trained model from the project. |
| [sample_deploy_project.py][sample_deploy_project] and [sample_deploy_project_async.py][sample_deploy_project_async] | Deploy a trained model to an endpoint. |
| [sample_export_project.py][sample_export_project] and [sample_export_project_async.py][sample_export_project_async] | Export a project into JSON format for versioning or reuse. |
| [sample_get_deployment.py][sample_get_deployment] and [sample_get_deployment_async.py][sample_get_deployment_async] | Retrieve details about a deployment. |
| [sample_get_model_evaluation_results.py][sample_get_model_evaluation_results] and [sample_get_model_evaluation_results_async.py][sample_get_model_evaluation_results_async] | Get detailed model evaluation results for analysis. |
| [sample_get_model_evaluation_summary.py][sample_get_model_evaluation_summary] and [sample_get_model_evaluation_summary_async.py][sample_get_model_evaluation_summary_async] | Retrieve summary of model evaluation metrics. |
| [sample_get_project.py][sample_get_project] and [sample_get_project_async.py][sample_get_project_async] | Get details of a specific project. |
| [sample_import_project.py][sample_import_project] and [sample_import_project_async.py][sample_import_project_async] | Import labeled assets and metadata into a project. |
| [sample_load_snapshot.py][sample_load_snapshot] and [sample_load_snapshot_async.py][sample_load_snapshot_async] | Load a snapshot of a trained model. |
| [sample_swap_deployments.py][sample_swap_deployments] and [sample_swap_deployments_async.py][sample_swap_deployments_async] | Swap two deployments within a project. |
| [sample_train.py][sample_train] and [sample_train_async.py][sample_train_async] | Train a model within a project. |
| [sample_unassign_deployment_resources.py][sample_unassign_deployment_resources] and [sample_unassign_deployment_resources_async.py][sample_unassign_deployment_resources_async] | Unassign deployment resources from a project. |

---

## Prerequisites

- Python 3.7 or later is required to use this package.  
- You must have an [Azure subscription][azure_subscription] and a [Language Service resource][language_resource] to run these samples.

## Setup

1. Install the Azure Conversation Authoring client library for Python with [pip][pip]:

```bash
pip install azure-ai-language-conversations-authoring
```
For more information about how the versioning of the SDK corresponds to the versioning of the service's API, see [here][versioning_story_readme].

2. Clone or download this sample repository.  
3. Open the sample folder in Visual Studio Code or your IDE of choice.

## Running the samples

1. Open a terminal window and `cd` to the directory where the samples are located.  
2. Set the environment variables specified in the sample file you wish to run.  
   - Typically, you will need to set:  
     - `AZURE_CONVERSATIONS_AUTHORING_ENDPOINT`  
     - `AZURE_CONVERSATIONS_AUTHORING_KEY`  
3. Follow the usage described in the file, e.g. `python sample_train.py`

## Next steps

Check out the [API reference documentation][api_reference_authoring] to explore the full set of operations available in the Azure Conversational Language Understanding **Authoring** client library for Python.

[azure_subscription]: https://azure.microsoft.com/free/
[language_resource]: https://portal.azure.com/#create/Microsoft.CognitiveServicesTextAnalytics
[pip]: https://pypi.org/project/pip/
[api_reference_authoring]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring
<!-- TODO: change api_reference_documentation to azuresdkdocs link after first publish -->
[sample_authentication]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_authentication.py
[sample_authentication_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_authentication_async.py

[sample_assign_deployment_resources]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_assign_deployment_resources.py
[sample_assign_deployment_resources_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_assign_deployment_resources_async.py

[sample_cancel_training_job]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_cancel_training_job.py
[sample_cancel_training_job_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_cancel_training_job_async.py

[sample_create_project]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_create_project.py
[sample_create_project_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_create_project_async.py

[sample_delete_deployment]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_delete_deployment.py
[sample_delete_deployment_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_delete_deployment_async.py

[sample_delete_project]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_delete_project.py
[sample_delete_project_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_delete_project_async.py

[sample_delete_trained_model]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_delete_trained_model.py
[sample_delete_trained_model_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_delete_trained_model_async.py

[sample_deploy_project]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_deploy_project.py
[sample_deploy_project_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_deploy_project_async.py

[sample_export_project]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_export_project.py
[sample_export_project_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_export_project_async.py

[sample_get_deployment]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_deployment.py
[sample_get_deployment_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_deployment_async.py

[sample_get_model_evaluation_results]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_model_evaluation_results.py
[sample_get_model_evaluation_results_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_model_evaluation_results_async.py

[sample_get_model_evaluation_summary]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_model_evaluation_summary.py
[sample_get_model_evaluation_summary_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_model_evaluation_summary_async.py

[sample_get_project]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_get_project.py
[sample_get_project_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_get_project_async.py

[sample_import_project]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_import_project.py
[sample_import_project_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_import_project_async.py

[sample_load_snapshot]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_load_snapshot.py
[sample_load_snapshot_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_load_snapshot_async.py

[sample_swap_deployments]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_swap_deployments.py
[sample_swap_deployments_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_swap_deployments_async.py

[sample_train]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_train.py
[sample_train_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_train_async.py

[sample_unassign_deployment_resources]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/sample_unassign_deployment_resources.py
[sample_unassign_deployment_resources_async]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring/samples/async/sample_unassign_deployment_resources_async.py

[versioning_story_readme]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-conversations-authoring#install-the-package