BoredLabsHQ / Concord

Concord is an open-source AI plugin designed to connect community members to relevant conversations
GNU General Public License v3.0
2 stars 3 forks source link

[AI] Define Topic Score Update Logic #31

Open sajz opened 2 weeks ago

sajz commented 2 weeks ago

Topic Analysis and Score Updates Logic:

  1. Identify Relevant Topics:

    • When a new message is posted, analyze its semantic content using SemanticVector.
    • Match the message’s semantic content with existing topics in the channel’s ASSOCIATED_WITH relationships by comparing keywords and the semantic_vector.
  2. Amplify Scores for Matching Topics:

    • For each existing topic in the channel that appears in the message:
      • Apply the amplify_score function to calculate a small score_delta, increasing the topic’s overall_score based on relevance or semantic similarity.
      • Update message_count and refresh the last_updated timestamp.
  3. Create New Topics:

    • For topics in the message that don’t already exist in the channel:
      • Create a new Topic node if it doesn’t exist, or establish an ASSOCIATED_WITH relationship to the channel.
      • Initialize fields like overall_score, message_count, and last_updated to begin tracking the topic’s relevance in this channel.
  4. Diminish Scores for Unmentioned Topics:

    • For all existing topics that aren’t referenced in the message:
      • Use the diminish_score function to apply a gradual score_delta reduction, decreasing the overall_score based on the score_decay_rate.
      • This decay reflects the gradual fading relevance of less active topics in the channel.

Suggested Function Names:

  1. Amplify Function (amplify_score):

    • amplify_score: This function calculates a small positive score_delta to incrementally increase the overall_score based on semantic similarity, with gradual progression towards a maximum limit.
  2. Diminish Function (diminish_score):

    • diminish_score: This function calculates a small negative score_delta to gradually decrease the overall_score, applying a decay that starts slowly and accelerates toward zero for topics not mentioned over time.

-- Example

Topic Initial Score New Message Weight Updated Score Score Delta
topic_0 0.5 0.6 0.505 +0.005
topic_1 0.5 0.2 0.485 -0.015
topic_2 0.5 0.45 0.4975 -0.0025

The updated table includes the Score Delta for each topic, showing how much the overall_score changed based on the new message weights:

Adjusted score_delta Function for Topic overall_score Updates

Objective: Enhance the calculation of score_delta for updating the overall_score of topics in a channel, ensuring incremental changes are context-sensitive based on the initial score. This adjustment will use a non-linear function that:

Rationale:

Function Design: Use a modified logistic function to calculate score_delta, allowing gradual increases that slow at the boundaries (near 0 and 1):

Topic Initial Score New Message Weight Score Delta Updated Score
topic_0 0.2 0.6 +0.000949 0.200949
topic_1 0.7 0.2 -0.022020 0.677980
topic_2 0.5 0.45 -0.001250 0.498750