From a74afc9d1a23678b959d4d8b00ee6125b4f31c60 Mon Sep 17 00:00:00 2001 From: Olicorne <26625900+thiswillbeyourgithub@users.noreply.github.com> Date: Sun, 22 Jun 2025 16:38:19 +0200 Subject: fix: minor changes to the tagging prompts (#1474) * feat: add optional `thinking` key to tagging response schema * prompt: fix indent * prompt: remove extra 'language' word * prompt: use xml as separator * revert: dont use a thinking tags Signed-off-by: thiswillbeyourgithub <26625900+thiswillbeyourgithub@users.noreply.github.com> * prompt: don't ask to include website tags * prompt: aim for 5 tags * prompt: dont tell bot its a bot * prompt: propose a tag_error * Revert "prompt: propose a tag_error" This reverts commit 78c5099a187960cc3697b77f2b2bd687edb015f3. * minor prompt tweaks * minor prompt tweaks take 2 --------- Signed-off-by: thiswillbeyourgithub Co-authored-by: Mohamed Bassem --- packages/shared/prompts.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/shared/prompts.ts b/packages/shared/prompts.ts index 7ee6f12a..6928ec3e 100644 --- a/packages/shared/prompts.ts +++ b/packages/shared/prompts.ts @@ -21,10 +21,10 @@ function truncateContent(content: string, length: number) { export function buildImagePrompt(lang: string, customPrompts: string[]) { return ` -You are a bot in a read-it-later app and your responsibility is to help with automatic tagging. +You are an expert who's responsibility is to help with automatic text tagging for a read-it-later app. Please analyze the attached image and suggest relevant tags that describe its key themes, topics, and main ideas. The rules are: - Aim for a variety of tags, including broad categories, specific keywords, and potential sub-genres. -- The tags language must be in ${lang}. +- The tags must be in ${lang}. - If the tag is not generic enough, don't include it. - Aim for 10-15 tags. - If there are no good tags, don't emit any. @@ -40,18 +40,19 @@ export function buildTextPrompt( ) { content = preprocessContent(content); const constructPrompt = (c: string) => ` -You are a bot in a read-it-later app and your responsibility is to help with automatic tagging. -Please analyze the text between the sentences "CONTENT START HERE" and "CONTENT END HERE" and suggest relevant tags that describe its key themes, topics, and main ideas. The rules are: +You are an expert who's your responsibility is to help with automatic tagging for a read-it-later app. +Please analyze the TEXT_CONTENT below and suggest relevant tags that describe its key themes, topics, and main ideas. The rules are: - Aim for a variety of tags, including broad categories, specific keywords, and potential sub-genres. -- The tags language must be in ${lang}. -- If it's a famous website you may also include a tag for the website. If the tag is not generic enough, don't include it. +- The tags must be in ${lang}. +- If the tag is not generic enough, don't include it. - The content can include text for cookie consent and privacy policy, ignore those while tagging. - Aim for 3-5 tags. - If there are no good tags, leave the array empty. ${customPrompts && customPrompts.map((p) => `- ${p}`).join("\n")} -CONTENT START HERE + + ${c} -CONTENT END HERE + You must respond in JSON with the key "tags" and the value is an array of string tags.`; const promptSize = calculateNumTokens(constructPrompt("")); @@ -67,9 +68,9 @@ export function buildSummaryPrompt( ) { content = preprocessContent(content); const constructPrompt = (c: string) => ` - Summarize the following content responding ONLY with the summary. You MUST follow the following rules: +Summarize the following content responding ONLY with the summary. You MUST follow the following rules: - Summary must be in 3-4 sentences. -- The summary language must be in ${lang}. +- The summary must be in ${lang}. ${customPrompts && customPrompts.map((p) => `- ${p}`).join("\n")} ${c}`; -- cgit v1.2.3-70-g09d2