In this guide, we will make a Sentiment Analysis app that extracts sentiment, keywords, and a sentiment score from a restaurant review.
Start from a Blank Workflow
We have a template "Sentiment Analyze" template you may use, but in this guide, we will show you how to build an app from a blank workflow. To get started, click Templates > Blank Workflow.
There are 3 steps to create your first AirOps app:
- Define the inputs
- Configure the Large Language Model
- Save, test, and publish the app
An input is any data you want to provide to your workflow to customize the outcome.
For our restaurant review sentiment analysis app, we need to add an input for the restaurant review.
- Click on a Blank Workflow to start a draft of your workflow
- Click Add field in the Start step
- Click on Long Text to create a multi-line text box
- Label the field "Restaurant Review"
- Optionally: configure the Variable Name, which will be used to reference the input. Notice the variable name will be "restaurant_review" by default.
- Optionally: write a Hint to provide further detail or instructions for the user such as "Enter a single restaurant review to analyze"
- Make the field Required by clicking on the toggle
- Click Save field
Next, we need to use an LLM step to analyze the sentiment of the restaurant review.
- Add an LLM Step: click Add Step > LLM > Configure
- Choose Your Model: for this app, we will use GPT Turbo 3.5 so no changes are needed
- Set the temperature: temperature determines the amount of variability in the response - the higher the temperature, the more varied the response. In this app, we want low variability, so we will set the temperature to 0.1
- Define the System: The system specifies the persona and/or task of the AI:
System: You are a restaurant review analyzer. Extract positive keywords, negative keywords, and a sentiment score on a scale from -1.0 to 1.0, in 0.1 increments, from the restaurant review. Output in JSON only
- Provide an Example of the Correct Response with a User-Assistant Pair: The user and the assistant are formal terms for the conversation between the human (user) and the AI (assistant). We provide a user-assistant pair - or an example of a human message and the AI response - in order to "train" the model to respond in the desired way. (This is also known as one-shot prompting).
User: I ordered chirash for lunch. Good presentation. Need to work on the freshness of the items. Service was good. Would not return for raw items.
"positive_keywords": [ "good presentation", "service was good"]
"negative_keywords": [ "need to work on the freshness of the items", "would not return for raw items" ]
Use a real-life example
The best way to generate high-quality outputs is by providing a high-quality example to the model. Use the most realistic example when possible, whether from the internet or from your own data.
- Add your input to the prompt: Now that we've provided an example to the model, we need to provide the restaurant review to the model by referencing the variable name with Liquid syntax:
- Get the variable name from your input in the Start Step (restaurant_review)
- Add a user message after the User/Assistant pair you provided from Step 2
- Click on the pill of your input variable in the user message - this will apply Liquid syntax to your variable!
- Save a draft of your app:
- Name your app
- Optionally, select an app emoji
- Then, test and validate that it works as expected:
- Click Test All
- Copy and paste a restaurant review to analyze
- Click Execute
- Publish the app after testing
- Click Publish App
- Run the app once or as a batch
- Click Run App
The difference between saving a draft and publishing an app
Publishing an app means:
- Your app is also permanently as a version, so you can revert whenever you want
- Your app is shareable!
- You can run the app as a batch, API, or add it as an app step to another workflow or agent
Updated about 1 month ago