The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
fix-lcel-notebooks (#11111)
Harrison Chase6b4928ad96a9
diff --git a/docs/extras/expression_language/how_to/fallbacks.ipynb b/docs/extras/expression_language/how_to/fallbacks.ipynbindex 674676b350..cffc08c740 100644--- a/docs/extras/expression_language/how_to/fallbacks.ipynb+++ b/docs/extras/expression_language/how_to/fallbacks.ipynb@@ -277,7 +277,7 @@"name": "python","nbconvert_exporter": "python","pygments_lexer": "ipython3",- "version": "3.9.1"+ "version": "3.10.1"}},"nbformat": 4,diff --git a/docs/extras/expression_language/how_to/functions.ipynb b/docs/extras/expression_language/how_to/functions.ipynbindex fc2f0a2962..896367926b 100644--- a/docs/extras/expression_language/how_to/functions.ipynb+++ b/docs/extras/expression_language/how_to/functions.ipynb@@ -14,12 +14,15 @@},{"cell_type": "code",- "execution_count": 77,+ "execution_count": 4,"id": "6bb221b3","metadata": {},"outputs": [],"source": ["from langchain.schema.runnable import RunnableLambda\n",+ "from langchain.prompts import ChatPromptTemplate\n",+ "from langchain.chat_models import ChatOpenAI\n",+ "from operator import itemgetter\n","\n","def length_function(text):\n"," return len(text)\n",@@ -31,6 +34,7 @@" return _multiple_length_function(_dict[\"text1\"], _dict[\"text2\"])\n","\n","prompt = ChatPromptTemplate.from_template(\"what is {a} + {b}\")\n",+ "model = ChatOpenAI()\n","\n","chain1 = prompt | model\n","\n",@@ -42,7 +46,7 @@},{"cell_type": "code",- "execution_count": 78,+ "execution_count": 5,"id": "5488ec85","metadata": {},"outputs": [@@ -52,7 +56,7 @@"AIMessage(content='3 + 9 equals 12.', additional_kwargs={}, example=False)"]},- "execution_count": 78,+ "execution_count": 5,"metadata": {},"output_type": "execute_result"}@@ -73,17 +77,18 @@},{"cell_type": "code",- "execution_count": 139,+ "execution_count": 9,"id": "80b3b5f6-5d58-44b9-807e-cce9a46bf49f","metadata": {},"outputs": [],"source": [- "from langchain.schema.runnable import RunnableConfig"+ "from langchain.schema.runnable import RunnableConfig\n",+ "from langchain.schema.output_parser import StrOutputParser"]},{"cell_type": "code",- "execution_count": 149,+ "execution_count": 10,"id": "ff0daf0c-49dd-4d21-9772-e5fa133c5f36","metadata": {},"outputs": [],@@ -109,7 +114,7 @@},{"cell_type": "code",- "execution_count": 152,+ "execution_count": 12,"id": "1a5e709e-9d75-48c7-bb9c-503251990505","metadata": {},"outputs": [@@ -132,6 +137,14 @@" RunnableLambda(parse_or_fix).invoke(\"{foo: bar}\", {\"tags\": [\"my-tag\"], \"callbacks\": [cb]})\n"," print(cb)"]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "id": "29f55c38",+ "metadata": {},+ "outputs": [],+ "source": []}],"metadata": {@@ -150,7 +163,7 @@"name": "python","nbconvert_exporter": "python","pygments_lexer": "ipython3",- "version": "3.9.1"+ "version": "3.10.1"}},"nbformat": 4,diff --git a/docs/extras/expression_language/how_to/map.ipynb b/docs/extras/expression_language/how_to/map.ipynbindex 74bfe3bd12..0d04ad25d0 100644--- a/docs/extras/expression_language/how_to/map.ipynb+++ b/docs/extras/expression_language/how_to/map.ipynb@@ -12,18 +12,18 @@},{"cell_type": "code",- "execution_count": 5,+ "execution_count": 2,"id": "7e1873d6-d4b6-43ac-96a1-edcf178201e0","metadata": {},"outputs": [{"data": {"text/plain": [- "{'joke': AIMessage(content=\"Why don't bears wear shoes? \\nBecause they have bear feet!\", additional_kwargs={}, example=False),\n",- " 'poem': AIMessage(content=\"In twilight's embrace, a bear's gentle lumber,\\nSilent strength, nature's awe, a humble slumber.\", additional_kwargs={}, example=False)}"+ "{'joke': AIMessage(content=\"Why don't bears wear shoes? \\n\\nBecause they have bear feet!\", additional_kwargs={}, example=False),\n",+ " 'poem': AIMessage(content=\"In woodland depths, bear prowls with might,\\nSilent strength, nature's sovereign, day and night.\", additional_kwargs={}, example=False)}"]},- "execution_count": 5,+ "execution_count": 2,"metadata": {},"output_type": "execute_result"}@@ -38,7 +38,7 @@"joke_chain = ChatPromptTemplate.from_template(\"tell me a joke about {topic}\") | model\n","poem_chain = ChatPromptTemplate.from_template(\"write a 2-line poem about {topic}\") | model\n","\n",- "map_chain = RunnableMap({\"joke\": chain1, \"poem\": chain2,})\n",+ "map_chain = RunnableMap({\"joke\": joke_chain, \"poem\": poem_chain,})\n","\n","map_chain.invoke({\"topic\": \"bear\"})"]@@ -54,7 +54,7 @@},{"cell_type": "code",- "execution_count": 4,+ "execution_count": 3,"id": "267d1460-53c1-4fdb-b2c3-b6a1eb7fccff","metadata": {},"outputs": [@@ -64,7 +64,7 @@"'Harrison worked at Kensho.'"]},- "execution_count": 4,+ "execution_count": 3,"metadata": {},"output_type": "execute_result"}@@ -191,7 +191,7 @@"name": "python","nbconvert_exporter": "python","pygments_lexer": "ipython3",- "version": "3.9.1"+ "version": "3.10.1"}},"nbformat": 4,