Building an Instill AI Pipeline in 5 minutes
Tags: ai, automl, gpt3, machinelearning
Published: 2023-10-22 21:07:31

![Cover](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a1hltzmm7tt9fr6q47ot.png)

## Introduction

InstillAI is a no-code or low-code platform that enables users to build AI workflows for unstructured data at lightning-fast speed.

The Instill core can be broadly categorized into 3 segments, namely:

- Instill VDP: VDP stands for Versatile Data Processing and it represents a comprehensive unstructured data infrastructure. Instill VDP aims to simplify the processing of such unstructured data from A-Z easily.

- Instill Model: This part of the core enables you for MLOps. The Instill Model makes way for you to import and serve ML models hassle-free for gaining insights in the form of inferences.

- Instill Base: This is the base in the true sense for all the Instill Projects as it manages the underlying services such as user management servers, databases, and third-party observability tools. It also upgrades the accessibility and usability across VDP and Model.

Now after that long introduction, let's do something interesting with it. In this article, we will build an AI pipeline for `Text Sentiment Analysis` in just 5 minutes.

So, set your timer, and let's get going.

## Setting up the Pipeline

You will now learn how you can set up an AI pipeline on InstillAI Follow the steps below to complete it easily.

**Step 1:** Log in to your InstillAI Cloud account. If you don't have an account yet, you can create one [here](https://www.instill.tech/) for free using your Email or Google or GitHub ID.

![Sign Up](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s4ispxg7gu28izh469nh.png)

**Step 2:** Once you're logged in, it takes you to your console dashboard.

![Dashboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/snfyqf4p100uu3uphxk5.png)

Here you can find some pre-defined pipeline templates to get started with. But for now, you will do everything from scratch.

Click on the `Add Pipeline` button to create a new pipeline.

**Step 3:** It takes you to the pipeline creator dashboard. Here you can notice that there's something like a flowchart at the middle of the screen. It mainly consists of three things.

- **Start:** Here you will define your input elements.
- **Connector:** Here you will define your AI Agent (OpenAI, Llama, etc)
- **End:** Here you will see the output.

![Pipeline Dashboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yh96l002sax6pfz5ukb6.png)

**Step 4:** You will perform a text sentiment analysis here. So, you have to create a `Text` field in the Start section.

Click on `Add Field` in the `Start` section and then select `Text`. In the next screen, provide a `Name` for the field and the `Key` through which you will access it.

![Start Text Field](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yo3ma8tepd4b9p2lzfot.png)

**Step 5:** Now move on to set up the connector for this pipeline. To complete this particular task, you can use OpenAI GPT as a connector.

Simply click on `Add Connector` and on the next screen, select `OpenAI` from the `New Resource` section.

![New Resource](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cy7mdlmwo3rf6jzp1avs.png)

**Step 6:** Once you select the new resource, your connector section will now show the option to create a resource. Click on `Create Resource` to proceed.

![Create Resources](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0bcds2n0ifpjpltljvar.png)

In the `Add Resource` modal, provide an `ID`, `Description`, `OpenAI API Key`, and an `Organization` name, and finally click on `Save`. This creates an OpenAI resource for you.

![OpenAI Resource Config](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a56zrheljacnr7q118tf.png)

> **Note: You need to sign up on OpenAI to obtain your own API key. The key shown in the image above is a dummy.**

**Step 7:** Now you can create an AI Task for Sentiment Analysis using the above OpenAI resource. Click on the ⚙️ icon on the Connector section to configure the AI Task. You can use the options below or can customize it as per your needs.

- **Task:** Text Generation
- **prompt:** Analyze the sentiment of ``{{start.text}}`` and return back the sentiment. The output should be in the format- Sentiment: Sentiment Value
- **model:** gpt-3.5-turbo
- **system_message:** You are an assistant who is in charge of sentiment analysis of texts.
- **temperature:** 0.5 (We want to have a more focussed response)
- **n:** 1 (Defines the number of chat completion choices)
- **max_tokens:** 2500

![AI Task Config](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xz5u67ypv6bh5da44ro6.png)

Now click on `Save` to save the AI Task.

> **Note: We are using the value of the Text field defined in the Start section for sentiment analysis. You can access that value by using `{{start.keyName}}`.**
 
**Step 8:** You will now notice that the `Start` and `Connector` sections are connected. This is because you used the text value from the `Start` section in the AI Task.

![StartToConnector](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m3yg4g2pe8kk7no9qn2u.png)

**Step 9:** Now you have to configure the `End` section so that you can see the results there. Click on `Add Field`, provide a `Title, a `Key`, and the `Value` for this field.

![End Configure](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j5sd4gcsvw8yh1w6ox6o.png)

The simple logic to determine the Value for the End field is as follows.

- The connector provides the `output` which has the `Key` name as `texts`. So, the value here can be accessed by ``{{connector_name.output.texts}}``.

Now once you hit the `Save`, you will find that the `Connector` and the `End` sections are connected as well.

![ConnectorToEnd](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4448o8yvtv5mgecslqv5.png)

You are now ready to run this pipeline and test it. Before that, click on `Save` in the top right section of the screen to save this pipeline.

## Testing the Pipeline

You can now click on the `Run` button which is beside the `Save` button to start testing this pipeline with an actual run.

![Testing](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6dy291uaoasc2otdwmpj.png)

On the next screen, type a text in the Start section which would act as an input to the AI task, and then click on `Run` on top of it.

![Running Task](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pb2vbss653m2v7zzwg46.png)

Wait for a while and then you can see the sentiment of the above sentence in the `output` field of the `Connector` as well as the `End` section.

![Output](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/07gu3ftt4fgzify0zafy.png)

This confirms that your pipeline is properly set and is working as expected. You can stop the pipeline by clicking on the `Stop` button at the top right section of the screen.

## Conclusion

In this tutorial, you finally learned how to create an AI pipeline easily using InstillAI. You also successfully completed the sentiment analysis of texts using the OpenAI resource in the pipeline.

InstillAI is currently in its Alpha stage and all of its features are free to use. Feel free to explore it and provide feedback to their team through their [Discord](https://discord.gg/rRv7MXxxjM) server.

Lastly, if you liked reading this article, please don't forget to drop a Like and share it with your peers. Feel free to provide your feedback or suggestions in the comments below.

[![Banner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/24200iez4dqb9fpn7uox.png)](https://www.instill.tech/)

[![Sponsor](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wy1gzoac406peqnmtpoq.png)](https://github.com/sponsors/Rutam21)