added initial version for summarize chains

harrison/add-usage-readmes
davidtsong 1 year ago
parent 1eacc74221
commit 1e0a70b03e

@ -0,0 +1,9 @@
# Summarize
This is a type of chain to distill large amounts of information into a small amount.
There are three types of summarize chains:
1. Stuff: This is a simple chain to stuff all the text from each document into one propmt. This is limited by token window so this approach only works for smaller amounts of data.
2. Map Reduce: This maps a summarize prompt onto each data chunk and then combines all the outputs to finally reduce using a summarization prompt.
3. Refine: This iteratively passes in each chunk of data and update a continously update an evolving summary to be more accurate based on the new chunk of data given.
## Usage

@ -0,0 +1,2 @@
# Map Reduce
This maps a summarize prompt onto each data chunk and then combines all the outputs to finally reduce using a summarization prompt.

@ -0,0 +1,10 @@
input_variables: [text]
output_parser: null
template: 'Write a concise summary of the following:
{text}
CONCISE SUMMARY:'
template_format: f-string

@ -0,0 +1,2 @@
# Refine
This iteratively passes in each chunk of data and update a continously update an evolving summary to be more accurate based on the new chunk of data given.

@ -0,0 +1,13 @@
# Prompt config for a chain?
input_variables: ['text']
output_parser: null
# what primitives do we allow?
template: [
map:
input: 'text'
prompt: 'prompt.yaml',
reduce:
prompt: 'promptSummarize.yaml'
]
template_format: f-string

@ -0,0 +1,13 @@
input_variables: [existing_answer, text]
output_parser: null
template: '
Your job is to produce a final summary\n
We have provided an existing summary up to a certain point: {existing_answer}\n
We have the opportunity to refine the existing summary
(only if needed) with some more context below.\n
------------\n
{text}\n
------------\n
Given the new context, refine the original summary
If the context isn't useful, return the original summary.'
template_format: f-string

@ -0,0 +1,10 @@
input_variables: [text]
output_parser: null
template: 'Write a concise summary of the following:
{text}
CONCISE SUMMARY:'
template_format: f-string

@ -0,0 +1,2 @@
# Stuff
This is a simple chain to stuff all the text from each document into one propmt. This is limited by token window so this approach only works for smaller amounts of data.

@ -0,0 +1,10 @@
input_variables: [text]
output_parser: null
template: 'Write a concise summary of the following:
{text}
CONCISE SUMMARY:'
template_format: f-string
Loading…
Cancel
Save