Skip to content

Getting Started

Logo

Update

This version of Autosuggest is deprecated and is put into a maintanance mode. If you're just onboarding now, consider using Autossugest v2.

Quick Start

1. Create a dataset

Autosuggest works in a concept of datasets which serve as collection of data used to train machine learning models. In this step, you'll initiate the creation of a bank statement classifier dataset. To create the dataset, submit the following request.

If you look at the body of the request below, you can find that the classifier is going to be trained on two targets, each with two target values. In essence, the model aims to predict expenses types and the corresponding accounts for those expenses.

The dataset name has to be unique per project, so you might encounter some conflicts with other users of the demo.

If you are using the "demo" token like the example below, note that the dataset name must be unique per project. The uniqueness requirement prevents conflicts with other users in the demo environment.


POST v1/<dataset-type>:create

https://api.stag.asgt.visma.ai/v1/bank:create
<dataset-type> can be substituted with bank, scanned-invoice and electronic-invoice-line depending on the data structure needed.


Authorization - Bearer Token

Token: demo


Body - raw (json)

Body
{
    "name": "dataset-name",
    "tags": [
        "company1",
        "customer1"
    ],
    "samples": [
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "supermarket"
                },
                {
                    "name": "account",
                    "value": "001"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Local Supermart - Weekly Groceries",
                    "amount": 120.50
                }
            }
        },
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "supermarket"
                },
                {
                    "name": "account",
                    "value": "001"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Buying toilet paper",
                    "amount": 198.50
                }
            }
        },
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "supermarket"
                },
                {
                    "name": "account",
                    "value": "001"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Local Supermart",
                    "amount": 120.99
                }
            }
        },
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "supermarket"
                },
                {
                    "name": "account",
                    "value": "001"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Shopping mall - Groceries",
                    "amount": 125.99
                }
            }
        },
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "supermarket"
                },
                {
                    "name": "account",
                    "value": "001"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Super Supermart - Daily Groceries",
                    "amount": 18.50
                }
            }
        },
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "supermarket"
                },
                {
                    "name": "account",
                    "value": "001"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Local-ish Supermart - Weekly Groceries",
                    "amount": 120.69
                }
            }
        },
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "supermarket"
                },
                {
                    "name": "account",
                    "value": "001"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Fresh Market - Produce and Snacks",
                    "amount": 45.75
                }
            }
        },
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "supermarket"
                },
                {
                    "name": "account",
                    "value": "001"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Neighborhood Grocers - Monthly Supplies",
                    "amount": 150.20
                }
            }
        },
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "supermarket"
                },
                {
                    "name": "account",
                    "value": "001"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Discount I couldn't resist",
                    "amount": 69
                }
            }
        },
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "supermarket"
                },
                {
                    "name": "account",
                    "value": "001"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Supersuper market",
                    "amount": 99.99
                }
            }
        },
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "office-supplies"
                },
                {
                    "name": "account",
                    "value": "002"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Local Office Supplies Store - Monthly Restock",
                    "amount": 85.50
                }
            }
        },
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "office-supplies"
                },
                {
                    "name": "account",
                    "value": "002"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Online Office Depot - Printer Paper and Ink",
                    "amount": 35.25
                }
            }
        },
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "office-supplies"
                },
                {
                    "name": "account",
                    "value": "002"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Stationery World - New Office Supplies",
                    "amount": 120.75
                }
            }
        },
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "office-supplies"
                },
                {
                    "name": "account",
                    "value": "002"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Dunder Mifflin",
                    "amount": 999
                }
            }
        },
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "office-supplies"
                },
                {
                    "name": "account",
                    "value": "002"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Tech Solutions Inc. - Tech Accessories",
                    "amount": 50.00
                }
            }
        },
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "office-supplies"
                },
                {
                    "name": "account",
                    "value": "002"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Business Essentials Co. - Office Equipment",
                    "amount": 200.30
                }
            }
        },
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "office-supplies"
                },
                {
                    "name": "account",
                    "value": "002"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Business Essentials Co.",
                    "amount": 199.30
                }
            }
        },
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "office-supplies"
                },
                {
                    "name": "account",
                    "value": "002"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Essentials Co.",
                    "amount": 999.99
                }
            }
        },
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "office-supplies"
                },
                {
                    "name": "account",
                    "value": "002"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Printer Business Co.",
                    "amount": 16890.79
                }
            }
        },
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "office-supplies"
                },
                {
                    "name": "account",
                    "value": "002"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Office desks Business Co.",
                    "amount": 1234.79
                }
            }
        }
    ]
}


2. Check training status

The info endpoint shows details for a dataset with last successful training.


GET v1/<dataset-type>/<dataset-name>:info

https://api.stag.asgt.visma.ai/v1/bank/dataset-name:info
<dataset-type> has to be substituted with bank, scanned-invoice or electronic-invoice-line depending on the data structure needed. <dataset-name> should be taken from the body of the create dataset request.


Authorization - Bearer Token

Token: demo


Body - empty


3. Make a prediction

After confirming that the model has been successfully trained through the info endpoint, you are ready to make predictions. The model, having learned from the dataset you created, will provide predictions based on the input, giving suggestions on how you categorise expenses and assign them to the relevant accounts.


POST v1/<dataset-type>/<dataset-name>:suggest

https://api.stag.asgt.visma.ai/v1/bank/dataset-name:suggest
<dataset-type> has to be substituted with bank, scanned-invoice or electronic-invoice-line depending on the data structure needed. <dataset-name> should be taken from the body of the create dataset request.


Authorization - Bearer Token

Token: demo


Body - raw (json)

Body
{
    "inputs": [
        {
            "transaction": {
                "text": "Groceries"
            }
        }
    ]
}


4. Improve by adding data

To continuously improve your datasets and keep them up to date, Autosuggest provides functionality to add more data into an existing dataset.


POST v1/<dataset-type>/<dataset-name>:append

https://api.stag.asgt.visma.ai/v1/bank/dataset-name:append
<dataset-type> has to be substituted with bank, scanned-invoice or electronic-invoice-line depending on the data structure needed. <dataset-name> should be taken from the body of the create dataset request.


Authorization - Bearer Token

Token: demo


Body - raw (json)

Body
{
    "samples": [
        {
            "targetValues": [
                {
                    "name": "expense",
                    "value": "supermarket"
                },
                {
                    "name": "account",
                    "value": "001"
                }
            ],
            "data": {
                "transaction": {
                    "text": "Discount I couldn't resist (again)",
                    "amount": 420.00
                }
            }
        }
    ]
}


Prediction quality

All predictions generated by Autosuggest are accompanied by a confidence score, serving as a metric for the prediction's quality. Generally, higher confidences indicate to a higher probability of the suggestion being accurate.

To present your users with reliable predictions, it's advisable to filter out (i.e. simply disregard) answers with confidence scores below an acceptable threshold.

Threshold choice

Picking the optimal cutoff threshold involves a bit of trial and error. The higher number you choose, the better the quality of the predictions you're showing to the user, but conversely you're also providing less prediction output to the user.

What the right tradeoff is, depends on user preferences, UX considerations, and the specific use case you're using Autosuggest for.

For instance, if you set a quality score threshold of 0.85, Autosuggest automatically displays suggestions when their confidence exceeds 85%.