diff options
Diffstat (limited to 'packages/shared/prompts.ts')
| -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}`; |
