diff options
| author | Olicorne <26625900+thiswillbeyourgithub@users.noreply.github.com> | 2025-06-22 16:38:19 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-22 15:38:19 +0100 |
| commit | a74afc9d1a23678b959d4d8b00ee6125b4f31c60 (patch) | |
| tree | 66920e3a67ae51e09ba20867167def0420c7832e | |
| parent | e310ba9f3e3560290d06b085fa5d5e0297045648 (diff) | |
| download | karakeep-a74afc9d1a23678b959d4d8b00ee6125b4f31c60.tar.zst | |
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 <me@mbassem.com>
| -rw-r--r-- | packages/shared/prompts.ts | 21 |
1 files 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 + +<TEXT_CONTENT> ${c} -CONTENT END HERE +</TEXT_CONTENT> 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}`; |
