Einstein Intent Quick Start

This quick start shows you how to use the Einstein Intent API to create a model to route support cases. You can then use this model to analyze text and infer what the user wants to accomplish.

  • Sign up for an account—Follow the steps in What You Need to Call the API to set up your Einstein Platform Services account.

  • Find your key file—If you already created an account, locate the einstein_platform.pem file that you downloaded as part of that process. This file contains your private key.

  • Install cURL—We use the cURL command line tool throughout the following steps. This tool is installed by default on Linux and OSX. If you don’t already have it installed, download it from https://curl.haxx.se/download.html

  • Get a Token—The Einstein Platform Services APIs use OAuth 2.0 JWT bearer token flow for authorization. Use the token page to upload your key file and generate a JWT token. For step-by-step instructions, see Set Up Authorization.

In this step, you define the labels that you want the model to output when text is sent into the model for prediction. Then you gather text data for each of those labels, and that text is used to create a model.

This is typically the most time-consuming part of of the process. To make it easier for you to go through these steps, we provide a case routing .csv file that you can use.

The labels in the case routing dataset define the intent behind the text. The intent can then be used to route that case to the right department. Those labels are:

  • Billing
  • Order Change
  • Password Help
  • Sales Opportunity
  • Shipping Info

In this step, you use the data you gathered to create a dataset. In the following command, replace <TOKEN> with your JWT token and run the command. This command:

  • Creates a dataset called case_routing_intent from the specified .csv file by accessing the file via a URL
  • Creates five labels as specified in the .csv file
  • Creates 150 examples

This call is asynchronous, so the response looks like this JSON.

To verify that the data has been loaded, make a call to get the dataset. Replace <TOKEN> with your JWT token and <DATASET_ID> with ID of the dataset you created.

The results look something like this JSON. You know the dataset is ready when available is true and statusMsg is SUCCEEDED.

Use this cURL command to train the dataset and create a model. Replace <TOKEN> with your JWT token and <DATASET_ID> with ID of the dataset you created.

The response looks like this JSON.

Use the modelId to make this call and get the training status. Replace <TOKEN> with your JWT token and MODEL_ID with the ID of the model you created.

The training status response looks like this JSON. The status of SUCCEEDED means that the model is ready for predictions.

Now your model is ready to go! To test it out, send some text in for prediction. This cURL call takes the modelId of the model from which you want to return a prediction and the text string to analyze. Replace <TOKEN> with your JWT token and <MODEL_ID> with the ID of your model.

The response looks like this JSON. The model predicts that the text indicates that the user has a comment or question about shipping, so the model returns Shipping Info as the top probability. Your app can then use this information to route the case to the right department or agent.