|
@@ -32,7 +32,7 @@
|
|
"metadata": {},
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"outputs": [],
|
|
"source": [
|
|
"source": [
|
|
- "!pip install langchain youtube-transcript-api tiktoken pytube"
|
|
|
|
|
|
+ "!pip install langchain youtube-transcript-api tiktoken pytube replicate"
|
|
]
|
|
]
|
|
},
|
|
},
|
|
{
|
|
{
|
|
@@ -260,7 +260,7 @@
|
|
"2. Loop over each subsequent sub-document, pass the previous summary with the current sub-document to generate a refined new summary;\n",
|
|
"2. Loop over each subsequent sub-document, pass the previous summary with the current sub-document to generate a refined new summary;\n",
|
|
"3. Return the final summary generated on the final sub-document as the final answer - the summary of the whole content.\n",
|
|
"3. Return the final summary generated on the final sub-document as the final answer - the summary of the whole content.\n",
|
|
"\n",
|
|
"\n",
|
|
- "An example prompt template for each call in step 2 is:\n",
|
|
|
|
|
|
+ "An example prompt template for each call in step 2, which gets used under the hood by LangChain, is:\n",
|
|
"```\n",
|
|
"```\n",
|
|
"Your job is to produce a final summary.\n",
|
|
"Your job is to produce a final summary.\n",
|
|
"We have provided an existing summary up to a certain point:\n",
|
|
"We have provided an existing summary up to a certain point:\n",
|
|
@@ -279,6 +279,8 @@
|
|
"metadata": {},
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"outputs": [],
|
|
"source": [
|
|
"source": [
|
|
|
|
+ "from langchain.chains.summarize import load_summarize_chain\n",
|
|
|
|
+ "\n",
|
|
"chain = load_summarize_chain(llm, chain_type=\"refine\")\n",
|
|
"chain = load_summarize_chain(llm, chain_type=\"refine\")\n",
|
|
"chain.run(split_docs)"
|
|
"chain.run(split_docs)"
|
|
]
|
|
]
|