From 693ee2b63e65dc7dae5ab34ef41f5e9b8505a24e Mon Sep 17 00:00:00 2001 From: Abhishek Maharjan Date: Fri, 12 May 2023 22:11:27 +0200 Subject: [PATCH] feat: add summarization prompts (#9) --- .../src/pages/Content/prompts.ts | 4 +++ .../src/core/{question.ts => general.ts} | 30 +++++++++++++++++++ libs/llm-prompt-templates/src/core/index.ts | 2 +- .../src/core/tags.enum.ts | 1 + 4 files changed, 36 insertions(+), 1 deletion(-) rename libs/llm-prompt-templates/src/core/{question.ts => general.ts} (82%) diff --git a/apps/chrome-extension/src/pages/Content/prompts.ts b/apps/chrome-extension/src/pages/Content/prompts.ts index 7f887ec..c9cafa8 100644 --- a/apps/chrome-extension/src/pages/Content/prompts.ts +++ b/apps/chrome-extension/src/pages/Content/prompts.ts @@ -1,4 +1,5 @@ import { + BasicSummarizationPrompt, CodeErrorHelpPrompt, GeneralKnowledgePrompt, IPrompt, @@ -8,6 +9,7 @@ import { QuestionWithContextPrompt, QuestionWithReasoningPrompt, SQLQueryPrompt, + SummarizationIntoListPrompt, WriteTestsPrompt, ZeroShotCoTAPEPrompt, ZeroShotCoTPrompt, @@ -30,6 +32,8 @@ const generalPrompts: IPrompt[] = [ QuestionWithContextPrompt, ZeroShotCoTPrompt, ZeroShotCoTAPEPrompt, + BasicSummarizationPrompt, + SummarizationIntoListPrompt, GeneralKnowledgePrompt, ]; diff --git a/libs/llm-prompt-templates/src/core/question.ts b/libs/llm-prompt-templates/src/core/general.ts similarity index 82% rename from libs/llm-prompt-templates/src/core/question.ts rename to libs/llm-prompt-templates/src/core/general.ts index bc8f5e9..093e3f4 100644 --- a/libs/llm-prompt-templates/src/core/question.ts +++ b/libs/llm-prompt-templates/src/core/general.ts @@ -53,6 +53,36 @@ export const ZeroShotCoTAPEPrompt: IPrompt = { Let's work this out in a step by step way to be sure we have the right answer.`, }; +export const BasicSummarizationPrompt: IPrompt = { + name: 'Basic Summarization', + description: `This prompt asks the LLM to summarize a given text.`, + tags: [Tag.Summarization], + category: PromptCategory.General, + content: `Write a concise summary of the following text delimited by triple backquotes. +Please provide your output in a manner that a 5 year old would understand. + +\`\`\` +{text} +\`\`\` + +SUMMARY:`, +}; + +export const SummarizationIntoListPrompt: IPrompt = { + name: 'Summarization Into List', + description: `This prompt asks the LLM to summarize a given text into a list of bullet points.`, + tags: [Tag.Summarization], + category: PromptCategory.General, + content: `Write a concise summary of the following text delimited by triple backquotes. +Return your response in bullet points which covers the key points of the text. + +\`\`\` +{text} +\`\`\` + +BULLET POINT SUMMARY:`, +}; + // https://arxiv.org/abs/2110.08387 export const GeneralKnowledgePrompt: IPrompt = { name: 'General Knowledge', diff --git a/libs/llm-prompt-templates/src/core/index.ts b/libs/llm-prompt-templates/src/core/index.ts index 1576de1..2d867ed 100644 --- a/libs/llm-prompt-templates/src/core/index.ts +++ b/libs/llm-prompt-templates/src/core/index.ts @@ -1,6 +1,6 @@ export * from './categories.enum'; export * from './code'; +export * from './general'; export * from './interfaces'; export * from './pal'; -export * from './question'; export * from './tags.enum'; diff --git a/libs/llm-prompt-templates/src/core/tags.enum.ts b/libs/llm-prompt-templates/src/core/tags.enum.ts index 32adbbc..48620d2 100644 --- a/libs/llm-prompt-templates/src/core/tags.enum.ts +++ b/libs/llm-prompt-templates/src/core/tags.enum.ts @@ -11,4 +11,5 @@ export enum Tag { Error = 'error', Debugging = 'debugging', SQL = 'sql', + Summarization = 'summarization', }