Skip to content

LLM-based sentiment classification for social mentions #104

@arberx

Description

@arberx

Summary

Add optional LLM-based sentiment classification as a post-processing step for social mentions.

Details

After social mentions are ingested, optionally classify each mention's sentiment as positive, neutral, or negative using a cheap LLM (Haiku or GPT-4o-mini).

Implementation

  • Reuse existing provider infrastructure (ProviderAdapter.generateText()) — no new LLM integration needed
  • Process new mentions in batch after each social monitoring run
  • Store result in social_mentions.sentiment column (already in schema)
  • Configurable via socialConfig.sentimentAnalysis: true in canonry.yaml
  • Include confidence threshold — only store classification above threshold

Prompt design

Simple zero-shot classification prompt:

Classify the sentiment of this social media post about [brand] as positive, neutral, or negative. Respond with only the sentiment label.

Post: [content_text]

Depends on

  • Social contracts, DB migration, at least one adapter

Acceptance Criteria

  • Sentiment classification runs as post-processing after social runs
  • Uses cheapest available provider (Haiku > GPT-4o-mini)
  • Configurable on/off via socialConfig.sentimentAnalysis
  • Confidence threshold prevents low-quality classifications
  • Tests verify classification and storage

Metadata

Metadata

Assignees

No one assigned

    Labels

    phase-dPhase D: Sentiment + Unified DashboardsocialSocial platform monitoring

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions