diff options
Diffstat (limited to 'packages/shared/prompts.ts')
| -rw-r--r-- | packages/shared/prompts.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/shared/prompts.ts b/packages/shared/prompts.ts index 91bfba3f..d741030a 100644 --- a/packages/shared/prompts.ts +++ b/packages/shared/prompts.ts @@ -50,3 +50,17 @@ You must respond in JSON with the key "tags" and the value is an array of string const truncatedContent = truncateContent(content, contextLength - promptSize); return constructPrompt(truncatedContent); } + +export function buildSummaryPrompt( + lang: string, + content: string, + contextLength: number, +) { + const constructPrompt = (c: string) => ` + Summarize the following content in a 3-4 sentences in ${lang}: + ${c}`; + + const promptSize = calculateNumTokens(constructPrompt("")); + const truncatedContent = truncateContent(content, contextLength - promptSize); + return constructPrompt(truncatedContent); +} |
