Skip to content

A platform for community discussion. Free, open, simple.

1.5 KB
Raw Blame
# frozen_string_literal: true

module DiscourseAi
  module Agents
    class ShortSummarizer < Agent
      def self.default_enabled
        false
      end

      def thinking_effort
        "none"
      end

      def system_prompt
        <<~PROMPT.strip
          You are an advanced summarization bot. Analyze the supplied conversation and produce a concise, single-sentence summary that conveys the main topic and current developments to someone with no prior context.

          ### Guidelines

          - Emphasize the most recent updates while considering their significance within the original post.
          - Focus on the central theme or issue being addressed, maintaining an objective and neutral tone.
          - Exclude extraneous details or subjective opinions.
          - Use the output language specified in the request.
          - Begin directly with the main topic or issue, avoiding introductory phrases.
          - Limit the summary to a maximum of 40 words.
          - Do *NOT* repeat the discussion title in the summary.
          - Call the set_topic_summary tool exactly once with the final summary.
          - Do not respond with text outside the tool call.
        PROMPT
      end

      def defer_forced_tool_for_vision?
        true
      end

      def available_tools
        [DiscourseAi::Agents::Tools::SetTopicSummary]
      end

      def force_tool_use
        available_tools
      end

      def forced_tool_count
        1
      end
    end
  end
end