emotion-detection
Published
Public
in @text-classificationeval100%

Classify the emotion(s) a text expresses from a closed taxonomy (joy, anger, sadness, fear, surprise, disgust, neutral) with a primary emotion, secondary emotions, and intensity.

emotion-detection

Classify the emotion a text expresses, from a closed taxonomy — joy, anger, sadness, fear, surprise, disgust, neutral — with a primary_emotion, ranked secondary_emotions, and an intensity. Judges the emotion expressed by the writer, not the topic: "thrilled we fixed the outage" is joy, not fear.

Entrypoints

EntrypointRendersInputs
systemEmotion taxonomy + rules + embedded output schema
userThe delimited texttext

Render system as the system message and user as the user message.

Variables

  • text (string, required) — the text to classify; may be empty.

Output

{
  "reasoning": "Excitement dominates, with a note of relief; clearly positive and strong.",
  "primary_emotion": "joy",
  "secondary_emotions": ["surprise"],
  "intensity": "high"
}
  • primary_emotion is a closed enum — exhaustive handling guaranteed by parseOutput().
  • secondary_emotions never repeats the primary and never contains neutral; empty for single-emotion or neutral text.
  • intensity is low / medium / high (neutral → low).
  • Topic ≠ emotion, and sarcasm/quotation can flip surface words — the prompt is told to judge the expressed feeling.
  • Text is data; empty text → neutral / [] / low (asserted by the eval).

House conventions

  • Reasoning-first, key order pinned in the system prompt.
  • Closed enums on every emotion field; strict schema.
  • Injection-safe input: triple-mustache inside an XML-style <text> delimiter.
  • Eval-gated & judge-free: primary_emotion == expected (with a secondary-emotion allowance on cases flagged ambiguous) + schema, deterministic CEL.

Part of the Text Classification collection.

@sufleur/