Deploy a model and extract entities from text using the runtime API.

Once you are satisfied with how your model performs, it is ready to be deployed, and used to recognize entities in text. You can only send entity recognition tasks through the API, not from Language Studio.

Prerequisites

See the application development lifecycle for more information.

Deploy your model

  1. Go to your project in Language studio

  2. Select Deploy model from the left side menu.

  3. Select the model you want to deploy, then select Deploy model. If you deploy your model through the Language Studio, your deployment-name is prod.

Tip

You can test your model in Language Studio by sending samples of text for it to classify.

  1. Select Test model from the menu on the left side of your project in Language Studio.
  2. Select the model you want to test.
  3. Add your text to the textbox, you can also upload a .txt file.
  4. Click on Run the test.
  5. In the Result tab, you can see the extracted entities from your text. You can also view the JSON response under the JSON tab.

Send an entity recognition request to your model

Using Language studio

  1. After the deployment is completed, select the model you want to use and from the top menu click on Get prediction URL and copy the URL and body.

    run-inference

  2. In the window that appears, under the Submit pivot, copy the sample request into your command line

  3. Replace <YOUR_DOCUMENT_HERE> with the actual text you want to classify.

    run-inference-2

  4. Submit the request

  5. In the response header you receive extract jobId from operation-location, which has the format: {YOUR-ENDPOINT}/text/analytics/v3.2-preview.2/analyze/jobs/<jobId}>

  6. Copy the retrieve request and replace jobId and submit the request.

    run-inference-3

Retrieve the results of your job

  1. Select Retrieve from the same window you got the example request you got earlier and copy the sample request into a text editor.

    Screenshot showing the prediction retrieval request and URL

  2. Replace <OPERATION_ID> with the jobId from the previous step.

  3. Submit the GET cURL request in your terminal or command prompt. You'll receive a 202 response and JSON similar to the below, if the request was successful.

Custom NER task results

The response returned from the GET result call 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": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "lastUpdateDateTime": "2021-05-19T14:32:25.578Z",
    "status": "completed",
    "errors": [],
    "tasks": {
        "details": {
            "name": "MyJobName",
            "lastUpdateDateTime": "2021-03-29T19:50:23Z",
            "status": "completed"
        },
        "completed": 1,
        "failed": 0,
        "inProgress": 0,
        "total": 1,
        "tasks": {
    "customEntityRecognitionTasks": [
        {
            "lastUpdateDateTime": "2021-05-19T14:32:25.579Z",
            "name": "MyJobName",
            "status": "completed",
            "results": {
               "documents": [
                        {
                            "id": "doc1",
                            "entities": [
                                {
                                    "text": "Government",
                                    "category": "restaurant_name",
                                    "offset": 23,
                                    "length": 10,
                                    "confidenceScore": 0.0551877357
                                }
                            ],
                            "warnings": []
                        },
                        {
                            "id": "doc2",
                            "entities": [
                                {
                                    "text": "David Schmidt",
                                    "category": "artist",
                                    "offset": 0,
                                    "length": 13,
                                    "confidenceScore": 0.8022353
                                }
                            ],
                            "warnings": []
                        }
                    ],
                "errors": [],
                "statistics": {
                    "documentsCount":0,
                    "erroneousDocumentsCount":0,
                    "transactionsCount":0
                }
                    }
                }
            ]
        }
    }