Skip to content

FEATURE: add inferred concepts system #1330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

FEATURE: add inferred concepts system #1330

wants to merge 11 commits into from

Conversation

xfalcox
Copy link
Member

@xfalcox xfalcox commented May 8, 2025

This commit adds a new inferred concepts system that:

  • Creates a model for storing concept labels that can be applied to topics
  • Provides AI personas for finding new concepts and matching existing ones
  • Adds jobs for generating concepts from popular topics
  • Includes a scheduled job that automatically processes engaging topics

xfalcox added 11 commits May 16, 2025 15:22
This commit adds a new inferred concepts system that:
- Creates a model for storing concept labels that can be applied to topics
- Provides AI personas for finding new concepts and matching existing ones
- Adds jobs for generating concepts from popular topics
- Includes a scheduled job that automatically processes engaging topics
* Adds support for concepts to be inferred from and applied to posts
* Replaces daily task with one that handles both topics and posts
* Adds database migration for posts_inferred_concepts join table
* Updates PersonaContext to include inferred concepts
@xfalcox xfalcox force-pushed the inferred-concepts branch from 6c51329 to 74d47a9 Compare May 16, 2025 18:43
Copy link
Member

@romanrizzi romanrizzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good. It'd be great to add some tests

],
"deny": []
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this?

# frozen_string_literal: true
class CreateInferredConceptsTable < ActiveRecord::Migration[7.2]
def change
create_table :inferred_concepts do |t|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not using polymorphic association here instead of two more tables?


module DiscourseAi
module InferredConcepts
class Finder
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Methods from this class that need a persona could be instance methods, and the persona could be passed in an initializer. DI makes it easier to test.


module DiscourseAi
module InferredConcepts
class Applier
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Methods from this class that need a persona could be instance methods, and the persona could be passed in an initializer. DI makes it easier to test.

end

def response_format
[{ "key" => "matching_concepts", "type" => "array" }]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add array as an option in the persona's form

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants