From 4d53cefbe9a35b825be74a4fd5a31f3ab3d3d502 Mon Sep 17 00:00:00 2001 From: Tiago De Gaspari Date: Tue, 25 Apr 2023 20:06:47 -0300 Subject: [PATCH] Fix agents' notebooks outputs (#3517) Fix agents' notebooks to make the answer reflect what is being asked by the user. --- docs/modules/agents/agents/custom_agent.ipynb | 14 +++++------ .../agents/custom_multi_action_agent.ipynb | 24 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/modules/agents/agents/custom_agent.ipynb b/docs/modules/agents/agents/custom_agent.ipynb index 34a5aa59..178d35e6 100644 --- a/docs/modules/agents/agents/custom_agent.ipynb +++ b/docs/modules/agents/agents/custom_agent.ipynb @@ -49,7 +49,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "a33e2f7e", "metadata": {}, "outputs": [], @@ -97,7 +97,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "id": "655d72f6", "metadata": {}, "outputs": [], @@ -107,7 +107,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "id": "490604e9", "metadata": {}, "outputs": [], @@ -117,7 +117,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "id": "653b1617", "metadata": {}, "outputs": [ @@ -128,7 +128,7 @@ "\n", "\n", "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n", - "\u001b[32;1m\u001b[1;3m\u001b[0m\u001b[36;1m\u001b[1;3mFoo Fighters is an American rock band formed in Seattle in 1994. Foo Fighters was initially formed as a one-man project by former Nirvana drummer Dave Grohl. Following the success of the 1995 eponymous debut album, Grohl recruited a band consisting of Nate Mendel, William Goldsmith, and Pat Smear.\u001b[0m\u001b[32;1m\u001b[1;3m\u001b[0m\n", + "\u001b[32;1m\u001b[1;3m\u001b[0m\u001b[36;1m\u001b[1;3mThe current population of Canada is 38,669,152 as of Monday, April 24, 2023, based on Worldometer elaboration of the latest United Nations data.\u001b[0m\u001b[32;1m\u001b[1;3m\u001b[0m\n", "\n", "\u001b[1m> Finished chain.\u001b[0m\n" ] @@ -136,10 +136,10 @@ { "data": { "text/plain": [ - "'Foo Fighters is an American rock band formed in Seattle in 1994. Foo Fighters was initially formed as a one-man project by former Nirvana drummer Dave Grohl. Following the success of the 1995 eponymous debut album, Grohl recruited a band consisting of Nate Mendel, William Goldsmith, and Pat Smear.'" + "'The current population of Canada is 38,669,152 as of Monday, April 24, 2023, based on Worldometer elaboration of the latest United Nations data.'" ] }, - "execution_count": 7, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } diff --git a/docs/modules/agents/agents/custom_multi_action_agent.ipynb b/docs/modules/agents/agents/custom_multi_action_agent.ipynb index ef6e9eda..2497a046 100644 --- a/docs/modules/agents/agents/custom_multi_action_agent.ipynb +++ b/docs/modules/agents/agents/custom_multi_action_agent.ipynb @@ -31,7 +31,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 2, "id": "d7c4ebdc", "metadata": {}, "outputs": [], @@ -43,7 +43,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 3, "id": "becda2a1", "metadata": {}, "outputs": [], @@ -66,7 +66,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 4, "id": "a33e2f7e", "metadata": {}, "outputs": [], @@ -96,8 +96,8 @@ " \"\"\"\n", " if len(intermediate_steps) == 0:\n", " return [\n", - " AgentAction(tool=\"Search\", tool_input=\"foo\", log=\"\"),\n", - " AgentAction(tool=\"RandomWord\", tool_input=\"foo\", log=\"\"),\n", + " AgentAction(tool=\"Search\", tool_input=kwargs[\"input\"], log=\"\"),\n", + " AgentAction(tool=\"RandomWord\", tool_input=kwargs[\"input\"], log=\"\"),\n", " ]\n", " else:\n", " return AgentFinish(return_values={\"output\": \"bar\"}, log=\"\")\n", @@ -117,8 +117,8 @@ " \"\"\"\n", " if len(intermediate_steps) == 0:\n", " return [\n", - " AgentAction(tool=\"Search\", tool_input=\"foo\", log=\"\"),\n", - " AgentAction(tool=\"RandomWord\", tool_input=\"foo\", log=\"\"),\n", + " AgentAction(tool=\"Search\", tool_input=kwargs[\"input\"], log=\"\"),\n", + " AgentAction(tool=\"RandomWord\", tool_input=kwargs[\"input\"], log=\"\"),\n", " ]\n", " else:\n", " return AgentFinish(return_values={\"output\": \"bar\"}, log=\"\")" @@ -126,7 +126,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 5, "id": "655d72f6", "metadata": {}, "outputs": [], @@ -136,7 +136,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 6, "id": "490604e9", "metadata": {}, "outputs": [], @@ -146,7 +146,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 7, "id": "653b1617", "metadata": {}, "outputs": [ @@ -157,7 +157,7 @@ "\n", "\n", "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n", - "\u001b[32;1m\u001b[1;3m\u001b[0m\u001b[36;1m\u001b[1;3mFoo Fighters is an American rock band formed in Seattle in 1994. Foo Fighters was initially formed as a one-man project by former Nirvana drummer Dave Grohl. Following the success of the 1995 eponymous debut album, Grohl recruited a band consisting of Nate Mendel, William Goldsmith, and Pat Smear.\u001b[0m\u001b[32;1m\u001b[1;3m\u001b[0m\n", + "\u001b[32;1m\u001b[1;3m\u001b[0m\u001b[36;1m\u001b[1;3mThe current population of Canada is 38,669,152 as of Monday, April 24, 2023, based on Worldometer elaboration of the latest United Nations data.\u001b[0m\u001b[32;1m\u001b[1;3m\u001b[0m\n", "Now I'm doing this!\n", "\u001b[33;1m\u001b[1;3mfoo\u001b[0m\u001b[32;1m\u001b[1;3m\u001b[0m\n", "\n", @@ -170,7 +170,7 @@ "'bar'" ] }, - "execution_count": 26, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" }