Discourse AI - Related topics

:bookmark: This guide explains how to enable and configure the Related topics feature of the Discourse AI plugin.

:person_raising_hand: Required user level: Administrator

Related topics helps users discover relevant content by suggesting semantically similar topics based on the one they’re currently reading. This enhances content exploration and increases user engagement.

Features

  • Semantic textual similarity: Goes beyond keyword matching to find truly related content
  • Toggle between “Suggested” and “Related” topics
  • Available for both anonymous and logged-in users

Enabling Related topics

:information_source: Related topics is turned on by default for all Discourse hosted customers with the Discourse AI plugin enabled

Prerequisites

Related topics requires Embeddings to function.

If you are on our hosting, Embeddings is provided using an open-source model. No additional setup is required.

Self-hosted instances will need to provide their own Embeddings through a third-party provider.

Configuration

  1. Go to Admin → Settings → Plugins
  2. Search for “discourse-ai” and ensure it’s enabled
  3. Enable ai_embeddings_enabled to activate Embeddings
  4. Enable ai_embeddings_semantic_related_topics_enabled to activate the Related Topics feature

Additional configuration

Depending on your setup, you may need to adjust the following settings:

  • For non-English sites (Discourse-hosted or self-hosted with own model):
    Set ai embeddings model to multilingual-e5-large
  • For Cloudflare Workers AI:
    Set ai embeddings model to bge-large-en
  • For OpenAI or Azure OpenAI:
    Set ai embeddings model to text-embedding-ada-002

Technical FAQ

Expand to view a diagram of the Related topics architecture

The overview is, that when a topic is created / updated this happens:

sequenceDiagram
    User->>Discourse: Creates topic
    Discourse-->>Embedding Microservice: Generates embeddings
    Embedding Microservice-->>Discourse: 
    Discourse-->>PostgreSQL:Store Embeddings 

And during topic visit:

sequenceDiagram
    User->>Discourse: Visits topic
    Discourse-->>PostgreSQL: Query closest topics
    PostgreSQL-->>Discourse: 
    Discourse->>User: Presents related topics 

How does Related topics work?

  • When a user visits a topic, Discourse queries the database for the most semantically similar topics based on their embedded representations. These related topics are then presented to the user, encouraging further exploration of the community’s content.

How is topic/post data processed?

  • For Discourse-hosted sites, data is processed within our secure virtual private datacenter. For self-hosted sites, data processing depends on your chosen third-party provider.

Where is the embeddings data stored?

  • Embeddings data is stored in your Discourse database, alongside other forum data like topics, posts, and users.

What semantic model is used, and how was it trained?

  • Discourse-hosted sites use the all-mpnet-base-v2 model by default. This model performs well for both niche and general communities. Self-hosted sites may use different models depending on their chosen provider.

Last edited by @Saif 2024-11-04T18:08:05Z

Last checked by @hugh 2024-08-06T04:30:59Z

Check documentPerform check on document:
10 Likes