---
schema_version: "1"
id: d15139927f070d49d61c9b37e0266940247743847960b0d4d5aae86d715ad6d4
title: Einstein Intent Quick Start
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/einstein-vision-language/einstein/guides/Einstein-Language/intent-quick-start-custom-classifier.md
canonical_url: https://developer.salesforce.com/docs/analytics/einstein-vision-language/guide/intent-quick-start-custom-classifier.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 5dc0d2259158f2a9d84f28fc118c947b2ed4ff23fff22394babc20d0a857ecf4
products:
  - Einstein Vision and Language
  - Einstein Vision and Language Repo
---

# 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.

## Prerequisites

- **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.

- **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](https://curl.haxx.se/download.html)

- **Get a Token**—The Einstein Vision and Language APIs use OAuth 2.0 JWT bearer token flow for authorization. Use the [token page](https://api.einstein.ai/web/token) to upload your key file and generate a JWT token. For step-by-step instructions, see [Set Up Authorization](https://developer.salesforce.com/docs/analytics/einstein-vision-language/guide/set-up-auth.md).

## Step 1: Define Your Classes and Gather Data

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](http://einstein.ai/text/case_routing_intent.csv) 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`

## Step 2: Create the Dataset

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

```cURL
curl -X POST -H "Authorization: Bearer <TOKEN>" -H "Cache-Control: no-cache" -H "Content-Type: multipart/form-data" -F "data=case_routing_intent.csv" -F "type=text-intent"  https://api.einstein.ai/v2/language/datasets/upload
```

This call is asynchronous, so the response looks like this JSON.

```json
{
  "id": 1004804,
  "name": "case_routing_intent.csv",
  "createdAt": "2019-06-22T19:31:58.000+0000.",
  "updatedAt": "2019-06-22T19:31:58.000+0000",
  "labelSummary": {
    "labels": []
  },
  "totalExamples": 0,
  "available": false,
  "statusMsg": "UPLOADING",
  "type": "text-intent",
  "language": "en_US",
  "numOfDuplicates": 0,
  "object": "dataset"
}
```

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.

```cURL
curl -X GET -H "Authorization: Bearer <TOKEN>" -H "Cache-Control: no-cache" https://api.einstein.ai/v2/language/datasets/<DATASET_ID>
```

The results look something like this JSON. You know the dataset is ready when `available` is `true` and `statusMsg` is `SUCCEEDED`.

```json
{
  "id": 1004804,
  "name": "case_routing_intent.csv",
  "createdAt": "2019-06-22T19:31:58.000+0000",
  "updatedAt": "2019-06-22T19:31:59.000+0000",
  "labelSummary": {
    "labels": [
      {
        "id": 23649,
        "datasetId": 1004804,
        "name": "Order Change",
        "numExamples": 26
      },
      {
        "id": 23650,
        "datasetId": 1004804,
        "name": "Sales Opportunity",
        "numExamples": 44
      },
      {
        "id": 23651,
        "datasetId": 1004804,
        "name": "Billing",
        "numExamples": 24
      },
      {
        "id": 23652,
        "datasetId": 1004804,
        "name": "Shipping Info",
        "numExamples": 30
      },
      {
        "id": 23653,
        "datasetId": 1004804,
        "name": "Password Help",
        "numExamples": 26
      }
    ]
  },
  "totalExamples": 150,
  "totalLabels": 5,
  "available": true,
  "statusMsg": "SUCCEEDED",
  "type": "text-intent",
  "language": "en_US",
  "numOfDuplicates": 0,
  "object": "dataset"
}
```

## Step 3: Train the Dataset to Create the Model

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.

```cURL
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
```

The response looks like this JSON.

```json
{
  "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",
  "modelId": "5SXGNLCCOFGTMNMQYEOTAGBPVU",
  "learningRate": 0,
  "epochs": 0,
  "queuePosition": 1,
  "modelType": "text-intent",
  "algorithm": "multilingual-intent",
  "language": "en_US",
  "object": "training",
  "trainParams": null,
  "trainStats": null
}
```

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.

```cURL
curl -X GET -H "Authorization: Bearer <TOKEN>" -H "Cache-Control: no-cache" https://api.einstein.ai/v2/language/train/<MODEL_ID>
```

The training status response looks like this JSON. The `status` of `SUCCEEDED` means that the model is ready for predictions.

```json
{
  "datasetId": 1004804,
  "datasetVersionId": 2473,
  "name": "Case Routing Model",
  "status": "SUCCEEDED",
  "progress": 1,
  "createdAt": "2019-06-22T19:39:38.000+0000",
  "updatedAt": "2019-06-22T19:43:39.000+0000",
  "modelId": "5SXGNLCCOFGTMNMQYEOTAGBPVU",
  "learningRate": 0,
  "epochs": 300,
  "modelType": "text-intent",
  "algorithm": "multilingual-intent",
  "language": "en_US",
  "object": "training",
  "trainParams": null,
  "trainStats": {
    "labels": 5,
    "examples": 150,
    "averageF1": 0.9492063492063492,
    "totalTime": "00:03:54:159",
    "transforms": null,
    "trainingTime": "00:03:53:150",
    "earlyStopping": true,
    "lastEpochDone": 267,
    "modelSaveTime": "00:00:01:561",
    "testSplitSize": 28,
    "trainSplitSize": 122,
    "datasetLoadTime": "00:00:01:008",
    "preProcessStats": null,
    "postProcessStats": null
  }
}
```

## Step 4: Send Text in for Prediction

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.

```cURL
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
```

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.

```json
{
  "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"
}
```
