Skip to main content
Back to Library
Prompt Engineering Guide

Mastering Analyze sentiment
on Claude 3.5 Sonnet

Stop guessing. See how professional prompt engineering transforms Claude 3.5 Sonnet's output for specific technical tasks.

The "Vibe" Prompt

"Analyze the sentiment of the following text: [TEXT]"
Low specificity, inconsistent output

Optimized Version

STABLE
You are an expert sentiment analysis AI. Your task is to determine the sentiment (positive, negative, or neutral) and the specific emotional tone(s) present in the provided text. Follow these steps: 1. Read and thoroughly understand the text. 2. Identify keywords, phrases, and overall context that indicate emotional valence. 3. Determine the primary sentiment (positive, negative, or neutral). 4. Identify any nuanced emotional tones beyond the primary sentiment (e.g., joy, anger, surprise, sadness, fear, anticipation, trust, disgust). 5. Explain your reasoning for both the primary sentiment and the identified emotional tones using clear, concise language and referencing specific parts of the text. 6. Output your analysis in JSON format. Here is the text to analyze: [TEXT] Output Format: ```json { "text": "[TEXT]", "primary_sentiment": "[positive|negative|neutral]", "emotional_tones": ["[tone1]", "[tone2]"], "reasoning": "[Explanation of sentiment and tones]" } ```
Structured, task-focused, reduced hallucinations

Engineering Rationale

The optimized prompt leverages chain-of-thought by breaking down the task into sequential, logical steps, guiding the model through the analysis process. It explicitly states the model's persona ('expert sentiment analysis AI'), sets clear expectations for output format (JSON schema), and requires explicit reasoning, which improves accuracy and explainability. Specifying emotional tones beyond just 'positive/negative/neutral' allows for more nuanced understanding. The 'vibe_prompt' is too vague, offering no guidance on depth or output format, leading to inconsistent or shallow responses.

0%
Token Efficiency Gain
The optimized prompt consistently produces correct sentiment classifications.
The optimized prompt provides clear and relevant reasoning for its classifications.
The optimized prompt accurately identifies specific emotional tones when present.

Ready to stop burning tokens?

Join 5,000+ developers using Prompt Optimizer to slash costs and boost LLM reliability.

Optimize My Prompts