Skip to main content

Overview

The Sentiment evaluator classifies the affect the user expresses in their latest message as positive, neutral, or negative. It judges the user’s own expressed feeling — not the assistant’s tone, and not whether the topic is inherently pleasant or unpleasant. Use it to track how users feel across a conversation, surface turns worth reviewing, and measure whether product changes shift expressed sentiment.
Sentiment is descriptive, not a quality signal: no label is “good” or “bad”, so the evaluator has no preferred direction. A plain question or instruction is neutral, even about an unpleasant topic, and a routine “thanks” is neutral, not positive. When the evidence is weak or ambiguous, the label defaults to neutral.
Negative sentiment and user friction are related but not the same, and the relationship is one-directional. A user can be negative about their own situation while raising no objection to the assistant (“my order still hasn’t arrived”). The reverse does not hold: friction toward the assistant — correcting or challenging it after it mishandled a request it had the information to get right — always carries negative sentiment, even when phrased flatly. Only redirecting the assistant toward a direction never previously requested is friction-free and, absent other affect, neutral.

Supported Levels

Relevant span kinds: AGENT, CHAIN, and LLM spans that preserve multi-turn conversation history.

Input Requirements

Keep the target message separate from conversation. The conversation is used only to resolve what the latest user message refers to; the label reflects the affect of the latest message alone. Render tool activity compactly and remove non-human payloads before evaluation.

Output Interpretation

Usage Examples

Using a Decision Model

The same evaluator can be backed by a decision model instead of a language model. A decision model picks a label directly and returns per-label probabilities (and a confidence when the provider reports one) but no explanation.

Using Input Mapping

Map your trace or dataset fields into the evaluator’s two-field contract. The conversation should end immediately before the target user message.
See Input Mapping for additional mapping options.

Viewing and Modifying the Prompt

The default prompt is maintained in the classification evaluator config. Adapt it when your application has domain-specific conventions.

Configuration

For model and provider options, see Configuring the LLM.

Using with Phoenix

Benchmarks

On a 36-example authored synthetic benchmark using gpt-4o-mini, the default prompt achieves 0.97 accuracy, 0.98 macro precision, 0.98 macro recall, and 0.98 macro F1. The benchmark exercises the rubric’s hard distinctions — calm questions on unpleasant topics, routine courtesy, friction toward the assistant, friction-free redirects, negative sentiment without friction, and multi-turn conversations. See sentiment.synthetic.eval.ts for the full example set.

API Reference