Skip to content

The agent engineering platform.

docs: add itemgetter in how_to/dynamic_chain (#23951)

jongwony14dd89a1ee28
diff --git a/docs/docs/how_to/dynamic_chain.ipynb b/docs/docs/how_to/dynamic_chain.ipynb
index 2f8c26efd2..53790472a4 100644
--- a/docs/docs/how_to/dynamic_chain.ipynb
+++ b/docs/docs/how_to/dynamic_chain.ipynb
@@ -58,6 +58,8 @@
}
],
"source": [
+ "from operator import itemgetter\n",
+ "\n",
"from langchain_core.output_parsers import StrOutputParser\n",
"from langchain_core.prompts import ChatPromptTemplate\n",
"from langchain_core.runnables import Runnable, RunnablePassthrough, chain\n",
@@ -86,7 +88,7 @@
" # NOTE: This is returning another Runnable, not an actual output.\n",
" return contextualize_question\n",
" else:\n",
- " return RunnablePassthrough()\n",
+ " return RunnablePassthrough() | itemgetter(\"question\")\n",
"\n",
"\n",
"@chain\n",