Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
After the deployment is added successfully, you can query the deployment to extract entities from your text based on the model you assigned to the deployment. You can query the deployment programmatically using the Prediction API or through the client libraries (Azure SDK).
Test deployed model
You can retrieve up-to-date information about your projects, make any necessary changes, and oversee project management tasks efficiently through the Azure AI Foundry.
To test your deployed models from within the Language Studio:
Select Testing deployments from the left side menu.
Select the deployment you want to test. You can only test models that are assigned to deployments.
For multilingual projects, from the language dropdown, select the language of the text you are testing.
Select the deployment you want to query/test from the dropdown.
You can enter the text you want to submit to the request or upload a
.txtfile to use.Select Run the test from the top menu.
In the Result tab, you can see the extracted entities from your text and their types. You can also view the JSON response under the JSON tab.
Submit a custom NER task
Use this POST request to start a text classification task.
{ENDPOINT}/language/analyze-text/jobs?api-version={API-VERSION}
| Placeholder | Value | Example |
|---|---|---|
{ENDPOINT} |
The endpoint for authenticating your API request. | https://<your-custom-subdomain>.cognitiveservices.azure.com |
{API-VERSION} |
The version of the API you are calling. The value referenced here is for the latest version released. See Model lifecycle to learn more about other available API versions. | 2022-05-01 |
Headers
| Key | Value |
|---|---|
| Ocp-Apim-Subscription-Key | Your key that provides access to this API. |
Body
{
"displayName": "Extracting entities",
"analysisInput": {
"documents": [
{
"id": "1",
"language": "{LANGUAGE-CODE}",
"text": "Text1"
},
{
"id": "2",
"language": "{LANGUAGE-CODE}",
"text": "Text2"
}
]
},
"tasks": [
{
"kind": "CustomEntityRecognition",
"taskName": "Entity Recognition",
"parameters": {
"projectName": "{PROJECT-NAME}",
"deploymentName": "{DEPLOYMENT-NAME}"
}
}
]
}
| Key | Placeholder | Value | Example |
|---|---|---|---|
displayName |
{JOB-NAME} |
Your job name. | MyJobName |
documents |
[{},{}] | List of documents to run tasks on. | [{},{}] |
id |
{DOC-ID} |
Document name or ID. | doc1 |
language |
{LANGUAGE-CODE} |
A string specifying the language code for the document. If this key isn't specified, the service will assume the default language of the project that was selected during project creation. See language support for a list of supported language codes. | en-us |
text |
{DOC-TEXT} |
Document task to run the tasks on. | Lorem ipsum dolor sit amet |
tasks |
List of tasks we want to perform. | [] |
|
taskName |
CustomEntityRecognition |
The task name | CustomEntityRecognition |
parameters |
List of parameters to pass to the task. | ||
project-name |
{PROJECT-NAME} |
The name for your project. This value is case-sensitive. | myProject |
deployment-name |
{DEPLOYMENT-NAME} |
The name of your deployment. This value is case-sensitive. | prod |
Response
You will receive a 202 response indicating that your task has been submitted successfully. In the response headers, extract operation-location.
operation-location is formatted like this:
{ENDPOINT}/language/analyze-text/jobs/{JOB-ID}?api-version={API-VERSION}
You can use this URL to query the task completion status and get the results when task is completed.
Get task results
Use the following GET request to query the status/results of the custom entity recognition task.
{ENDPOINT}/language/analyze-text/jobs/{JOB-ID}?api-version={API-VERSION}
| Placeholder | Value | Example |
|---|---|---|
{ENDPOINT} |
The endpoint for authenticating your API request. | https://<your-custom-subdomain>.cognitiveservices.azure.com |
{API-VERSION} |
The version of the API you are calling. The value referenced here is for the latest version released. See Model lifecycle to learn more about other available API versions. | 2022-05-01 |
Headers
| Key | Value |
|---|---|
| Ocp-Apim-Subscription-Key | Your key that provides access to this API. |
Response Body
The response will be a JSON document with the following parameters
{
"createdDateTime": "2021-05-19T14:32:25.578Z",
"displayName": "MyJobName",
"expirationDateTime": "2021-05-19T14:32:25.578Z",
"jobId": "xxxx-xxxx-xxxxx-xxxxx",
"lastUpdateDateTime": "2021-05-19T14:32:25.578Z",
"status": "succeeded",
"tasks": {
"completed": 1,
"failed": 0,
"inProgress": 0,
"total": 1,
"items": [
{
"kind": "EntityRecognitionLROResults",
"taskName": "Recognize Entities",
"lastUpdateDateTime": "2020-10-01T15:01:03Z",
"status": "succeeded",
"results": {
"documents": [
{
"entities": [
{
"category": "Event",
"confidenceScore": 0.61,
"length": 4,
"offset": 18,
"text": "trip"
},
{
"category": "Location",
"confidenceScore": 0.82,
"length": 7,
"offset": 26,
"subcategory": "GPE",
"text": "Seattle"
},
{
"category": "DateTime",
"confidenceScore": 0.8,
"length": 9,
"offset": 34,
"subcategory": "DateRange",
"text": "last week"
}
],
"id": "1",
"warnings": []
}
],
"errors": [],
"modelVersion": "2020-04-01"
}
}
]
}
}
First you need to get your resource key and endpoint:
Get your key and endpoint
Next you will need the key and endpoint from the resource to connect your application to the API. You'll paste your key and endpoint into the code later in the quickstart.
After the Language resource deploys successfully, click the Go to Resource button under Next Steps.
On the screen for your resource, select Keys and endpoint on the left pane. You will use one of your keys and your endpoint in the steps below.
Download and install the client library package for your language of choice:
Language Package version .NET 5.2.0-beta.3 Java 5.2.0-beta.3 JavaScript 6.0.0-beta.1 Python 5.2.0b4 After you install the client library, use the following samples on GitHub to start calling the API.
For more information, see the following reference documentation: