Einstein Intent

This customizable service can be taught to identify the intended meaning in a body of text. For example, you could analyze text from emails, chats, or web forms to determine which products your customers are interested in. Or, as see in our example below, you can route service cases to the correct agents or departments based on context found in a sentence.

Documentation Example dataset


Getting started

To see how easily you can train your own intent model we’ll demonstrate creating a case routing model in three simple steps. In the end this model will classify text into five categories: billing, order change, password help, sales opportunity, shipping info. Download the example dataset above for additional context.

Upload a dataset

This command creates a dataset called case_routing_intent from the specified csv. It will also create five labels based on the data in our spreadsheet.

$ curl -X POST -H "Authorization: Bearer <TOKEN>" -H "Cache-Control: no-cache" -H "Content-Type: multipart/form-data" -F "path=http://einstein.ai/text/case_routing_intent.csv" -F "type=text-intent"  https://api.einstein.ai/v2/language/datasets/upload
{
  "id": 1004804,
  "name": "case_routing_intent.csv",
  "createdAt": "2017-06-22T19:31:58.000+0000.",
  "updatedAt": "2017-06-22T19:31:58.000+0000",
  "labelSummary": {
    "labels": []
  },
  "totalExamples": 0,
  "available": false,
  "statusMsg": "UPLOADING",
  "type": "text-intent",
  "object": "dataset"
}
Train your model

Now that you’ve uploaded a labeled text dataset, it’s time to train your model. You will train your model by using the command below by replacing with ID of the dataset you uploaded.

$ curl -X POST -H "Authorization: Bearer <TOKEN>" -H "Cache-Control: no-cache" -H "Content-Type: multipart/form-data" -F "name=Case Routing Model" -F "datasetId=<DATASET_ID>" https://api.einstein.ai/v2/language/train
{
  "datasetId": 1004804,
  "datasetVersionId": 0,
  "name": "Case Routing Model",
  "status": "QUEUED",
  "progress": 0,
  "createdAt": "2017-06-22T19:39:38.000+0000",
  "updatedAt": "2017-06-22T19:39:38.000+0000",
  "learningRate": 0,
  "epochs": 0,
  "queuePosition": 1,
  "object": "training",
  "modelId": "5SXGNLCCOFGTMNMQYEOTAGBPVU",
  "trainParams": null,
  "trainStats": null,
  "modelType": "text-intent"
}
Predict

Now your model is ready to go! To test it out, send some text in for prediction and the model returns label names and probability values. The probability value is the prediction that the model makes for whether the text matches a label in its dataset. The higher the value, the higher the probability.

$ curl -X POST -H "Authorization: Bearer <TOKEN>" -H "Cache-Control: no-cache" -H "Content-Type: multipart/form-data" -F "modelId=<MODEL_ID>" -F "document=how is my package being shipped?"  https://api.einstein.ai/v2/language/intent
{
  "probabilities": [
    {
      "label": "Shipping Info",
      "probability": 0.82365495
    },
    {
      "label": "Sales Opportunity",
      "probability": 0.12523715
    },
    {
      "label": "Billing",
      "probability": 0.0487557
    },
    {
      "label": "Order Change",
      "probability": 0.0021365683
    },
    {
      "label": "Password Help",
      "probability": 0.0002156619
    }
  ],
  "object": "predictresponse"
}
x
We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.