Discourse AI

:discourse2: Summary Integration between AI features and Discourse
:hammer_and_wrench: Repository Link GitHub - discourse/discourse-ai
:open_book: Install Guide How to install plugins in Discourse

Please check our blog post about this plugin at

Introducing Discourse AI

We are happy to announce a brand new Discourse plugin that we have been working on: Discourse AI.

Discourse AI is our one-stop solution for integrating Artificial Intelligence and Discourse, enabling both new features and enhancing existing ones. With this first release, we are shipping 5 different Discourse AI modules.

Discourse AI Modules

For Discourse AI, we have opted to keep its features all in a single plugin, but separated by modules that you can enable independently and allow you to customize them for your community needs.

We’ve also made one of our priorities not to lock you to a single company API, so every community can pick the provider that makes sense for them, balancing data privacy, performance, feature sets, and vendor lock-in.

Community Sentiment

With the sentiment module, we will automatically classify every post in your community across sentiment (positive or negative) and/or emotion (joy, surprise, anger, disgust, fear, sadness, or neutral). This will allow your staff team to have insights into the community’s health and will help you to diagnose the sentiment across axes like category, topic, and user level.

Composer AI Helper

After composing your post, click on the :sparkles: icon and select any of the following options:

  • Suggest titles
  • Translate to English
  • Proofread

And after a couple of seconds, you will get some help from the AI.

This is enabled here on Meta for TL2+

Toxicity Detection

The toxicity module can scan both new posts and chat messages and classify them on a toxicity score across a variety of labels. Those toxicity scores are all available for reports, where the community moderators can identify content that may not be adequate for your instance.

And, if you want to get one step further, you can enable automatic flagging of content that crosses a customizable toxicity threshold, which will put the potential problematic content into the Discourse Review Queue, where they can be manually analyzed by your mod team.

NSFW Image Detection

The NSFW module will automatically scan every new upload in user posts and classify each image found for what’s usually considered NSFW content. The content of the classification is available via reports to your moderator team and, optionally, you can enable automatic flagging of content that crosses a certainty threshold.

Embeddings

This powers two modules at the moment:

Semantic Related Topics

When you get to the end of a topic, Discourse presents you with 5 suggestions of topics to read next. Nowadays, we pick 5 random topics for anonymous users and use the unread topics for logged-in users to populate that list, making it quick to generate but not very useful when you are researching a specific subject.

With the new Semantic Related Topics feature, we will use Semantic Textual Similarity between the current topic and all the other topics in your instance to suggest topics that are potentially more relevant to what a person is looking for.

This is enabled here on Meta for all, including anon

Semantic Search

This used the same logic we used for semantic related topics, but to power search results.

More on this soon.

Summarization

This module can summarize topics and chat channels, for times when you need a quick way to figure out what is going on.

Configuration

Check each module documentation topic:

Modules Providers

As we said above, we are committed to offer new AI features without compromising your privacy. See below the current providers and models for each module. CDCK handles hosting for open-source models in our infrastructure and API keys for SaaS providers like OpenAI:

Module Provider Processor
Toxicity UnitaryAI Discourse
Sentiment Emotion English DistilRoBERTa-base Discourse
Twitter-roBERTa-base for Sentiment Analysis Discourse
NSFW GantMan - nsfw Discourse
Open-NSFW 2 Discourse
Semantic Sentence Transformers Discourse
pgvector Discourse
Composer OpenAI Third party
Anthropic Third party
Summarization bart large cnn samsum Discourse
flan t5 base sansum Discourse
long t5 tglobal base 16384 book summary Discourse
OpenAI Third party
Anthropic Third party
AIBot OpenAI Third party
Anthropic Third party

:mega: Additional Discourse processor options for Composer / Summarization / AIBot are coming soon!

Disclaimer

We are being very mindful with our experimentation around AI. The algorithms we are leaning on are only as good as the data they were trained on. Bias, inaccuracies and hallucinations are all possibilities we need to allow for. We regularly revisit, test and refine our AI modules.

Self Hosting

Check the docs on self-hosting the API services at Discourse AI - Self-Hosted Guide

FAQ

Will this available on Discourse hosting? Which plans?

This is available in preview for Enterprise customers, please contact our support team to get it installed and configured on your instance.

Rollout for select modules for other tiers will follow later.

  • Update: The AI Bot module is now available for all of our hosting tiers! :partying_face:

Will CDCK offer a SaaS version of the AI services API for self-hosted communities?

Not at the moment, but this is something we may consider given the feedback from our community.

:discourse2: Hosted by us? The full plugin is available for preview on our Enterprise plan, with select modules available on other tiers. See the FAQs above for more detail.

45 Likes

LangChain for LLM Application Development - A free (for now) DeepLearning.AI course by Harrison Chase (Creator of LangChain) and Andrew Ng (DeepLearning.AI)

3 Likes

Is there a recommended way to get pgvector on RDS?

this page claims:

The pgvector extension is available on all database instances in Amazon RDS running PostgreSQL 15.2 and higher in all AWS Regions, including the AWS GovCloud (US) Regions.

But last I knew, there was some subtle problem with PG14. I think this site is running on RDS, though.

Presumably typical self-hosters won’t have this problem as the current database image has pgvector, but both of the places I wanted to try this are running other pg installs. :crying_cat_face:

3 Likes

We fixed it! Meta has been running PG15 for 3 months or so. (brace for the self-hosted pg upgrade soon)

But while AWS doesn’t tell you upfront, you also have pgvector on PG 13.11 in there :wink:

pgvector is available in AWS RDS, Aurora, Azure, GCP and Digital Ocean hosted PostgreSQL services, so I think this won’t be a problem.

2 Likes

Cool. That’s good to know. Thanks. That’ll solve one problem. The other is a self-installed postgres image that does replication. Maybe I can figure out how to use the Discourse image and get replication working with it.

Thanks.

1 Like

pgvector is on the Ubuntu/Debian official PostgreSQL PPAs, so after having that enabled it’s a simple apt install pgvector away in any server / image you have access to.

2 Likes

Sigh. Strangely the postgres:13 docker image doesn’t solve the problem with apt as suggested. It seemed like the official pg image would be a safe way to go.

1 Like

Sorry that wasn’t really strict for copy and paste, the exact command would be

apt update && apt install postgresql-${PG_MAJOR}-pgvector
1 Like

:person_facepalming:

LOL. Thanks, my postgres and its replica are now updated and I installed it! Now for bug reports.

2 Likes

Greetings, I express my gratitude for the plugin :raised_hands:
I have invariably relied on Google’s browser translator within this forum, a practice that significantly hampered my productivity due to Google’s occasional failure to comprehend the context of certain texts. In recent days, I have shifted my tendency towards the forum’s integrated artificial-intelligence translator, embodied in the message composer- a remarkable tool that has notably facilitated the drafting of my posts.
Amongst this forum’s population, it is likely that I am not the only one reliant on translator services. Thus, I would like to propose an enhancement: perhaps consider incorporating translation options for highlighted text outside the message composer. Specifically, as I traverse through the forum’s posts, I find myself translating each message via Google’s browser translator. Therefore, a commendable solution would be to introduce a “translation” button (with a dropdown list of supported languages), in addition to the existing “quote” and “share” buttons, post the highlighting of any part of the text.

2 Likes

Now if memory serves me, that’s around the time you tend to deploy it to us standard install types.

Do you have a planned roll out schedule for PG15 in mind?

3 Likes

Yes, taking into account the last few times we should be introducing that upgrade in this or the next quarter indeed. Still, we have not started the self-hosting upgrade rollout yet.

5 Likes

Are you considering sending requests to artificial intelligence via Typeform form submissions?

1 Like

如何可以支持中文呢?我用管理员发了帖子 过了一会标题自动变成了英文.
我还要每一个都修改回去.
How can I support Chinese? I used the administrator to make a post and then the title automatically changed to English.
I have to change each one back.

3 Likes

我发现有时候ai可以智能填充中文标题 更多的时候填充的是英文标题.
I’ve found that sometimes the ai can intelligently fill in Chinese headings, but more often it fills in English headings.

2 Likes

Greetings!
I, too, have posed this inquiry within this discourse

1 Like

The same applies to spanish. I found the prompts in db/fixtures folder but I don’t know how to update them.

Modifying files and uploading a forked plugin didn’t work, so ~70% of the AI job is on english :smiling_face_with_tear:

1 Like

Greetings, I apologize in advance if this message is inappropriate :pray:

I understand very well that the team working on this plugin is doing a lot of work and probably already has a roadmap for developing the functionality of the plugin. I’d like to throw in my two cents :sweat_smile:, although my vision may seem awkward :see_no_evil:

But, nevertheless, I decided to share my vision of the future functionality of the AI assistant in the post editor (composer):

Image source https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/master/screenshot.png and GitHub - AUTOMATIC1111/stable-diffusion-webui-promptgen: stable-diffusion-webui-promptgen

We have no plans whatsoever to pursue a oobabooga like UI here, and the idea is to make the UI simple and quick to use.

People needing full control of the LLM output can always use a dedicated tool for that.

4 Likes

problem

When I was in China, I wanted to change the gem mirror source. At discourse-ai of fork, I modified the gem mirror source information in Gemfile and gemfile. lock, but the log display was still downloaded from https://rubygems.org/. How to make the gem installation in discourse-ai use the gem image source modified in web.china.template.yml

Inevitable errors

sudo ./launcher rebuild app