Skip to content

Commit

Permalink
docs: Removed unwanted cell in refine segment (langchain-ai#22604)
Browse files Browse the repository at this point in the history
**Description:**
There is one unwanted duplicate cell in refine section of summarization
documentation, i have removed it.
  • Loading branch information
Kirushikesh authored Jun 6, 2024
1 parent 8b40428 commit db7e7b6
Showing 1 changed file with 0 additions and 45 deletions.
45 changes: 0 additions & 45 deletions docs/docs/tutorials/summarization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -558,51 +558,6 @@
"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",
"execution_count": 14,
Expand Down

0 comments on commit db7e7b6

Please sign in to comment.