41 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Ruby
		
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Ruby
		
	
	
	
| # frozen_string_literal: true
 | |
| 
 | |
| module DiscourseAi
 | |
|   module Personas
 | |
|     class ShortSummarizer < Persona
 | |
|       def self.default_enabled
 | |
|         false
 | |
|       end
 | |
| 
 | |
|       def system_prompt
 | |
|         <<~PROMPT.strip
 | |
|           You are an advanced summarization bot. Analyze a given 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 original language of the text.
 | |
|           - 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.
 | |
| 
 | |
|           Format your response as a JSON object with a single key named "summary", which has the summary as the value.
 | |
|           Your output should be in the following format:
 | |
|             <output>
 | |
|               {"summary": "xx"}
 | |
|             </output>
 | |
| 
 | |
|           Where "xx" is replaced by the summary.
 | |
|         PROMPT
 | |
|       end
 | |
| 
 | |
|       def response_format
 | |
|         [{ "key" => "summary", "type" => "string" }]
 | |
|       end
 | |
|     end
 | |
|   end
 | |
| end
 |