nœuds / builtin / ai / aiagents
Sentiment Analysis
Analyze the sentiment of a text using a LLM, or on-device with a Local Classifier
Ce contenu n’est pas encore disponible dans votre langue.
Label the tone of a text as positive, negative or neutral (or your own categories), with a chat model or on-device.
What it does
Section titled “What it does”Sentiment Analysis reads Text and returns one label in sentiment. What you connect to Model decides how; there is no setting to switch:
- A chat model (for example Chat OpenAI or Web LLM) is told to answer with only one of
positive,negative,neutral, or one of your Custom categories, without explanation. - A Local Classifier runs in your browser: free, private and offline. A fixed-label sentiment model uses its own labels, mapped onto
positive,negativeandneutral(for examplePOSITIVE/NEGATIVEor1 starto5 stars). A zero-shot model scores your Custom categories word for word, orpositive, negative, neutralwhen none are set. System message does not apply.
Older workflows saved with the former Engine setting on On-device and nothing connected to Model keep running their chosen on-device model. To change one, connect a Local Classifier.
When to use it
Section titled “When to use it”- Route negative reviews or support messages to a person, and the rest to an automatic reply.
- Tag feedback by mood (
angry, satisfied, confused) before saving it. - Screen customer messages privately, on-device, with a Local Classifier.
To sort text by topic rather than tone, use Text Classifier.
Inputs and settings
Section titled “Inputs and settings”| Réglage | Type | Ce que cela fait |
|---|---|---|
| Text (obligatoire) | Long text | The text to analyze the sentiment of. |
| Options | Group | The options for the node. |
| Options › Custom categories | Long text | Comma-separated list of custom sentiment categories to use instead of positive/negative/neutral. |
| Options › System message | Long text | The system message to use. |
Fill Text with an expression such as {{ $input.text }}. Write Custom categories as a comma-separated list, for example angry, satisfied, confused. Keep them short and clearly different from each other.
Outputs
Section titled “Outputs”-
Output
Each output item has these fields:
| Field | Type | What it holds |
|---|---|---|
| sentiment | Any | The sentiment label |
| score | Number | |
| scores | Key-value pairs | |
| predictions | Any |
{ "sentiment": null, "score": 0, "scores": {}, "predictions": null}- With a chat model, you get only
sentiment: the category the model answered. - With a Local Classifier, you also get
score(the confidence of the top label, 0 to 1) andscores, every label with its score. - Older workflows on the former on-device engine return
sentiment,scoreandpredictions(the raw list of labels and scores).
Branch on the label with an IF or Switch node, using {{ $input.sentiment }}.
Dependencies and credentials
Section titled “Dependencies and credentials”| Slot | Accepts | Connections |
|---|---|---|
| Model (obligatoire) | chat model, local classifier | One node. |
Connect a chat model, which holds its own API key, or a Local Classifier to run on-device. The Local Classifier needs an installed model: install one from its picker or the Local AI page.
Example workflow
Section titled “Example workflow”- Get Selected Text reads a review you highlighted, with Output field name
text. - Sentiment Analysis with Text
{{ $input.text }}and a Local Classifier on Model. - IF checks that
{{ $input.sentiment }}(String) is equal tonegative. - True goes to a Slack node that alerts your support channel.
Common issues
Section titled “Common issues”- “Connect a chat model or a Local Classifier to the Model port.” Nothing is connected to Model.
- “Model not found”. The connected chat model node is not set up: open it and choose a model and its credential.
- The label has extra words or a different capitalisation. Some chat models add text. Add a System message such as
Answer in lowercase, one word., or use a stronger model. - “Model “…” isn’t available. Install it from Local AI.“ An older workflow on the former on-device engine uses a model that is not installed. Install it, or connect a Local Classifier.
Related nodes
Section titled “Related nodes”- Text Classifier: sort text into your own categories.
- Local Classifier: the on-device model for this node.
- Analyze Text: on-device text classification without a model node.
- Guardrails: pass or fail text against a policy.