FIX: Change hot gist prompt to avoid title repeating #859 (#859)

Co-authored-by: Roman Rizzi <rizziromanalejandro@gmail.com>
This commit is contained in:
Rafael dos Santos Silva 2024-10-25 12:12:33 -03:00 committed by GitHub
parent ec97996905
commit 33da27e231
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 6 deletions

View File

@ -100,25 +100,26 @@ module DiscourseAi
contents.to_a.map { |item| "(#{item[:id]} #{item[:poster]} said: #{item[:text]} " } contents.to_a.map { |item| "(#{item[:id]} #{item[:poster]} said: #{item[:text]} " }
prompt = DiscourseAi::Completions::Prompt.new(<<~TEXT.strip) prompt = DiscourseAi::Completions::Prompt.new(<<~TEXT.strip)
You are an advanced summarization bot. Analyze a given conversation and produce a concise, 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. single-sentence summary that conveys the main topic and current developments to someone with no prior context.
### Guidelines: ### Guidelines:
- Emphasize the most recent updates while considering their significance within the original post. - 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. - Focus on the central theme or issue being addressed, maintaining an objective and neutral tone.
- Exclude extraneous details or subjective opinions. - Exclude extraneous details or subjective opinions.
- Use the original language of the text. - Use the original language of the text.
- Begin directly with the main topic or issue, avoiding introductory phrases. - Begin directly with the main topic or issue, avoiding introductory phrases.
- Limit the summary to a maximum of 20 words. - Limit the summary to a maximum of 20 words.
- Return the 20-word summary inside <ai></ai> tags. - Do *NOT* repeat the discussion title in the summary.
Return the summary inside <ai></ai> tags.\n
TEXT TEXT
context = +<<~TEXT context = +<<~TEXT
### Context: ### Context:
#{content_title.present? ? "The discussion title is: " + content_title + ".\n" : ""} #{content_title.present? ? "The discussion title is: " + content_title + ". (DO NOT REPEAT THIS IN THE SUMMARY)\n" : ""}
The conversation began with the following statement: The conversation began with the following statement:
@ -130,7 +131,7 @@ module DiscourseAi
Subsequent discussion includes the following: Subsequent discussion includes the following:
#{statements.join("\n")} #{statements.join("\n")}
Your task is to focus on these latest messages, capturing their meaning in the context of the initial statement. Your task is to focus on these latest messages, capturing their meaning in the context of the initial statement.
TEXT TEXT
else else