Enable Sentiment Analysis

This topic covers the configuration of the Sentiment feature of the Discourse AI plugin.


Sentiment Analysis helps you keep tabs on your community by analyzing posts and providing sentiment and emotional scores to give you an overall sense of your community for any period of time. These insights can be helpful in determining the type of users posting within your community and interacting with one another.

The following showcases how to access Sentiment Analysis for a community.


  • Overall sentiment: compares the number of posts classified as either positive or negative
  • Bar graph showcasing togglable numerical value for positive, negative, and overall scores
  • Post emotion: number of posts classified by the following emotions, grouped and toggleable by user’s trust levels
    • Sadness
    • Disgust
    • Fear
    • Anger
    • Joy
    • Surprise
  • Posts are assigned numerical values for emotions in the spider chart
  • Reports for any period of time that can be accessed via settings
    • Yearly
    • Quarterly
    • Monthly
    • Weekly
    • Custom range
  • Applicable only for admin users


:discourse: Currently, this module is available for all hosted by Discourse customers on the Enterprise plan. If you’re an Enterprise customer you can contact us to have it added to your site on request. :discourse:

:information_source: Self-hosted users can install the plugin anytime by following Install Plugins in Discourse - sysadmin - Discourse Meta

Enabling Sentiment Analysis


  1. Go to Admin settings-> Plugins → search or find discourse-ai and make sure its enabled
  2. Enable ai_sentiment_enabled for Sentiment Analysis
  3. Select which models (emotion/sentiment) you would like to use at ai_sentiment_models
  4. Head over to YourDiscourseSite/admin/dashboard/sentiment to see the reports

:information_source: Once enabled, Sentiment will classify all new posts going forward. To classify all of your site’s historical posts, a backfill task must be run from the console.

:mechanic: Self-hosted?

./launcher enter app
rake ai:sentiment:backfill

:discourse2: Hosted by us?

Contact us at team@discourse.org and we’ll do it for you. :+1: :partying_face:

Technical FAQ

  • How is topic/post data processed? How are scores assigned?
    • Sentiment analysis has a “per post” fidelity. For each post we are able to tell sentiment and then cut that data in many shapes (per tag / category / time etc… )
  • When Sentiment Analysis is enabled, does it go through all previous posts or just new ones?
    • A backfill task must be initiated to go through all previous posts
  • Are there any plans to add support for other languages?
    • In the future Yes! both by adding multilingual simple Machine Learning (ML) models and by using multilingual Large Language Models (LLMs) to classify the data instead of dedicated models


  • Sentiment Analysis is an area of experimentation and is changing rapidly as we add new UI elements and improve with feedback
  • Sentiment Analysis metrics can also be accessed through Data Explorer queries
Old settings


  • ai_sentiment_enabled: Enables or disables the module

  • ai_sentiment_inference_service_api_endpoint: URL where the API is running for the module. If you are using CDCK hosting this is automatically handled for you. If you are self-hosting check the self-hosting guide.

  • ai_sentiment_inference_service_api_key: API key for the API configured above. If you are using CDCK hosting this is automatically handled for you. If you are self-hosting check the self-hosting guide.

  • ai_sentiment_models: We off a model for sentiment and one for emotion. Enable the modules you want to use here. You can enable both.


Which model(s) are used/support/planned for this Discourse AI module?

1 Like

I think the current ones are:


How does one do this? I’ve searched the forum but can’t find anything related to how to create a backfill task.

Here you go:

Would make sense to add it to the guide though. :slight_smile:

Update I added it. :+1:


Is this list of providers still current? I noticed the table was removed from the main Discourse AI topic, and the Sentiment Analysis guide doesn’t include a list.

Looking at the config I’m not sure how this works being self hosted. The only selections in model are I imagine going to point me back to a model at discourse? Is there a way to truly do this self hosted?

Or is the model selection really just changing the prompting to use the LLM I’ve configured via API for the task?

Have you seen Discourse AI - Self-Hosted Guide ?

Oh man. I had not looked at the guide. My apologies. Appreciate the point in the right direction.

1 Like