mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-09 04:50:37 +00:00
docs: Removed unwanted cell in refine segment (#22604)
**Description:** There is one unwanted duplicate cell in refine section of summarization documentation, i have removed it.
This commit is contained in:
parent
8b40428f58
commit
db7e7b69e3
@ -558,51 +558,6 @@
|
|||||||
"It's also possible to supply a prompt and return intermediate steps."
|
"It's also possible to supply a prompt and return intermediate steps."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": 22,
|
|
||||||
"id": "cc931bde-8258-4d10-8479-f2d2d69f49f4",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "stderr",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"/Users/chestercurme/repos/langchain/libs/core/langchain_core/_api/deprecation.py:119: LangChainDeprecationWarning: The method `Chain.__call__` was deprecated in langchain 0.1.0 and will be removed in 0.2.0. Use invoke instead.\n",
|
|
||||||
" warn_deprecated(\n"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
|
||||||
"prompt_template = \"\"\"Write a concise summary of the following:\n",
|
|
||||||
"{text}\n",
|
|
||||||
"CONCISE SUMMARY:\"\"\"\n",
|
|
||||||
"prompt = PromptTemplate.from_template(prompt_template)\n",
|
|
||||||
"\n",
|
|
||||||
"refine_template = (\n",
|
|
||||||
" \"Your job is to produce a final summary\\n\"\n",
|
|
||||||
" \"We have provided an existing summary up to a certain point: {existing_answer}\\n\"\n",
|
|
||||||
" \"We have the opportunity to refine the existing summary\"\n",
|
|
||||||
" \"(only if needed) with some more context below.\\n\"\n",
|
|
||||||
" \"------------\\n\"\n",
|
|
||||||
" \"{text}\\n\"\n",
|
|
||||||
" \"------------\\n\"\n",
|
|
||||||
" \"Given the new context, refine the original summary in Italian\"\n",
|
|
||||||
" \"If the context isn't useful, return the original summary.\"\n",
|
|
||||||
")\n",
|
|
||||||
"refine_prompt = PromptTemplate.from_template(refine_template)\n",
|
|
||||||
"chain = load_summarize_chain(\n",
|
|
||||||
" llm=llm,\n",
|
|
||||||
" chain_type=\"refine\",\n",
|
|
||||||
" question_prompt=prompt,\n",
|
|
||||||
" refine_prompt=refine_prompt,\n",
|
|
||||||
" return_intermediate_steps=True,\n",
|
|
||||||
" input_key=\"input_documents\",\n",
|
|
||||||
" output_key=\"output_text\",\n",
|
|
||||||
")\n",
|
|
||||||
"result = chain({\"input_documents\": split_docs}, return_only_outputs=True)"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 14,
|
"execution_count": 14,
|
||||||
|
Loading…
Reference in New Issue
Block a user