Prompt Engineering Guide
Mastering Analyze sentiment
on GPT-4o-mini
Stop guessing. See how professional prompt engineering transforms GPT-4o-mini's output for specific technical tasks.
The "Vibe" Prompt
"Analyze the sentiment of the following text: [TEXT]"
Low specificity, inconsistent output
Optimized Version
You are an expert sentiment analysis AI.
Here is a text: "[TEXT]"
Analyze the sentiment of the text step-by-step. First, identify key phrases and words that indicate emotion or opinion. Second, determine the polarity (positive, negative, neutral) of each identified phrase/word. Third, aggregate these polarities to determine the overall sentiment. Finally, output the overall sentiment as one of: [POSITIVE, NEGATIVE, NEUTRAL].
Show your work.
Overall Sentiment:
Structured, task-focused, reduced hallucinations
Engineering Rationale
The optimized prompt leverages chain-of-thought to guide the model through the analysis process. It explicitly defines the steps: identifying key phrases, determining polarity of those phrases, and then aggregating to an overall sentiment. This structured approach reduces ambiguity and the likelihood of misinterpretation, leading to more consistent and accurate results. It also specifies the exact output format (POSITIVE, NEGATIVE, NEUTRAL), further constraining the model's response.
0%
Token Efficiency Gain
The optimized prompt consistently returns one of 'POSITIVE', 'NEGATIVE', or 'NEUTRAL'.
The optimized prompt provides a step-by-step breakdown of its reasoning.
The naive prompt sometimes outputs more descriptive text instead of just the sentiment.
Ready to stop burning tokens?
Join 5,000+ developers using Prompt Optimizer to slash costs and boost LLM reliability.
Optimize My Prompts