TagUI
Using aito.ai from the open-source RPA tool TagUI is simple! This example uses an existing dataset in a demo instance, containing some thousands of purchase invoices that have already been categorised for Product_Category
and GL_Account
.
Uploading data to Aito
Making predictions
Using aito.ai predictions as part of the TagUI workflows is as simple as using the built-in api keyword.
First, construct the Aito query using your input data for the predictions. For example like this:
// Construct a predict query from your input data
linetext = "Rental car New York May 2021"
amount = 34.22
query = {"from": "invoice_data", "where": {"Item_Description": linetext, "Inv_Amt": amount}, "predict": "GL_Code", "limit": 1}
Next, consigure the HTTP call headers:
// Configure HTTP headers
api_config = {method:'POST', header:['x-api-key: bvss2i2dIkaWUfBCdzEO89LpxUkwO3A24hYg8MBq','content-type: application/json'], body:query};
Then make a call using the api
keyword. Note that the API key and the aito.ai instance in use here are publicly available for testing. Get your own instance for free at Console.
// Make API call to Aito predict endpoint
api https://public-1.api.aito.ai/api/v1/_predict
The use of results is simple, as TagUI automatically returns the JSON version of the response as api_json
. Here is where you would find the top result's predicted value and confidence:
// Print out the top feature and confidence.
echo Aito predicts `api_json.hits[0].feature` with confidence `api_json.hits[0].$p`
All the code together
The entire code is here, try running it yourself! :)
// This flow demonstrates the usage of Aito.ai _predict API endpoint with table already existing in Aito
// Construct a query from your input data
linetext = "Rental car New York May 2021"
amount = 34.22
query = {"from": "invoice_data", "where": {"Item_Description": linetext, "Inv_Amt": amount}, "predict": "GL_Code", "limit": 1}
// Configure HTTP headers
api_config = {method:'POST', header:['x-api-key: bvss2i2dIkaWUfBCdzEO89LpxUkwO3A24hYg8MBq','content-type: application/json'], body:query};
// Make API call to Aito predict endpoint
api https://public-1.api.aito.ai/api/v1/_predict
// Print out the top feature and confidence.
echo Aito predicts `api_json.hits[0].feature` with confidence `api_json.hits[0].$p`
Last updated
Was this helpful?