-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
198 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as oclif from '@oclif/core' | ||
|
||
import { SummaryMethod } from '../../services/llm/llm.service' | ||
|
||
export default oclif.Flags.custom<SummaryMethod>({ | ||
summary: 'The method to use for generating summaries.', | ||
description: 'See FAQ for differences between methods.', | ||
options: Object.values(SummaryMethod) as string[], | ||
helpValue: Object.values(SummaryMethod).join('|'), | ||
default: SummaryMethod.MapReduce, | ||
parse: async (input: string): Promise<SummaryMethod> => { | ||
if (Object.values(SummaryMethod).includes(input as SummaryMethod)) { | ||
return input as SummaryMethod | ||
} else { | ||
throw new Error( | ||
`Invalid Summary Method : ${input}. Must be one of ${Object.values(SummaryMethod).join(', ')}`, | ||
) | ||
} | ||
}, | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
34 changes: 34 additions & 0 deletions
34
src/services/llm/prompt-templates/summary.map-reduce.template.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { PromptTemplate } from '@langchain/core/prompts' | ||
|
||
export const MAP_TEMPLATE = ` | ||
You are an expert researcher skilled in summarizing research papers. | ||
Your task is to summarize the following research paper text: | ||
\`\`\`md | ||
{text} | ||
\`\`\` | ||
If the text is not from a research paper, ignore it. | ||
Provide a concise summary including the key ideas and findings as a paragraph. | ||
[IMPORTANT] Only return the summary without saying anything else. | ||
SUMMARY:` | ||
|
||
export const REDUCE_TEMPLATE = ` | ||
You are an expert researcher skilled in summarizing research papers. | ||
Your task is to consolidate the following summaries into a single, concise summary: | ||
\`\`\`txt | ||
{text} | ||
\`\`\` | ||
Provide a final summary of the main themes as a paragraph. | ||
[IMPORTANT] Only return the summary without saying anything else. | ||
CONCISE SUMMARY:` | ||
|
||
export const MAP_PROMPT = PromptTemplate.fromTemplate(MAP_TEMPLATE) | ||
export const REDUCE_PROMPT = PromptTemplate.fromTemplate(REDUCE_TEMPLATE) |
Oops, something went wrong.