๐Ÿš€ Everything is free โ€” help us improve! Submit feedback and shape the platform.
๐ŸงชTDD Challengeยทbeginnerยทโฑ๏ธ 20โ€“35mยทโญ 120 XP

M-006Build a Sentiment Classifier

Description

Nebula Corp's product team wants to automatically classify customer reviews from their app store listing. They need a function that builds a few-shot prompt to classify reviews as Positive, Negative, or Neutral. The current implementation just returns a hardcoded value. Write a prompt-building function that uses few-shot examples to reliably classify sentiment โ€” and make all the test cases pass.

Test Cases (5)

Contains few-shot examples
The prompt must include examples covering all three sentiment labels
Input:"Great product, highly recommend!"
Expected:CONTAINS_ALL:Positive,Negative,Neutral
Includes the target review
The prompt must include the actual review to classify
Input:"Great product, highly recommend!"
Expected:CONTAINS:Great product, highly recommend!
Has classification instruction
The prompt must instruct the model to perform classification
Input:"Decent app"
Expected:CONTAINS_ANY:Classify,classify,sentiment,Sentiment
Ends with completion cue
The prompt should end with a cue for the model to complete with just the label
Input:"Terrible experience"
Expected:ENDS_WITH_ANY:Sentiment:,sentiment:,Label:,label:
Uses consistent example format
Examples should use a consistent format like Review: ... Sentiment: ...
Input:"It's okay I guess"
Expected:CONTAINS_ALL:Review:,Sentiment:

Related Lessons

Click Run / Check to validate your solution