Using LLMs for Sentiment Analysis in Pipeline Builder
This document outlines how to perform sentiment analysis using Large Language Models (LLMs) within Palantir Foundry's Pipeline Builder. It details accessing and manipulating the 'Emails' dataset to integrate LLM capabilities for analyzing sentiment directly within the no-code pipeline environment.
Use LLMs for sentiment analysis in Pipeline Builder
This is Pipeline Builder, Foundry's no code application for transforming datasets and building pipelines
Double-click on the Emails node to see the Emails dataset and schema. Return to the main graph with the “Back to graph” button at the top.
Next, double-click to open the Use LLM node
- Important note: this node was generated using the “Sentiment Analysis Template”. The prompt that you are looking at now is the output from that template with given context and relevant column. When you open a new template the format will look different until you press “Create prompt”.
- Swap over to the Input table tab in the bottom panel. Try highlighting one to three rows and clicking Use rows for trial run. What happens when you press run?
- Try changing the instructions in the box at the top. What happens when you run the trial on the same rows as before?
- Try changing the “provide input data” to “email_body” instead of “subject”. How does this change the output of a trial run on the same rows?
Group by Sentiment
Return to the graph, then double-click on the Sentiment Grouping node to understand how to cast types, split the numerical sentiment values into qualitative positive/negative assignments, and select the columns that we want to bring through to the output dataset.
Use LLM 6 columns
Casting, Casing, and Selecting
In the cast board, we convert the llm_sentiment_score from a string to an integer. This is so we can more easily compare the numeric value of the llm sentiment.
In the case board, we make a new column, "email_sentiment" that's "positive" if the llm_sentiment_score is greater than 3, neutral if it's 3, and negative if it's less than 3.
In the select columns, we select and reorder the final table output.
Finally, double-click on the last node to see the output configuration in the right panel.
This is just one of many sentiment analysis use cases you can unlock today. With this, you could build use cases like:
Customer Feedback Analysis: Gauging customer sentiment from reviews, survey responses, and other free text posts to improve products and services.
Employee Feedback: Assessing the sentiment of employee reviews and feedback to identify areas of satisfaction and discontent within the organization.
Product Reviews Mining: Automatically categorizing product reviews by sentiment to quickly identify strengths and areas for improvement.
Content Moderation and Alerting: Screening user-generated content for negative sentiment as part of moderating online platforms to quickly respond to potential crises affecting the brand or community, and ensure a positive community environment.
Treat this pipeline as a jumping off point. Try playing around with the LLM prompts and building some of these yourself!