Custom models can help you significantly improve accuracy by learning the speaking style and linguistic patterns of the speech in your application.

To train a custom model, all you have to do is upload a large amount of historical transcriptions to the API. We'll walk through how this works in the steps below.

For now, custom models are only trained on text data. In the future, we'll also be releasing support to train custom models on audio data.

Step 1: Compile historical transcripts

Lets say we want to improve accuracy for our customer service phone calls, and we have access to between dozens and thousands of historical phone calls that are transcribed (either by a machine or human).

First, we'll take all those historical phone call transcriptions and break them down into a big list of sentences/utterances, one sentence/utterance per line, for example:

Hi, welcome to ACME USA how can I help you?
My phone is broken and I need to get it fixed.
Sure I can help you with that.
...

Next, we'll upload those sentences to the /model endpoint, placing our list of sentences into the phrases array. The phrases array should be a list of sentences (ie, "utterances"):

You don't need to do any formatting (like punctuation removal, etc.) to the text data you send to the API. Behind the scenes, the API will clean all the text automatically for you.

curl --request POST \
    --url 'https://api.assemblyai.com/model' \
    --header 'authorization: your-secret-api-token' \
    --data '
    {
      "phrases": ["Hi, welcome to ACME USA how can I help you?", "My phone is broken and I need to get it fixed.", ...]
    }'

The response from the API will look like this:

{
   "model" : {
      "id" : 62584,
      "name" : "noted-donkey",
      "created" : "2018-06-06 22:05:01.783188",
      "status" : "training"
   }
}

Our custom model has an id of 62584, and a status of training. It takes about 10 minutes for a model to train. To check on the status, we can make a GET request:

curl --request GET \
    --url https://api.assemblyai.com/model/62584 \
    --header 'authorization: your-secret-api-token'
{
   "model" : {
      "id" : 62584,
      "status" : "training",
      "phrases" : [
        "Hi, welcome to ACME USA how can I help you?",
        "My phone is broken and I need to get it fixed.",
        ...
      ],
      "created" : "2018-06-06 22:05:01.783188",
      "name" : "noted-donkey"
   }
}

We can see our model still has a status of training. We can make GET requests until the model has as status of trained.

Step 2: Using our custom model

Once our model has a status of trained, we can use it.

To transcribe an audio file with our custom model, we simply make an API call to /transcript and include our model's id in the model_id parameter like this:

curl --request POST \
    --url https://api.assemblyai.com/transcript \
    --header 'authorization: your-secret-api-token' \
    --data '
    {
      "audio_src_url": "http://www.foo.bar/file.mp3",
      "model_id": 62584
    }'