discourse/plugins/discourse-ai
Rafael dos Santos Silva 281d0c3e11
FEATURE: add configurable age penalty for semantic related topics (#34842)
Introduces two new site settings to apply exponential age-based
penalties to semantic topic suggestions, similar to algorithms
used by Reddit/HN:

* ai_embeddings_semantic_related_age_penalty (default: 0.3)
  Controls penalty strength. 0.0 = disabled, 0.3 = gentle bias
  toward newer content, 1.0+ = strong recency preference

* ai_embeddings_semantic_related_age_time_scale (default: 365 days)
  Controls time horizon. Use 365 for yearly scale, 90 for
  quarterly scale, etc.

Formula: similarity_score / POWER(age_in_days / time_scale + 1, penalty)

This allows sites to de-prioritize older topics in suggestions
while maintaining configurability for forums with different
content lifecycles. Performance optimized with conditional
JOINs only when penalty > 0.


"Age" here is using bumped_at to work with communities with long
lived mega topics too.

---------

Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
2025-09-18 10:24:19 -03:00
..
admin/assets/javascripts/discourse FEATURE: Translation progress admin UI (#34239) 2025-08-15 12:19:35 -07:00
app FIX: LLM config must be valid before running a test (#34806) 2025-09-15 11:40:01 -03:00
assets FIX: AI usage doesn't refresh custom date ranges correctly (#34816) 2025-09-16 10:16:01 -07:00
config FEATURE: add configurable age penalty for semantic related topics (#34842) 2025-09-18 10:24:19 -03:00
db FIX: Truncate seeded persona's names to fit name length constraint (#34393) 2025-08-18 18:08:43 -03:00
discourse_automation FEATURE: Add option to flag + delete for llm triage (#34590) 2025-09-02 09:16:30 +10:00
evals DEV: Move discourse-ai to core (#33749) 2025-07-22 15:07:59 +02:00
lib FEATURE: add configurable age penalty for semantic related topics (#34842) 2025-09-18 10:24:19 -03:00
public/ai-share DEV: Move discourse-ai to core (#33749) 2025-07-22 15:07:59 +02:00
spec FEATURE: add configurable age penalty for semantic related topics (#34842) 2025-09-18 10:24:19 -03:00
svg-icons DEV: Move discourse-ai to core (#33749) 2025-07-22 15:07:59 +02:00
test/javascripts DEV: Fix various lint issues (#33811) 2025-07-24 15:27:04 +02:00
.prettierignore DEV: Move discourse-ai to core (#33749) 2025-07-22 15:07:59 +02:00
about.json DEV: Move discourse-ai to core (#33749) 2025-07-22 15:07:59 +02:00
plugin.rb FEATURE: create AI tagging automation (#34587) 2025-08-28 13:13:27 -04:00
README.md DEV: Move discourse-ai to core (#33749) 2025-07-22 15:07:59 +02:00

Discourse AI Plugin

Plugin Summary

For more information, please see: https://meta.discourse.org/t/discourse-ai/259214?u=falco

Evals

The directory evals contains AI evals for the Discourse AI plugin. You may create a local config by copying config/eval-llms.yml to config/eval-llms.local.yml and modifying the values.

To run them use:

cd evals ./run --help

Usage: evals/run [options]
    -e, --eval NAME                  Name of the evaluation to run
        --list-models                List models
    -m, --model NAME                 Model to evaluate (will eval all models if not specified)
    -l, --list                       List evals

To run evals you will need to configure API keys in your environment:

OPENAI_API_KEY=your_openai_api_key ANTHROPIC_API_KEY=your_anthropic_api_key GEMINI_API_KEY=your_gemini_api_key