|
8 | 8 |
|
9 | 9 | A Foundry resource and project is sufficient for using Azure Language in Foundry portal, but you will need an additional *Language resource* to use the Azure Language SDK. You can create a Language resource in the Azure portal, or programmatically in a command line interface (CLI). |
10 | 10 |
|
11 | | - |
| 11 | +:::image type="content" source="../media/azure-portal-create-resource.png" alt-text="Screenshot of the Azure portal with the marketplace open to the Language resource." lightbox="../media/azure-portal-create-resource.png"::: |
12 | 12 |
|
13 | 13 | When you create a Language resource, Azure creates an *endpoint* for Azure Language. The endpoint is the address to a specific cloud service or model. We can find the Language service endpoint and key in the Azure portal. |
14 | 14 |
|
15 | | - |
| 15 | +:::image type="content" source="../media/azure-portal-credentials.png" alt-text="Screenshot of a Language resource in the Azure portal with the key and endpoint page open." lightbox="../media/azure-portal-credentials.png"::: |
16 | 16 |
|
17 | 17 | When you run your application code, your application sends a request, or call, to the endpoint. The call can be sent using the REST API or SDK. The service returns a response, such as key phrases detected, in a format known as JSON. |
18 | 18 |
|
@@ -46,17 +46,17 @@ from azure.ai.textanalytics import TextAnalyticsClient |
46 | 46 | from azure.core.credentials import AzureKeyCredential |
47 | 47 | ``` |
48 | 48 |
|
49 | | - |
| 49 | +:::image type="content" source="../media/python-sdk-client-example.png" alt-text="Screenshot of Visual Studio Code with a Python file open with a focus on the client object created." lightbox="../media/python-sdk-client-example.png"::: |
50 | 50 |
|
51 | 51 | Then we use our Language resource endpoint and key to create an authenticated **client object**, the tool your code uses to communicate with a service. The client object knows the service's endpoint, carries credentials (like keys or tokens), exposes methods (for example: `analyze_sentiment()`), and handles sending requests and receiving responses under the hood. |
52 | 52 |
|
53 | 53 | We use the client's methods to call Azure Language functions. For example, we can extract key phrases with `client.extract_key_phrases()`, recognize entities with the function `client.recognize_entities()`, and analyze sentiment with `client.analyze_sentiment()`. To generate a summary, we need to use an asynchronous technique to begin the summarization task and retrieve the results. |
54 | 54 |
|
55 | | - |
| 55 | +:::image type="content" source="../media/python-sdk-text-analysis-example.png" alt-text="Screenshot of Visual Studio Code with a Python file open with a focus on the text analysis functions." lightbox="../media/python-sdk-text-analysis-example.png"::: |
56 | 56 |
|
57 | 57 | We can display the results of the analysis by running the application code in the terminal with the command `python <file_name>.py`. When we run the app, it uses Azure Language in our Foundry resource to perform each of the tasks. |
58 | 58 |
|
59 | | - |
| 59 | +:::image type="content" source="../media/python-sdk-results.png" alt-text="Screenshot of Visual Studio Code with the terminal open with a focus on the results." lightbox="../media/python-sdk-results.png"::: |
60 | 60 |
|
61 | 61 | ## Examples of code to use with the Azure Language Python SDK |
62 | 62 |
|
|
0 commit comments