FEATURE: Better link in Claude summaries (#183)
* FEATURE: Better link in Claude summaries * lint
This commit is contained in:
parent
e3abbd9f46
commit
3c4a53b2cb
|
@ -66,14 +66,16 @@ module DiscourseAi
|
||||||
|
|
||||||
base_prompt = <<~TEXT
|
base_prompt = <<~TEXT
|
||||||
Human: #{initial_instruction}
|
Human: #{initial_instruction}
|
||||||
Try to keep the summary in the same languague as the forum discussion.
|
Try to keep the summary in the same language as the forum discussion.
|
||||||
Format the response, including links, using markdown.
|
Format the response, including links, using markdown.
|
||||||
Include only the summary inside <ai> tags.
|
|
||||||
TEXT
|
TEXT
|
||||||
|
|
||||||
if opts[:resource_path]
|
base_prompt += <<~TEXT if opts[:resource_path]
|
||||||
base_prompt += "Try generating links as well the format is #{opts[:resource_path]}.\n"
|
Try generating links as well the format is #{opts[:resource_path]}/POST_ID
|
||||||
end
|
For example, a link to the 3rd post in the topic would be [post 3](#{opts[:resource_path]}/3)
|
||||||
|
TEXT
|
||||||
|
|
||||||
|
base_prompt += "Wrap the whole the summary inside <ai> tags.\n"
|
||||||
|
|
||||||
base_prompt += "The discussion title is: #{opts[:content_title]}.\n" if opts[
|
base_prompt += "The discussion title is: #{opts[:content_title]}.\n" if opts[
|
||||||
:content_title
|
:content_title
|
||||||
|
|
|
@ -10,7 +10,7 @@ RSpec.describe DiscourseAi::Summarization::Models::Anthropic do
|
||||||
|
|
||||||
let(:content) do
|
let(:content) do
|
||||||
{
|
{
|
||||||
resource_path: "/t/1/POST_NUMBER",
|
resource_path: "/t/-/1",
|
||||||
content_title: "This is a title",
|
content_title: "This is a title",
|
||||||
contents: [{ poster: "asd", id: 1, text: "This is a text" }],
|
contents: [{ poster: "asd", id: 1, text: "This is a text" }],
|
||||||
}
|
}
|
||||||
|
@ -23,10 +23,11 @@ RSpec.describe DiscourseAi::Summarization::Models::Anthropic do
|
||||||
def expected_messages(contents, opts)
|
def expected_messages(contents, opts)
|
||||||
base_prompt = <<~TEXT
|
base_prompt = <<~TEXT
|
||||||
Human: Summarize the following forum discussion inside the given <input> tag.
|
Human: Summarize the following forum discussion inside the given <input> tag.
|
||||||
Try to keep the summary in the same languague as the forum discussion.
|
Try to keep the summary in the same language as the forum discussion.
|
||||||
Format the response, including links, using markdown.
|
Format the response, including links, using markdown.
|
||||||
Include only the summary inside <ai> tags.
|
Try generating links as well the format is #{opts[:resource_path]}/POST_ID
|
||||||
Try generating links as well the format is #{opts[:resource_path]}.
|
For example, a link to the 3rd post in the topic would be [post 3](#{opts[:resource_path]}/3)
|
||||||
|
Wrap the whole the summary inside <ai> tags.
|
||||||
The discussion title is: #{opts[:content_title]}.
|
The discussion title is: #{opts[:content_title]}.
|
||||||
Don't use more than 400 words.
|
Don't use more than 400 words.
|
||||||
TEXT
|
TEXT
|
||||||
|
@ -104,10 +105,11 @@ RSpec.describe DiscourseAi::Summarization::Models::Anthropic do
|
||||||
|
|
||||||
instructions = <<~TEXT
|
instructions = <<~TEXT
|
||||||
Human: Summarize the following forum discussion inside the given <input> tag.
|
Human: Summarize the following forum discussion inside the given <input> tag.
|
||||||
Try to keep the summary in the same languague as the forum discussion.
|
Try to keep the summary in the same language as the forum discussion.
|
||||||
Format the response, including links, using markdown.
|
Format the response, including links, using markdown.
|
||||||
Include only the summary inside <ai> tags.
|
Try generating links as well the format is #{opts[:resource_path]}/POST_ID
|
||||||
Try generating links as well the format is #{opts[:resource_path]}.
|
For example, a link to the 3rd post in the topic would be [post 3](#{opts[:resource_path]}/3)
|
||||||
|
Wrap the whole the summary inside <ai> tags.
|
||||||
The discussion title is: #{opts[:content_title]}.
|
The discussion title is: #{opts[:content_title]}.
|
||||||
Don't use more than 400 words.
|
Don't use more than 400 words.
|
||||||
<input>(1 asd said: This is a</input>
|
<input>(1 asd said: This is a</input>
|
||||||
|
|
Loading…
Reference in New Issue