Course/Chapter 8/3. Classification & Sentiment Analysis
    advanced
    Chapter 8: AI & LLM Integration

    3. Classification & Sentiment Analysis

    Categorize and analyze text with AI.

    15m Lesson 3 of 5

    AI excels at classification tasks: sorting support tickets, analyzing sentiment, extracting entities, and routing content to the right team.

    Code Examples

    Support Ticket Classifier
    javascript
    const ticket = $json.message;
    
    const prompt = `Classify this support ticket into exactly one category 
    and assess sentiment. Return JSON only.
    
    Categories: billing, technical, account, feature_request, other
    Sentiment: positive, neutral, negative, urgent
    
    Ticket: "${ticket}"
    
    Respond with: {"category": "...", "sentiment": "...", "priority": 1-5}`;
    
    return [{ json: { prompt, ticket } }];

    Pro Tips

    • 💡Ask the AI to return structured JSON for classification tasks — it makes downstream processing much easier

    Comprehension Quiz

    Answer 2 of 2 correctly to unlock lesson completion.

    1. What output format should you request from AI for classification tasks?

    2. What is sentiment analysis?

    Pass the quiz above to unlock lesson completion