Skip to main content
Back to Library
Prompt Engineering Guide

Mastering Analyze sentiment
on Claude 3.5 Haiku

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

The "Vibe" Prompt

"Analyze the sentiment of the following text: {text_to_analyze}"
Low specificity, inconsistent output

Optimized Version

STABLE
You are a highly analytical sentiment analysis AI. Your task is to determine the sentiment (positive, negative, or neutral) of the provided text. Follow these steps: 1. Read the text carefully. 2. Identify key words, phrases, and their associated emotional charge. 3. Consider the overall context and any nuances, such as sarcasm or irony. 4. Based on your analysis, determine the most appropriate sentiment. 5. Output only the sentiment label: 'positive', 'negative', or 'neutral'. Text to analyze: {text_to_analyze} Sentiment:
Structured, task-focused, reduced hallucinations

Engineering Rationale

The optimized prompt provides clear instructions and a step-by-step chain-of-thought process, guiding the model towards a more accurate and consistent sentiment analysis. It explicitly defines the expected output format, reducing ambiguity. The 'vibe_prompt' is too vague and might lead to varied or less precise outputs, potentially including explanations rather than just the sentiment. The optimized version also reinforces the AI's role, which can sometimes lead to better adherence to instructions.

0%
Token Efficiency Gain
The optimized prompt consistently returns only 'positive', 'negative', or 'neutral'.
The optimized prompt handles subtle sentiment (e.g., mildly negative) more accurately than the naive prompt.
The optimized prompt correctly identifies sentiment in a text containing sarcasm.

Ready to stop burning tokens?

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

Optimize My Prompts