mirror of
https://github.com/hwchase17/langchain
synced 2024-11-06 03:20:49 +00:00
Update the marathon notebook (#3183)
There were some steps that didn't make sense. Update now. This time it produced a nice markdown formatted table too
This commit is contained in:
parent
a78f55b851
commit
74342ab209
@ -183,7 +183,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 15,
|
"execution_count": 7,
|
||||||
"id": "6bb5e47b-0f54-4faa-ae42-49a28fa5497b",
|
"id": "6bb5e47b-0f54-4faa-ae42-49a28fa5497b",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"tags": []
|
"tags": []
|
||||||
@ -196,7 +196,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 7,
|
"execution_count": 8,
|
||||||
"id": "26b497d7-8e52-4c7f-8e7e-da0a48820a3c",
|
"id": "26b497d7-8e52-4c7f-8e7e-da0a48820a3c",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"tags": []
|
"tags": []
|
||||||
@ -252,7 +252,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 8,
|
"execution_count": 9,
|
||||||
"id": "1842929d-f18d-4edc-9fdd-82c929181141",
|
"id": "1842929d-f18d-4edc-9fdd-82c929181141",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"tags": []
|
"tags": []
|
||||||
@ -302,7 +302,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 9,
|
"execution_count": 10,
|
||||||
"id": "e6f72bd0",
|
"id": "e6f72bd0",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"tags": []
|
"tags": []
|
||||||
@ -324,7 +324,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 10,
|
"execution_count": 11,
|
||||||
"id": "1df7b724",
|
"id": "1df7b724",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"tags": []
|
"tags": []
|
||||||
@ -356,7 +356,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 14,
|
"execution_count": 12,
|
||||||
"id": "88c8b184-67d7-4c35-84ae-9b14bef8c4e3",
|
"id": "88c8b184-67d7-4c35-84ae-9b14bef8c4e3",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"tags": []
|
"tags": []
|
||||||
@ -375,7 +375,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 12,
|
"execution_count": 13,
|
||||||
"id": "709c08c2",
|
"id": "709c08c2",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"tags": []
|
"tags": []
|
||||||
@ -413,7 +413,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 13,
|
"execution_count": 14,
|
||||||
"id": "64455d70-a134-4d11-826a-33e34c2ce287",
|
"id": "64455d70-a134-4d11-826a-33e34c2ce287",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"tags": []
|
"tags": []
|
||||||
@ -432,27 +432,19 @@
|
|||||||
"text": [
|
"text": [
|
||||||
"{\n",
|
"{\n",
|
||||||
" \"thoughts\": {\n",
|
" \"thoughts\": {\n",
|
||||||
" \"text\": \"I will start by using the web_search command to find the Boston Marathon winning times for the past 5 years. Since it is a simple query, I expect to find relevant information in the first few search results.\",\n",
|
" \"text\": \"I need to find the winning Boston Marathon times for the past 5 years.\",\n",
|
||||||
" \"reasoning\": \"I have decided on this course of action to efficiently retrieve the information I need while keeping it simple to avoid legal complications.\",\n",
|
" \"reasoning\": \"I'll start by conducting a web search for the requested information.\",\n",
|
||||||
" \"plan\": \"- Use web_search command to search for 'Boston Marathon winning times past 5 years'\\n- Look through top results for the information requested\\n- If necessary, repeat search with slightly different query to get better results\",\n",
|
" \"plan\": \"- Conduct a web search\\n- Query relevant webpage\\n- Generate table\\n- Save data to file\",\n",
|
||||||
" \"criticism\": \"I should make sure to phrase my search query concisely to prevent too many irrelevant search results.\",\n",
|
" \"criticism\": \"None\",\n",
|
||||||
" \"speak\": \"I will use the web_search command to find the Boston Marathon winning times for the past 5 years.\"\n",
|
" \"speak\": \"I will begin by conducting a web search to find the past 5 years' Boston Marathon winning times.\"\n",
|
||||||
" },\n",
|
" },\n",
|
||||||
" \"command\": {\n",
|
" \"command\": {\n",
|
||||||
" \"name\": \"web_search\",\n",
|
" \"name\": \"web_search\",\n",
|
||||||
" \"args\": {\n",
|
" \"args\": {\n",
|
||||||
" \"query\": \"Boston Marathon winning times past 5 years\",\n",
|
" \"query\": \"winning Boston Marathon times for the past 5 years\"\n",
|
||||||
" \"num_results\": 8\n",
|
|
||||||
" }\n",
|
" }\n",
|
||||||
" }\n",
|
" }\n",
|
||||||
"}\n",
|
"}\n"
|
||||||
"\u001b[32mLast Observation: [\n",
|
|
||||||
" {\n",
|
|
||||||
" \"title\": \"List of winners of the Boston Marathon - Wikipedia\",\n",
|
|
||||||
" \"href\": \"https://en.wikipedia.org/wiki/List_of_winners_of_the_Boston_Marathon\",\n",
|
|
||||||
" \"body\": \"Louise Sauvage won the women's wheelchair division in three consecutive Boston Marathons, between 1997 and 1999. Edith Hunkeler won the race twice, in 2002 and 2006. Wakako Tsuchida won the race in five consecutive years from 2007 to 2011. Tatyana McFadden won the race five times between 2013 and 2018.\"\n",
|
|
||||||
" },\n",
|
|
||||||
" \u001b[0m\n"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -468,21 +460,20 @@
|
|||||||
"text": [
|
"text": [
|
||||||
"{\n",
|
"{\n",
|
||||||
" \"thoughts\": {\n",
|
" \"thoughts\": {\n",
|
||||||
" \"text\": \"The search results indicate that the winning times for the past 5 years can be found on the Wikipedia page for the Boston Marathon winners. I will retrieve this information using the query_webpage command and the URL of the relevant Wikipedia page. \",\n",
|
" \"text\": \"I found several relevant search results, and I will use the query_webpage command on a specific URL to gather the information.\",\n",
|
||||||
" \"reasoning\": \"This method will allow me to avoid any legal complications while retrieving the exact information that I need.\",\n",
|
" \"reasoning\": \"The Boston Athletic Association's official website (www.baa.org) is likely the most accurate source.\",\n",
|
||||||
" \"plan\": \"- Use query_webpage command to browse through the Wikipedia page for the Boston Marathon winners \\\\n- Locate the relevant information on the page \\\\n- Return the information to the user\",\n",
|
" \"plan\": \"- Query the Boston Athletic Association webpage\\n- Filter and parse the data\\n- Generate table and save to file\",\n",
|
||||||
" \"criticism\": \"I should be sure to locate and use only reliable sources to avoid providing the user with inaccurate information.\",\n",
|
" \"criticism\": \"None\",\n",
|
||||||
" \"speak\": \"I will use the query_webpage command to browse through the Wikipedia page for the Boston Marathon winners and retrieve the relevant information.\"\n",
|
" \"speak\": \"I will now query the Boston Athletic Association webpage to retrieve the information on the past 5 years' winning times.\"\n",
|
||||||
" },\n",
|
" },\n",
|
||||||
" \"command\": {\n",
|
" \"command\": {\n",
|
||||||
" \"name\": \"query_webpage\",\n",
|
" \"name\": \"query_webpage\",\n",
|
||||||
" \"args\": {\n",
|
" \"args\": {\n",
|
||||||
" \"url\": \"https://en.wikipedia.org/wiki/List_of_winners_of_the_Boston_Marathon\", \n",
|
" \"url\": \"https://www.baa.org/races/boston-marathon/results/champions\",\n",
|
||||||
" \"question\": \"What are the winning times of the Boston Marathon for the past 5 years? \"\n",
|
" \"question\": \"winning times of the Boston Marathon for the past 5 years\"\n",
|
||||||
" }\n",
|
" }\n",
|
||||||
" }\n",
|
" }\n",
|
||||||
"}\n",
|
"}\n"
|
||||||
"\u001b[32mLast Observation: {'output_text': \"The winning times of the Boston Marathon for the past 5 years are: \\n- 2017: Men's - 2:09:37, Women's - 2:21:52\\n- 2018: Men's - 2:15:58, Women's - 2:39:54\\n- 2019: Men's - 2:07:57, Women's - 2:23:31\\n- 2020: The Boston Marathon was canceled due to the COVID-19 pandemic.\\n- 2021: Men's - 2:09:28, Women's - 2:18:10\\nSOURCES: https://en.wikipedia.org/wiki/List_of_winners_of_the_Boston_Marathon\"}\u001b[0m\n"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -498,86 +489,132 @@
|
|||||||
"text": [
|
"text": [
|
||||||
"{\n",
|
"{\n",
|
||||||
" \"thoughts\": {\n",
|
" \"thoughts\": {\n",
|
||||||
" \"text\": \"I could write this information to a file using the write_file command so that I can refer back to it later. But first, I should process the information to extract the relevant data and convert it into a useful format using the process_csv command.\",\n",
|
" \"text\": \"I have the winning times of the Boston Marathon for the past 5 years. I need to create a table with the names, countries of origin, and times.\",\n",
|
||||||
" \"reasoning\": \"Storing the information in a CSV file will allow me to use pandas to manipulate the data in the future with ease, while converting the data into a useful format will make it easier for other people to use the data.\",\n",
|
" \"reasoning\": \"I can use the information I've retrieved to generate a CSV file, then process the CSV file to create the table.\",\n",
|
||||||
" \"plan\": \"- Use process_csv command to extract and format the relevant data from the Wikipedia page\\\\n- Write the data to a CSV file using the write_file command\\\\n- Inform the user that the data has been saved to file\",\n",
|
" \"plan\": \"- Save data to a CSV file\\n- Process CSV file to generate table\",\n",
|
||||||
" \"criticism\": \"I should thoroughly check the CSV file for accuracy before saving the data.\",\n",
|
" \"criticism\": \"None\",\n",
|
||||||
" \"speak\": \"I will use the process_csv command to extract and format the relevant data from the Wikipedia page, and save it to a CSV file using the write_file command.\"\n",
|
" \"speak\": \"I will save the Boston Marathon data to a CSV file and then process it to generate a table.\"\n",
|
||||||
|
" },\n",
|
||||||
|
" \"command\": {\n",
|
||||||
|
" \"name\": \"write_file\",\n",
|
||||||
|
" \"args\": {\n",
|
||||||
|
" \"file_path\": \"boston_marathon_data.csv\",\n",
|
||||||
|
" \"text\": \"Year,Name,Country,Time\\n2022,Evans Chebet,Kenya,2:06:51\\n2021,Benson Kipruto,Kenya,2:09:51\\n2019,Lawrence Cherono,Kenya,2:07:57\\n2018,Yuki Kawauchi,Japan,2:15:58\\n2017,Geoffrey Kirui,Kenya,2:09:37\"\n",
|
||||||
|
" }\n",
|
||||||
|
" }\n",
|
||||||
|
"}\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stderr",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"WARNING:root:Failed to persist run: Object of type 'FAISS' is not JSON serializable\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"{\n",
|
||||||
|
" \"thoughts\": {\n",
|
||||||
|
" \"text\": \"I have the winning times for the Boston Marathon for the past 5 years. Now, I need to turn it into a table, save it as a CSV, and process it.\",\n",
|
||||||
|
" \"reasoning\": \"Saving data as a CSV will allow for a clean table format and output.\",\n",
|
||||||
|
" \"plan\": \"- Format the data as a CSV\\n- Write the CSV to disk\\n- Process the CSV and generate a table\",\n",
|
||||||
|
" \"criticism\": \"None\",\n",
|
||||||
|
" \"speak\": \"I will now format the winning times data as a CSV, save it, and process it to generate a table.\"\n",
|
||||||
|
" },\n",
|
||||||
|
" \"command\": {\n",
|
||||||
|
" \"name\": \"write_file\",\n",
|
||||||
|
" \"args\": {\n",
|
||||||
|
" \"file_path\": \"boston_marathon_winners.csv\",\n",
|
||||||
|
" \"text\": \"Year,Name,Country,Time\\n2022,Evans Chebet,Kenya,2:06:51\\n2021,Benson Kipruto,Kenya,2:09:51\\n2019,Lawrence Cherono,Kenya,2:07:57\\n2018,Yuki Kawauchi,Japan,2:15:58\\n2017,Geoffrey Kirui,Kenya,2:09:37\"\n",
|
||||||
|
" }\n",
|
||||||
|
" }\n",
|
||||||
|
"}\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stderr",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"WARNING:root:Failed to persist run: Object of type 'FAISS' is not JSON serializable\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"{\n",
|
||||||
|
" \"thoughts\": {\n",
|
||||||
|
" \"text\": \"I have the winning times for the past 5 years, now I need to organize the information into a table and save it as a file.\",\n",
|
||||||
|
" \"reasoning\": \"Storing the information in a table file format will make it easier to access and present the data.\",\n",
|
||||||
|
" \"plan\": \"- Save data in a CSV file\\n- Generate a table\",\n",
|
||||||
|
" \"criticism\": \"None\",\n",
|
||||||
|
" \"speak\": \"I will save the winning marathon times in a table format as a CSV file and generate a table.\"\n",
|
||||||
|
" },\n",
|
||||||
|
" \"command\": {\n",
|
||||||
|
" \"name\": \"write_file\",\n",
|
||||||
|
" \"args\": {\n",
|
||||||
|
" \"file_path\": \"boston_marathon_winners.csv\",\n",
|
||||||
|
" \"text\": \"Year,Name,Country,Time\\n2022,Evans Chebet,Kenya,2:06:51\\n2021,Benson Kipruto,Kenya,2:09:51\\n2019,Lawrence Cherono,Kenya,2:07:57\\n2018,Yuki Kawauchi,Japan,2:15:58\\n2017,Geoffrey Kirui,Kenya,2:09:37\"\n",
|
||||||
|
" }\n",
|
||||||
|
" }\n",
|
||||||
|
"}\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stderr",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"WARNING:root:Failed to persist run: Object of type 'FAISS' is not JSON serializable\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"{\n",
|
||||||
|
" \"thoughts\": {\n",
|
||||||
|
" \"text\": \"I previously found the winning times of the Boston Marathon for the past 5 years and saved it as a CSV file. Now, I need to process the CSV to create a table with the names, countries of origin, and times.\",\n",
|
||||||
|
" \"reasoning\": \"Processing the CSV will help generate a clean table to provide the answer.\",\n",
|
||||||
|
" \"plan\": \"- Process the CSV file\\n- Generate a table with the required columns\",\n",
|
||||||
|
" \"criticism\": \"None\",\n",
|
||||||
|
" \"speak\": \"I will process the Boston Marathon winners' CSV file to create a table with the names, countries of origin, and times.\"\n",
|
||||||
" },\n",
|
" },\n",
|
||||||
" \"command\": {\n",
|
" \"command\": {\n",
|
||||||
" \"name\": \"process_csv\",\n",
|
" \"name\": \"process_csv\",\n",
|
||||||
" \"args\": {\n",
|
" \"args\": {\n",
|
||||||
" \"csv_file_path\": \"boston_marathon_winners.csv\",\n",
|
" \"csv_file_path\": \"boston_marathon_winners.csv\",\n",
|
||||||
" \"instructions\": \"1. Extract data from Wikipedia page\\\\n2. Convert winning times into datetime format\\\\n3. Save data as CSV file with columns: year, men\\'s time, women\\'s time\",\n",
|
" \"instructions\": \"Generate a table with columns Year, Name, Country, and Time.\"\n",
|
||||||
" \"output_path\": None\n",
|
|
||||||
" }\n",
|
" }\n",
|
||||||
" }\n",
|
" }\n",
|
||||||
"}\n",
|
"}\n",
|
||||||
"\u001b[32mLast Observation: {'output_text': \"The winning times of the Boston Marathon for the past 5 years are: \\n- 2017: Men's - 2:09:37, Women's - 2:21:52\\n- 2018: Men's - 2:15:58, Women's - 2:39:54\\n- 2019: Men's - 2:07:57, Women's - 2:23:31\\n- 2020: The Boston Marathon was canceled due to the COVID-19 pandemic.\\n- 2021: Men's - 2:09:28, Women's - 2:18:10\\nSOURCES: https://en.wikipedia.org/wiki/List_of_winners_of_the_Boston_Marathon\"}\u001b[0m\n"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "stderr",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"WARNING:root:Failed to persist run: Object of type 'FAISS' is not JSON serializable\n"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"{\n",
|
|
||||||
" \"thoughts\": {\n",
|
|
||||||
" \"text\": \"I will now use the write_file command to save the winning times for the past 5 years as a text file for later reference.\",\n",
|
|
||||||
" \"reasoning\": \"This will allow me to easily access the winning times in the future without needing to search for the information again.\",\n",
|
|
||||||
" \"plan\": \"- Use the write_file command to save the winning times for the past 5 years to a text file.\\\\n- Name the file appropriately, so it is easy to identify in the future.\",\n",
|
|
||||||
" \"criticism\": \"I should review the contents of the file after writing it to make sure that the information has been saved correctly and can be read later without errors.\",\n",
|
|
||||||
" \"speak\": \"I will use the write_file command to save the winning times for the past 5 years as a text file for easy retrieval in the future.\"\n",
|
|
||||||
" },\n",
|
|
||||||
" \"command\": {\n",
|
|
||||||
" \"name\": \"write_file\",\n",
|
|
||||||
" \"args\": {\n",
|
|
||||||
" \"file_path\": \"BostonMarathonWinningTimes.txt\",\n",
|
|
||||||
" \"text\": \"The winning times of the Boston Marathon for the past 5 years are: \\n- 2017: Men's - 2:09:37, Women's - 2:21:52\\n- 2018: Men's - 2:15:58, Women's - 2:39:54\\n- 2019: Men's - 2:07:57, Women's - 2:23:31\\n- 2020: The Boston Marathon was canceled due to the COVID-19 pandemic.\\n- 2021: Men's - 2:09:28, Women's - 2:18:10\\nSOURCES: https://en.wikipedia.org/wiki/List_of_winners_of_the_Boston_Marathon\"\n",
|
|
||||||
" }\n",
|
|
||||||
" }\n",
|
|
||||||
"}\n",
|
|
||||||
"\u001b[32mLast Observation: File written to successfully.\u001b[0m\n"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "stderr",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"WARNING:root:Failed to persist run: Object of type 'FAISS' is not JSON serializable\n"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"I will use the command \"query_webpage\" to browse through the Wikipedia page for the Boston Marathon winners and retrieve the winning times for the past 5 years. This is the method that will allow me to retrieve the exact information I need while avoiding any legal issues. \n",
|
|
||||||
"\n",
|
"\n",
|
||||||
"```\n",
|
"\n",
|
||||||
"{\n",
|
"\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n",
|
||||||
" \"thoughts\": {\n",
|
"\u001b[32;1m\u001b[1;3mThought: I need to convert the provided dataframe to a string in Markdown table format.\n",
|
||||||
" \"text\": \"The search results indicate that the winning times for the past 5 years can be found on the Wikipedia page for the Boston Marathon winners. I will retrieve this information using the query_webpage command and the URL of the relevant Wikipedia page. \",\n",
|
"Action: python_repl_ast\n",
|
||||||
" \"reasoning\": \"This method will allow me to avoid any legal complications while retrieving the exact information that I need.\",\n",
|
"Action Input: df.to_markdown(index=False)\u001b[0m\n",
|
||||||
" \"plan\": \"- Use query_webpage command to browse through the Wikipedia page for the Boston Marathon winners \\\\n- Locate the relevant information on the page \\\\n- Return the information to the user\",\n",
|
"Observation: \u001b[36;1m\u001b[1;3m| Year | Name | Country | Time |\n",
|
||||||
" \"criticism\": \"I should be sure to locate and use only reliable sources to avoid providing the user with inaccurate information.\",\n",
|
"|-------:|:-----------------|:----------|:--------|\n",
|
||||||
" \"speak\": \"I will use the query_webpage command to browse through the Wikipedia page for the Boston Marathon winners and retrieve the winning times for the past 5 years. \"\n",
|
"| 2022 | Evans Chebet | Kenya | 2:06:51 |\n",
|
||||||
" },\n",
|
"| 2021 | Benson Kipruto | Kenya | 2:09:51 |\n",
|
||||||
" \"command\": {\n",
|
"| 2019 | Lawrence Cherono | Kenya | 2:07:57 |\n",
|
||||||
" \"name\": \"query_webpage\",\n",
|
"| 2018 | Yuki Kawauchi | Japan | 2:15:58 |\n",
|
||||||
" \"args\": {\n",
|
"| 2017 | Geoffrey Kirui | Kenya | 2:09:37 |\u001b[0m\n",
|
||||||
" \"url\": \"https://en.wikipedia.org/wiki/List_of_winners_of_the_Boston_Marathon\", \n",
|
"Thought:\u001b[32;1m\u001b[1;3mI now know the final answer.\n",
|
||||||
" \"question\": \"What are the winning times of the Boston Marathon for the past 5 years? \"\n",
|
"Final Answer: \n",
|
||||||
" }\n",
|
"\n",
|
||||||
" }\n",
|
"| Year | Name | Country | Time |\n",
|
||||||
"}\n",
|
"|-------:|:-----------------|:----------|:--------|\n",
|
||||||
"```\n",
|
"| 2022 | Evans Chebet | Kenya | 2:06:51 |\n",
|
||||||
"\u001b[32mLast Observation: File written to successfully.\u001b[0m\n"
|
"| 2021 | Benson Kipruto | Kenya | 2:09:51 |\n",
|
||||||
|
"| 2019 | Lawrence Cherono | Kenya | 2:07:57 |\n",
|
||||||
|
"| 2018 | Yuki Kawauchi | Japan | 2:15:58 |\n",
|
||||||
|
"| 2017 | Geoffrey Kirui | Kenya | 2:09:37 |\u001b[0m\n",
|
||||||
|
"\n",
|
||||||
|
"\u001b[1m> Finished chain.\u001b[0m\n"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -593,46 +630,16 @@
|
|||||||
"text": [
|
"text": [
|
||||||
"{\n",
|
"{\n",
|
||||||
" \"thoughts\": {\n",
|
" \"thoughts\": {\n",
|
||||||
" \"text\": \"Now that I have the winning times for the past 5 years, I will save them to a file to ensure that I don't forget them. I will use the write_file command to save this data to disk.\",\n",
|
" \"text\": \"I have already retrieved the winning times for the past 5 years of the Boston Marathon and created a table. My objective is complete.\",\n",
|
||||||
" \"reasoning\": \"By saving the data to disk, I can easily retrieve it in the future and avoid having to perform the same search again.\",\n",
|
" \"reasoning\": \"I have completed my task on this topic, so I don't need to use any other commands.\",\n",
|
||||||
" \"plan\": \"- Use the write_file command to save the data to a text file.\",\n",
|
" \"plan\": \"- Inform the user that the task is complete\",\n",
|
||||||
" \"criticism\": \"I should ensure that the file path and file name are clear and descriptive to make it easy to locate the relevant information in the future.\",\n",
|
" \"criticism\": \"None\",\n",
|
||||||
" \"speak\": \"I will save the winning times for the past 5 years to a text file using the write_file command.\"\n",
|
" \"speak\": \"I have found the winning times for the past 5 years of the Boston Marathon and created a table. My task is complete.\"\n",
|
||||||
" },\n",
|
|
||||||
" \"command\": {\n",
|
|
||||||
" \"name\": \"write_file\",\n",
|
|
||||||
" \"args\": {\n",
|
|
||||||
" \"file_path\": \"winning_times.txt\",\n",
|
|
||||||
" \"text\": \"The winning times of the Boston Marathon for the past 5 years are:\\n- 2017: Men's - 2:09:37, Women's - 2:21:52\\n- 2018: Men's - 2:15:58, Women's - 2:39:54\\n- 2019: Men's - 2:07:57, Women's - 2:23:31\\n- 2020: The Boston Marathon was canceled due to the COVID-19 pandemic.\\n- 2021: Men's - 2:09:28, Women's - 2:18:10\\nSOURCES: https://en.wikipedia.org/wiki/List_of_winners_of_the_Boston_Marathon\"\n",
|
|
||||||
" }\n",
|
|
||||||
" }\n",
|
|
||||||
"}\n",
|
|
||||||
"\u001b[32mLast Observation: File written to successfully.\u001b[0m\n"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "stderr",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"WARNING:root:Failed to persist run: Object of type 'FAISS' is not JSON serializable\n"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"{\n",
|
|
||||||
" \"thoughts\": {\n",
|
|
||||||
" \"text\": \"I will now shut down my system, as I have completed all of my objectives.\",\n",
|
|
||||||
" \"reasoning\": \"Since I have completed all of my objectives, there is no need to keep running my system.\",\n",
|
|
||||||
" \"plan\": \"- Use the finish command to signal that I have completed all of my objectives.\\\\\\\\n- Shut down the system.\",\n",
|
|
||||||
" \"criticism\": \"I should always double-check to ensure that all of my objectives have been completed before shutting down my system.\",\n",
|
|
||||||
" \"speak\": \"I have completed all of my objectives, and I will now shut down my system.\"\n",
|
|
||||||
" },\n",
|
" },\n",
|
||||||
" \"command\": {\n",
|
" \"command\": {\n",
|
||||||
" \"name\": \"finish\",\n",
|
" \"name\": \"finish\",\n",
|
||||||
" \"args\": {\n",
|
" \"args\": {\n",
|
||||||
" \"response\": \"All objectives have been completed.\"\n",
|
" \"response\": \"I have found the winning times for the past 5 years of the Boston Marathon and created a table. My task is complete.\"\n",
|
||||||
" }\n",
|
" }\n",
|
||||||
" }\n",
|
" }\n",
|
||||||
"}\n"
|
"}\n"
|
||||||
@ -641,17 +648,25 @@
|
|||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"text/plain": [
|
"text/plain": [
|
||||||
"'All objectives have been completed.'"
|
"'I have found the winning times for the past 5 years of the Boston Marathon and created a table. My task is complete.'"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 13,
|
"execution_count": 14,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"agent.run([\"What were the winning boston marathon times for the past 5 years\"])"
|
"agent.run([\"What were the winning boston marathon times for the past 5 years? Generate a table of the names, countries of origin, and times.\"])"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "a6b4f96e",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
Loading…
Reference in New Issue
Block a user