Get started using UiPath
  • Updated on 17 Jul 2020
  • 5 minutes to read
  • Print
  • Share
  • Dark
    Light

Get started using UiPath

  • Print
  • Share
  • Dark
    Light

Before you begin


Getting an Aito instance

If you want to follow along with this get started guide, you'll have to go and get your own Aito instance from the Aito Console.

  1. Sign in or create an account, if you haven't got one already.
  2. In the Aito Console go to the instances page and click the "Create an instance" button.
  3. Select the instance type you want to create and fill in needed fields, Sandbox is the free instance for testing and small projects. Visit our pricing page, to learn more about the Aito instance types.
  4. Click "Create instance" and wait for a moment while your instance is created, you will receive an email once your instance is ready.

Getting UiPath

If you haven't already, install UiPath Studio on your machine, or use any other UiPath software you're familiar with.


TL;DR

Getting started with Aito in UiPath is quite straight forward. Follow these steps to use the basic functionality.

  1. Create the UiPath variables, but add your specific API URL and key.
Name Variable type Scope Default
api_url String Sequence "your-predict-api-url "
api_key String Sequence "your-rw/ro-api-key "
table String Sequence "invoice_data"
target String Sequence "Product_Category"
inputs String Sequence
query String Sequence
response String Sequence
  1. Formulate the query with Assign activity
    image.png

Value for the query variable:

"{""from"": """+table+""",""where"": "+inputs+",""predict"": """+target+""",""limit"": 1}"
  1. Set up HTTP Request activity with the correct properties
    image.png

Intro

Using Aito through UiPath works with the exact same principle as using Aito with a REST client: You can use the default HTTP Request activity in UiPath to send queries and get responses. This tutorial uses the _predict endpoint to make predictions, but the same principles apply to any other Aito query. This guide is done by using the UiPath project as a base.


Data

Data lives in Aito as tables. The train.csv of a Kaggle dataset will be put into Aito as one table which will be called invoice_data. It is possible to use linked tables in Aito but in this example having just one table is enough.

Aito needs data from the past in order to make predictions for the future. Kaggle has an excellent sample dataset (train.csv) which contains +5500 rows of data from invoices and the correct category for each. . The details can be used to define the invoice we want to predict category for. The value we want to predict also has to be encoded in the data as a column (or a feature in data science terms), in this case, it is Product_Category.

Here's a snapshot of the data:

Inv_Id Vendor_Code GL_Code Inv_Amt Item_Description Product_Category
15001 VENDOR-1676 GL-6100410 83.24 Artworking/Typesetting ... CLASS-1963
15002 VENDOR-1883 GL-2182000 51.18 Auto Leasing Corporate ... CLASS-1250
15004 VENDOR-1999 6050100 79.02 Store Management Lease/Rent ... CLASS-1274
... ... ... ... ... ...

Upload Data

  1. Upload the sample dataset into your Aito instance with the drag & drop feature in Aito Console instance overview.

console_upload

  1. Change the table name to invoice_data.

console_upload_table


Enable Packages

You first need to install the UiPath.Web.Activites package via the Manage Packages windows to get access to the HTTP Request activity. You also need to install the UiPath.System.Activities package to enable reading text files.
image.png

Create Variables

First, create a Sequence activity. The sequence uses several variables. The HTTP Request needs the URL and key, while the query needs a table name and target column name. You also need empty placeholders for inputs, query and response. These will be assigned during the sequence.

sequence_vars

  1. Click on Activities in the left sidebar
  2. Add the Sequence activity
  3. Click on variables (note that the Sequence activity should be selected)
  4. Add needed variables to the Sequence activity

Needed variables

Name Variable type Scope Default
api_url String Sequence "your-predict-api-url "
api_key String Sequence "your-rw/ro-api-key "
table String Sequence "invoice_data"
target String Sequence "Product_Category"
inputs String Sequence
query String Sequence
response String Sequence

You can get your Aito instance API URL and API key through the Aito Console. Note that the your-predict-api-url should be the full path to the _predict endpoint e.g. https://your-instance.aito.app/api/v1/_predict.

api_info


Read Input Data

In this tutorial, the input information is read from a text file. In the real world scenario, the inputs would come from earlier parts of the sequence. Here's an example of how the input.txt file should look like, located in the project directory:

{
 "Inv_Id": 15033,
 "Vendor_Code": "VENDOR-1424",
 "GL_Code": "GL-6100410",
 "Inv_Amt": 78.78,
 "Item_Description": "Digital Display"
}

The input describes an imaginary invoice for which the invoice category will be predicted. Aito will use all of the variables defined for the invoice as information about the invoice.

Use the Read Text File activity to assign the file content to the inputs variable:
image.png


Formulate Query

Next, you will define the query that will do the prediction of the invoice category.

Aito query's generic syntax

The aito query follows a syntax that is based on this rule:

From a given context (a specific table and what is known from that table), use an operation to find the known or the unknown.

{
  "from"            : define the initial context (table name),
  "where"           : more details of the context,
  "operation_name"  : operation to be perform,
  "orderBy"         : sort the result by some metric,
  "select"          : select specific attributes or parts of the result,
  "offset"          : define the number of rows in the result to be skipped,
  "limit"           : limit the number of rows to be shown in the result
}

Query in UiPath

Aito expects the query to be in the proper format for the endpoint. Use the Assign activity to set up the query in its correct form. In UiPath the easiest way to go about this is by using Strings.
image.png

"{""from"": """+table+""",""where"": "+inputs+",""predict"": """+target+""",""limit"": 1}"

Send Query

Add the HTTP Request activity and fill the properties with the correct options and variables. Remember to open up the Options -> Headers window to fill in the x-api-key and content-type headers. The response from Aito is assigned to the response variable you created.
image.png


Show Results

Lastly, you might want to inspect the response from Aito. The simplest way to do this is to use the Write Line activity and display the newly received content of the response variable in the Output window.
image.png


Run the pipeline

Now you're ready to run the prediction pipeline. Select the sequence and hit the "Debug File" play button.

The following result should be now shown in the Output window.

image.png


Full Sequence

Here's how the full sequence looks like. Quite straightforward.
image.png

You can find the sequence as an attachment in this guide. After uploading the sample dataset to your Aito instance, to run the UiPath file you will have to go through these steps:

  1. Download the attachment
  2. Create the input.txt file in the folder you saved the attachment
  3. After opening the file, install the UiPath.Web.Activities package
  4. Add your API URL and API key to the Sequence variables
  5. Run the file
Attachments
6.95 KB
Was this article helpful?