DEV Community

Rutam Prita Mishra
Rutam Prita Mishra

Posted on

Building an Instill AI Pipeline in 5 minutes

Cover

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 for free using your Email or Google or GitHub ID.

Sign Up

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

Dashboard

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

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

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

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

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

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

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

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, aKey, and theValue` for this field.

End Configure

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

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

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

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

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 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

Sponsor

Top comments (0)