Sentiment Analysis

Determine the sentiment (positive, negative, neutral) of text using an LLM.

Written By pvdyck

Last updated 18 minutes ago

Sentiment Analysis

The Sentiment Analysis node uses an LLM to classify the emotional tone of input text into sentiment categories.

How It Works

The node sends text to a connected language model with built-in prompting that asks the model to determine sentiment. The output is a structured classification you can use for routing or reporting.

Parameters

ParameterDescription
TextThe input text to analyze. Supports expressions like {{ $json.message }}.
CategoriesSentiment categories to classify into. Default: Positive, Negative, Neutral. Customizable -- you can add fine-grained categories like Excited, Happy, Neutral, Disappointed, Angry.
Include Detailed ResultsAdds sentiment strength and confidence scores to the output. Note: these are model-generated estimates, not precise measurements.
System Prompt TemplateCustomize the analysis prompt. Use the {categories} placeholder to insert your category list into the prompt.
Enable Auto-FixingAutomatically re-prompts the model if the output doesn't match expected categories.

Output

The node returns:

  • Sentiment β€” The classified category (e.g., "Positive", "Negative", "Neutral").
  • Confidence β€” How confident the model is in its classification (when supported by the model).

Sub-Node Connections

InputRequiredDescription
AI Language ModelYesThe LLM powering the analysis (e.g., OpenRouter, OpenAI).
Output ParserNoAdditional output formatting.

Example Use Cases

  • Classify customer feedback before routing to support teams
  • Monitor social media mentions for brand sentiment
  • Triage support tickets by urgency/emotion
  • Score NPS survey responses automatically

Tips

  • Set the language model temperature to 0 (or near-zero) for consistent, reproducible sentiment classification.
  • Customize categories for your domain (e.g., "Urgent", "Frustrated", "Satisfied" for support tickets).
  • Use the System Prompt Template to handle edge cases like sarcasm or mixed sentiment.
  • Split large text volumes into smaller chunks for more efficient processing.
  • Chain with a Switch node to route messages based on sentiment result.
  • Performance varies by input language -- verify the connected model supports your target language.

Related