diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..c59294b --- /dev/null +++ b/.env.example @@ -0,0 +1,15 @@ +# cp .env.example .env +# Edit your .env file with your own values +# Don't commit your .env file to git/push to GitHub! +# Don't modify/delete .env.example unless adding extensions to the project +# which require new variable to be added to the .env file + +# API CONFIG +OPENAI_API_KEY= +OPENAI_API_MODEL=gpt-3.5-turbo # alternatively, gpt-4, text-davinci-003, etc +OPENAI_TEMPERATURE=0.0 +PINECONE_API_KEY= +PINECONE_ENVIRONMENT= + +SERPAPI_API_KEY= +ZAPIER_NLA_API_KEY= diff --git a/.gitignore b/.gitignore index 4dc411a..d5bdfab 100644 --- a/.gitignore +++ b/.gitignore @@ -128,6 +128,9 @@ ENV/ env.bak/ venv.bak/ +# PyCharm or anyother jetbrain IDE +.idea + # Spyder project settings .spyderproject .spyproject diff --git a/LangChain Cookbook Part 1 - Fundamentals.ipynb b/LangChain Cookbook Part 1 - Fundamentals.ipynb index 741fa5e..988b325 100644 --- a/LangChain Cookbook Part 1 - Fundamentals.ipynb +++ b/LangChain Cookbook Part 1 - Fundamentals.ipynb @@ -1407,9 +1407,9 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new SimpleSequentialChain chain...\u001b[0m\n", - "\u001b[36;1m\u001b[1;3mA classic dish from Rome is Spaghetti alla Carbonara. This dish is a creamy pasta made with eggs, cured pork, Pecorino Romano cheese, black pepper, and Olive oil.\u001b[0m\n", - "\u001b[33;1m\u001b[1;3m1. Bring a large pot of salted water to a boil.\n", + "\u001B[1m> Entering new SimpleSequentialChain chain...\u001B[0m\n", + "\u001B[36;1m\u001B[1;3mA classic dish from Rome is Spaghetti alla Carbonara. This dish is a creamy pasta made with eggs, cured pork, Pecorino Romano cheese, black pepper, and Olive oil.\u001B[0m\n", + "\u001B[33;1m\u001B[1;3m1. Bring a large pot of salted water to a boil.\n", "2. Add about a pound of spaghetti noodles and cook for 8-10 minutes, stirring occasionally.\n", "3. Drain noodles and set aside.\n", "4. In a separate bowl, whisk together 2 eggs and ½ cup of Pecorino Romano cheese.\n", @@ -1417,9 +1417,9 @@ "6. Add 4 ounces of cubed pancetta or guanciale and cook until lightly browned, stirring often.\n", "7. Reduce heat to low and add the spaghetti noodles.\n", "8. Pour the egg mixture over the noodles and vigorously stir together.\n", - "9. Remove from heat, stir in a pinch of black pepper and serve.\u001b[0m\n", + "9. Remove from heat, stir in a pinch of black pepper and serve.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] } ], @@ -1449,12 +1449,12 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new MapReduceDocumentsChain chain...\u001b[0m\n", + "\u001B[1m> Entering new MapReduceDocumentsChain chain...\u001B[0m\n", "\n", "\n", - "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", + "\u001B[1m> Entering new LLMChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"January 2017Because biographies of famous scientists tend to \n", @@ -1472,9 +1472,9 @@ "crazy.But maybe there is a simpler explanation. Maybe\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"the smartness and the craziness were not as separate\n", @@ -1491,17 +1491,17 @@ "they were all risky.\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", "\n", - "\u001b[1m> Entering new StuffDocumentsChain chain...\u001b[0m\n", + "\u001B[1m> Entering new StuffDocumentsChain chain...\u001B[0m\n", "\n", "\n", - "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", + "\u001B[1m> Entering new LLMChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\" Biographies of famous scientists fail to show the risks they took and the mistakes they made, leading to an unbalanced impression. Explaining the detours taken in their exploration of topics such as alchemy and theology, smart people are often thought of as crazy; however, there may be a simpler explanation.\n", @@ -1509,13 +1509,13 @@ " In Newton's day, no one knew how successful inventing physics, alchemy, and theology would be. But Newton made the decision to pursue all three topics, and one of them was a success. Even though our current view is that physics is the superior venture and alchemy and theology are waste of time, Newton's risky decision shows that these things were once considered equally important.\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] }, { @@ -1657,19 +1657,19 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n", - "\u001b[32;1m\u001b[1;3m I should try to find out what band Natalie Bergman is a part of.\n", + "\u001B[1m> Entering new AgentExecutor chain...\u001B[0m\n", + "\u001B[32;1m\u001B[1;3m I should try to find out what band Natalie Bergman is a part of.\n", "Action: Search\n", - "Action Input: \"Natalie Bergman band\"\u001b[0m\n", - "Observation: \u001b[36;1m\u001b[1;3mNatalie Bergman is an American singer-songwriter. She is one half of the duo Wild Belle, along with her brother Elliot Bergman. Her debut solo album, Mercy, was released on Third Man Records on May 7, 2021. She is based in Los Angeles.\u001b[0m\n", - "Thought:\u001b[32;1m\u001b[1;3m I should search for the debut album of Wild Belle.\n", + "Action Input: \"Natalie Bergman band\"\u001B[0m\n", + "Observation: \u001B[36;1m\u001B[1;3mNatalie Bergman is an American singer-songwriter. She is one half of the duo Wild Belle, along with her brother Elliot Bergman. Her debut solo album, Mercy, was released on Third Man Records on May 7, 2021. She is based in Los Angeles.\u001B[0m\n", + "Thought:\u001B[32;1m\u001B[1;3m I should search for the debut album of Wild Belle.\n", "Action: Search\n", - "Action Input: \"Wild Belle debut album\"\u001b[0m\n", - "Observation: \u001b[36;1m\u001b[1;3mIsles\u001b[0m\n", - "Thought:\u001b[32;1m\u001b[1;3m I now know the final answer.\n", - "Final Answer: Isles is the debut album of Wild Belle, the band that Natalie Bergman is a part of.\u001b[0m\n", + "Action Input: \"Wild Belle debut album\"\u001B[0m\n", + "Observation: \u001B[36;1m\u001B[1;3mIsles\u001B[0m\n", + "Thought:\u001B[32;1m\u001B[1;3m I now know the final answer.\n", + "Final Answer: Isles is the debut album of Wild Belle, the band that Natalie Bergman is a part of.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] } ], diff --git a/agents/Agents + ZapierToolkit.ipynb b/agents/Agents + ZapierToolkit.ipynb index 27a48a5..2346928 100644 --- a/agents/Agents + ZapierToolkit.ipynb +++ b/agents/Agents + ZapierToolkit.ipynb @@ -40,6 +40,9 @@ }, "outputs": [], "source": [ + "from dotenv import find_dotenv, load_dotenv\n", + "load_dotenv(find_dotenv())\n", + "\n", "os.environ[\"OPENAI_API_KEY\"] = 'YourAPIKey'\n", "os.environ[\"ZAPIER_NLA_API_KEY\"] = 'YourAPIKey'" ] @@ -151,30 +154,30 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n", - "\u001b[32;1m\u001b[1;3m I need to find the email and then find a gif and send it to a slack channel\n", + "\u001B[1m> Entering new AgentExecutor chain...\u001B[0m\n", + "\u001B[32;1m\u001B[1;3m I need to find the email and then find a gif and send it to a slack channel\n", "Action: Gmail: Find Email\n", - "Action Input: Find the last email I received from greg@DataIndependent.com\u001b[0m\n", - "Observation: \u001b[33;1m\u001b[1;3m{\"from__email\": \"greg@dataindependent.com\", \"from__name\": \"Greg Kamradt\", \"body_plain\": \"Hey Greg,\\r\\n\\r\\nThis is Braden from VC Ventures. I love what you are doing at Thimble and\\r\\nwe think it's super cool. We'd love to collaborate and see how you'd like\\r\\nto partner.\\r\\n\\r\\nWe are happy to provide introductions, funding, or set you up with ideas.\\r\\n\\r\\nWhat can we help with?\\r\\n\\r\\nChat soon,\\r\\n\\r\\nBraden\\r\\n\", \"message_url\": \"https://mail.google.com/mail/u/0/#inbox/186e9069bdbf14a9\", \"subject\": \"We'd love to collaborate!\", \"date\": \"Wed, 15 Mar 2023 23:05:58 -0700\", \"to__emails\": \"thimbleai@gmail.com\", \"attachment_count\": \"0\", \"raw__payload__headers__Delivered-To\": \"thimbleai@gmail.com\", \"message_id\": \"186e9069bdbf14a9\"}\u001b[0m\n", - "Thought:\u001b[32;1m\u001b[1;3m I have the email, now I need to find a gif\n", + "Action Input: Find the last email I received from greg@DataIndependent.com\u001B[0m\n", + "Observation: \u001B[33;1m\u001B[1;3m{\"from__email\": \"greg@dataindependent.com\", \"from__name\": \"Greg Kamradt\", \"body_plain\": \"Hey Greg,\\r\\n\\r\\nThis is Braden from VC Ventures. I love what you are doing at Thimble and\\r\\nwe think it's super cool. We'd love to collaborate and see how you'd like\\r\\nto partner.\\r\\n\\r\\nWe are happy to provide introductions, funding, or set you up with ideas.\\r\\n\\r\\nWhat can we help with?\\r\\n\\r\\nChat soon,\\r\\n\\r\\nBraden\\r\\n\", \"message_url\": \"https://mail.google.com/mail/u/0/#inbox/186e9069bdbf14a9\", \"subject\": \"We'd love to collaborate!\", \"date\": \"Wed, 15 Mar 2023 23:05:58 -0700\", \"to__emails\": \"thimbleai@gmail.com\", \"attachment_count\": \"0\", \"raw__payload__headers__Delivered-To\": \"thimbleai@gmail.com\", \"message_id\": \"186e9069bdbf14a9\"}\u001B[0m\n", + "Thought:\u001B[32;1m\u001B[1;3m I have the email, now I need to find a gif\n", "Action: Giphy: Find GIF\n", - "Action Input: Find a good gif that matches the intent of the email\u001b[0m\n", - "Observation: \u001b[33;1m\u001b[1;3mnull\u001b[0m\n", - "Thought:\u001b[32;1m\u001b[1;3m I need to find another gif\n", + "Action Input: Find a good gif that matches the intent of the email\u001B[0m\n", + "Observation: \u001B[33;1m\u001B[1;3mnull\u001B[0m\n", + "Thought:\u001B[32;1m\u001B[1;3m I need to find another gif\n", "Action: Giphy: Find GIF\n", - "Action Input: Find a good gif that matches the intent of the email\u001b[0m\n", - "Observation: \u001b[33;1m\u001b[1;3mnull\u001b[0m\n", - "Thought:\u001b[32;1m\u001b[1;3m I need to find another gif\n", + "Action Input: Find a good gif that matches the intent of the email\u001B[0m\n", + "Observation: \u001B[33;1m\u001B[1;3mnull\u001B[0m\n", + "Thought:\u001B[32;1m\u001B[1;3m I need to find another gif\n", "Action: Giphy: Find GIF\n", - "Action Input: Find a good gif that matches the intent of the email\u001b[0m\n", - "Observation: \u001b[33;1m\u001b[1;3mnull\u001b[0m\n", - "Thought:\u001b[32;1m\u001b[1;3m I need to find another gif\n", + "Action Input: Find a good gif that matches the intent of the email\u001B[0m\n", + "Observation: \u001B[33;1m\u001B[1;3mnull\u001B[0m\n", + "Thought:\u001B[32;1m\u001B[1;3m I need to find another gif\n", "Action: Giphy: Find GIF\n", - "Action Input: Find a good gif that matches the intent of the email\u001b[0m\n", - "Observation: \u001b[33;1m\u001b[1;3mnull\u001b[0m\n", - "Thought:\u001b[32;1m\u001b[1;3m I have the gif, now I need to send it to a slack channel\n", + "Action Input: Find a good gif that matches the intent of the email\u001B[0m\n", + "Observation: \u001B[33;1m\u001B[1;3mnull\u001B[0m\n", + "Thought:\u001B[32;1m\u001B[1;3m I have the gif, now I need to send it to a slack channel\n", "Action: Slack: Send Channel Message\n", - "Action Input: Send the gif to trending domains in slack\u001b[0m" + "Action Input: Send the gif to trending domains in slack\u001B[0m" ] }, { @@ -182,32 +185,32 @@ "evalue": "", "output_type": "error", "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/var/folders/5c/csjfqsk97xz704h7v3fzjqph0000gn/T/ipykernel_28927/4128131430.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m agent.run(\"\"\"Get the last email I received from greg@DataIndependent.com\n\u001b[0m\u001b[1;32m 2\u001b[0m Find a good gif that matches the intent of the email and send the gif to trending domains in slack\"\"\")\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 211\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 212\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"`run` supports only one positional argument.\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 213\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0moutput_keys\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 214\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 215\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mkwargs\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0margs\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, inputs, return_only_outputs)\u001b[0m\n\u001b[1;32m 114\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 115\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_chain_error\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 116\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 117\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_chain_end\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moutputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 118\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprep_outputs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moutputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreturn_only_outputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, inputs, return_only_outputs)\u001b[0m\n\u001b[1;32m 111\u001b[0m )\n\u001b[1;32m 112\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 113\u001b[0;31m \u001b[0moutputs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 114\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 115\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_chain_error\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/agents/agent.py\u001b[0m in \u001b[0;36m_call\u001b[0;34m(self, inputs)\u001b[0m\n\u001b[1;32m 497\u001b[0m \u001b[0;31m# We now enter the agent loop (until it returns something).\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 498\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_should_continue\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0miterations\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 499\u001b[0;31m next_step_output = self._take_next_step(\n\u001b[0m\u001b[1;32m 500\u001b[0m \u001b[0mname_to_tool_map\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcolor_mapping\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mintermediate_steps\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 501\u001b[0m )\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/agents/agent.py\u001b[0m in \u001b[0;36m_take_next_step\u001b[0;34m(self, name_to_tool_map, color_mapping, inputs, intermediate_steps)\u001b[0m\n\u001b[1;32m 421\u001b[0m \u001b[0mllm_prefix\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"\"\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mreturn_direct\u001b[0m \u001b[0;32melse\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0magent\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mllm_prefix\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 422\u001b[0m \u001b[0;31m# We then call the tool on the tool input to get an observation\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 423\u001b[0;31m observation = tool.run(\n\u001b[0m\u001b[1;32m 424\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtool_input\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 425\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/tools/base.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self, tool_input, verbose, start_color, color, **kwargs)\u001b[0m\n\u001b[1;32m 69\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mException\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 70\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_tool_error\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 71\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 72\u001b[0m self.callback_manager.on_tool_end(\n\u001b[1;32m 73\u001b[0m \u001b[0mobservation\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcolor\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcolor\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/tools/base.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self, tool_input, verbose, start_color, color, **kwargs)\u001b[0m\n\u001b[1;32m 66\u001b[0m )\n\u001b[1;32m 67\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 68\u001b[0;31m \u001b[0mobservation\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_run\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtool_input\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 69\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mException\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 70\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_tool_error\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/tools/zapier/tool.py\u001b[0m in \u001b[0;36m_run\u001b[0;34m(self, instructions)\u001b[0m\n\u001b[1;32m 119\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_run\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minstructions\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 120\u001b[0m \u001b[0;34m\"\"\"Use the Zapier NLA tool to return a list of all exposed user actions.\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 121\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapi_wrapper\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun_as_str\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0maction_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minstructions\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mparams\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 122\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 123\u001b[0m \u001b[0;32masync\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_arun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/utilities/zapier.py\u001b[0m in \u001b[0;36mrun_as_str\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 140\u001b[0m \"\"\"Same as run, but returns a stringified version of the JSON for\n\u001b[1;32m 141\u001b[0m insertting back into an LLM.\"\"\"\n\u001b[0;32m--> 142\u001b[0;31m \u001b[0mdata\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 143\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mjson\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdumps\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 144\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/utilities/zapier.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self, action_id, instructions, params)\u001b[0m\n\u001b[1;32m 119\u001b[0m \u001b[0msession\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_session\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 120\u001b[0m \u001b[0mrequest\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_action_request\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0maction_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minstructions\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 121\u001b[0;31m \u001b[0mresponse\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msession\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msession\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprepare_request\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 122\u001b[0m \u001b[0mresponse\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mraise_for_status\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 123\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mresponse\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjson\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"result\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/requests/sessions.py\u001b[0m in \u001b[0;36msend\u001b[0;34m(self, request, **kwargs)\u001b[0m\n\u001b[1;32m 699\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 700\u001b[0m \u001b[0;31m# Send the request\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 701\u001b[0;31m \u001b[0mr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0madapter\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 702\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 703\u001b[0m \u001b[0;31m# Total elapsed time of the request (approximately)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/requests/adapters.py\u001b[0m in \u001b[0;36msend\u001b[0;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[1;32m 487\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 488\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mchunked\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 489\u001b[0;31m resp = conn.urlopen(\n\u001b[0m\u001b[1;32m 490\u001b[0m \u001b[0mmethod\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mrequest\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmethod\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 491\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/urllib3/connectionpool.py\u001b[0m in \u001b[0;36murlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)\u001b[0m\n\u001b[1;32m 701\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 702\u001b[0m \u001b[0;31m# Make the request on the httplib connection object.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 703\u001b[0;31m httplib_response = self._make_request(\n\u001b[0m\u001b[1;32m 704\u001b[0m \u001b[0mconn\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 705\u001b[0m \u001b[0mmethod\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/urllib3/connectionpool.py\u001b[0m in \u001b[0;36m_make_request\u001b[0;34m(self, conn, method, url, timeout, chunked, **httplib_request_kw)\u001b[0m\n\u001b[1;32m 447\u001b[0m \u001b[0;31m# Python 3 (including for exceptions like SystemExit).\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 448\u001b[0m \u001b[0;31m# Otherwise it looks like a bug in the code.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 449\u001b[0;31m \u001b[0msix\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mraise_from\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 450\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mSocketTimeout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mBaseSSLError\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mSocketError\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 451\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_raise_timeout\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0merr\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout_value\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mread_timeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/urllib3/packages/six.py\u001b[0m in \u001b[0;36mraise_from\u001b[0;34m(value, from_value)\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/urllib3/connectionpool.py\u001b[0m in \u001b[0;36m_make_request\u001b[0;34m(self, conn, method, url, timeout, chunked, **httplib_request_kw)\u001b[0m\n\u001b[1;32m 442\u001b[0m \u001b[0;31m# Python 3\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 443\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 444\u001b[0;31m \u001b[0mhttplib_response\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mconn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetresponse\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 445\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mBaseException\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 446\u001b[0m \u001b[0;31m# Remove the TypeError from the exception chain in\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/http/client.py\u001b[0m in \u001b[0;36mgetresponse\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 1375\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1376\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1377\u001b[0;31m \u001b[0mresponse\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbegin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1378\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mConnectionError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1379\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclose\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/http/client.py\u001b[0m in \u001b[0;36mbegin\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 318\u001b[0m \u001b[0;31m# read until we get a non-100 response\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 319\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 320\u001b[0;31m \u001b[0mversion\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatus\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreason\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_read_status\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 321\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mstatus\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0mCONTINUE\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 322\u001b[0m \u001b[0;32mbreak\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/http/client.py\u001b[0m in \u001b[0;36m_read_status\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 279\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 280\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_read_status\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 281\u001b[0;31m \u001b[0mline\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreadline\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_MAXLINE\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"iso-8859-1\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 282\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mline\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m>\u001b[0m \u001b[0m_MAXLINE\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 283\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mLineTooLong\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"status line\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/socket.py\u001b[0m in \u001b[0;36mreadinto\u001b[0;34m(self, b)\u001b[0m\n\u001b[1;32m 702\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 703\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 704\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_sock\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrecv_into\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mb\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 705\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 706\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_timeout_occurred\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/ssl.py\u001b[0m in \u001b[0;36mrecv_into\u001b[0;34m(self, buffer, nbytes, flags)\u001b[0m\n\u001b[1;32m 1240\u001b[0m \u001b[0;34m\"non-zero flags not allowed in calls to recv_into() on %s\"\u001b[0m \u001b[0;34m%\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1241\u001b[0m self.__class__)\n\u001b[0;32m-> 1242\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnbytes\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbuffer\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1243\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1244\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrecv_into\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbuffer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnbytes\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mflags\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/ssl.py\u001b[0m in \u001b[0;36mread\u001b[0;34m(self, len, buffer)\u001b[0m\n\u001b[1;32m 1098\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1099\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mbuffer\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1100\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_sslobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbuffer\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1101\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1102\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_sslobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mKeyboardInterrupt\u001b[0m: " + "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m", + "\u001B[0;31mKeyboardInterrupt\u001B[0m Traceback (most recent call last)", + "\u001B[0;32m/var/folders/5c/csjfqsk97xz704h7v3fzjqph0000gn/T/ipykernel_28927/4128131430.py\u001B[0m in \u001B[0;36m\u001B[0;34m\u001B[0m\n\u001B[0;32m----> 1\u001B[0;31m agent.run(\"\"\"Get the last email I received from greg@DataIndependent.com\n\u001B[0m\u001B[1;32m 2\u001B[0m Find a good gif that matches the intent of the email and send the gif to trending domains in slack\"\"\")\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001B[0m in \u001B[0;36mrun\u001B[0;34m(self, *args, **kwargs)\u001B[0m\n\u001B[1;32m 211\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mlen\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0margs\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m!=\u001B[0m \u001B[0;36m1\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 212\u001B[0m \u001B[0;32mraise\u001B[0m \u001B[0mValueError\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m\"`run` supports only one positional argument.\"\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 213\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0margs\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0;36m0\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0moutput_keys\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0;36m0\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 214\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 215\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mkwargs\u001B[0m \u001B[0;32mand\u001B[0m \u001B[0;32mnot\u001B[0m \u001B[0margs\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001B[0m in \u001B[0;36m__call__\u001B[0;34m(self, inputs, return_only_outputs)\u001B[0m\n\u001B[1;32m 114\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0;34m(\u001B[0m\u001B[0mKeyboardInterrupt\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mException\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 115\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_chain_error\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0me\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 116\u001B[0;31m \u001B[0;32mraise\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 117\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_chain_end\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0moutputs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 118\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mprep_outputs\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0minputs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0moutputs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mreturn_only_outputs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001B[0m in \u001B[0;36m__call__\u001B[0;34m(self, inputs, return_only_outputs)\u001B[0m\n\u001B[1;32m 111\u001B[0m )\n\u001B[1;32m 112\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 113\u001B[0;31m \u001B[0moutputs\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_call\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0minputs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 114\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0;34m(\u001B[0m\u001B[0mKeyboardInterrupt\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mException\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 115\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_chain_error\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0me\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/agents/agent.py\u001B[0m in \u001B[0;36m_call\u001B[0;34m(self, inputs)\u001B[0m\n\u001B[1;32m 497\u001B[0m \u001B[0;31m# We now enter the agent loop (until it returns something).\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 498\u001B[0m \u001B[0;32mwhile\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_should_continue\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0miterations\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 499\u001B[0;31m next_step_output = self._take_next_step(\n\u001B[0m\u001B[1;32m 500\u001B[0m \u001B[0mname_to_tool_map\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mcolor_mapping\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0minputs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mintermediate_steps\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 501\u001B[0m )\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/agents/agent.py\u001B[0m in \u001B[0;36m_take_next_step\u001B[0;34m(self, name_to_tool_map, color_mapping, inputs, intermediate_steps)\u001B[0m\n\u001B[1;32m 421\u001B[0m \u001B[0mllm_prefix\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0;34m\"\"\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mreturn_direct\u001B[0m \u001B[0;32melse\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0magent\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mllm_prefix\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 422\u001B[0m \u001B[0;31m# We then call the tool on the tool input to get an observation\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 423\u001B[0;31m observation = tool.run(\n\u001B[0m\u001B[1;32m 424\u001B[0m \u001B[0moutput\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mtool_input\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 425\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/tools/base.py\u001B[0m in \u001B[0;36mrun\u001B[0;34m(self, tool_input, verbose, start_color, color, **kwargs)\u001B[0m\n\u001B[1;32m 69\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0;34m(\u001B[0m\u001B[0mException\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mKeyboardInterrupt\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 70\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_tool_error\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0me\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m---> 71\u001B[0;31m \u001B[0;32mraise\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 72\u001B[0m self.callback_manager.on_tool_end(\n\u001B[1;32m 73\u001B[0m \u001B[0mobservation\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mcolor\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mcolor\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/tools/base.py\u001B[0m in \u001B[0;36mrun\u001B[0;34m(self, tool_input, verbose, start_color, color, **kwargs)\u001B[0m\n\u001B[1;32m 66\u001B[0m )\n\u001B[1;32m 67\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m---> 68\u001B[0;31m \u001B[0mobservation\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_run\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mtool_input\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 69\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0;34m(\u001B[0m\u001B[0mException\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mKeyboardInterrupt\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 70\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_tool_error\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0me\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/tools/zapier/tool.py\u001B[0m in \u001B[0;36m_run\u001B[0;34m(self, instructions)\u001B[0m\n\u001B[1;32m 119\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0m_run\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0minstructions\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mstr\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m->\u001B[0m \u001B[0mstr\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 120\u001B[0m \u001B[0;34m\"\"\"Use the Zapier NLA tool to return a list of all exposed user actions.\"\"\"\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 121\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mapi_wrapper\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mrun_as_str\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0maction_id\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0minstructions\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mparams\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 122\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 123\u001B[0m \u001B[0;32masync\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0m_arun\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0m_\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mstr\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m->\u001B[0m \u001B[0mstr\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/utilities/zapier.py\u001B[0m in \u001B[0;36mrun_as_str\u001B[0;34m(self, *args, **kwargs)\u001B[0m\n\u001B[1;32m 140\u001B[0m \"\"\"Same as run, but returns a stringified version of the JSON for\n\u001B[1;32m 141\u001B[0m insertting back into an LLM.\"\"\"\n\u001B[0;32m--> 142\u001B[0;31m \u001B[0mdata\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mrun\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m*\u001B[0m\u001B[0margs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 143\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0mjson\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mdumps\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mdata\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 144\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/utilities/zapier.py\u001B[0m in \u001B[0;36mrun\u001B[0;34m(self, action_id, instructions, params)\u001B[0m\n\u001B[1;32m 119\u001B[0m \u001B[0msession\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_get_session\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 120\u001B[0m \u001B[0mrequest\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_get_action_request\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0maction_id\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0minstructions\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mparams\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 121\u001B[0;31m \u001B[0mresponse\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0msession\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0msend\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0msession\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mprepare_request\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mrequest\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 122\u001B[0m \u001B[0mresponse\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mraise_for_status\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 123\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0mresponse\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mjson\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0;34m\"result\"\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/requests/sessions.py\u001B[0m in \u001B[0;36msend\u001B[0;34m(self, request, **kwargs)\u001B[0m\n\u001B[1;32m 699\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 700\u001B[0m \u001B[0;31m# Send the request\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 701\u001B[0;31m \u001B[0mr\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0madapter\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0msend\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mrequest\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 702\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 703\u001B[0m \u001B[0;31m# Total elapsed time of the request (approximately)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/requests/adapters.py\u001B[0m in \u001B[0;36msend\u001B[0;34m(self, request, stream, timeout, verify, cert, proxies)\u001B[0m\n\u001B[1;32m 487\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 488\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0;32mnot\u001B[0m \u001B[0mchunked\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 489\u001B[0;31m resp = conn.urlopen(\n\u001B[0m\u001B[1;32m 490\u001B[0m \u001B[0mmethod\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mrequest\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mmethod\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 491\u001B[0m \u001B[0murl\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0murl\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/urllib3/connectionpool.py\u001B[0m in \u001B[0;36murlopen\u001B[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)\u001B[0m\n\u001B[1;32m 701\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 702\u001B[0m \u001B[0;31m# Make the request on the httplib connection object.\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 703\u001B[0;31m httplib_response = self._make_request(\n\u001B[0m\u001B[1;32m 704\u001B[0m \u001B[0mconn\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 705\u001B[0m \u001B[0mmethod\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/urllib3/connectionpool.py\u001B[0m in \u001B[0;36m_make_request\u001B[0;34m(self, conn, method, url, timeout, chunked, **httplib_request_kw)\u001B[0m\n\u001B[1;32m 447\u001B[0m \u001B[0;31m# Python 3 (including for exceptions like SystemExit).\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 448\u001B[0m \u001B[0;31m# Otherwise it looks like a bug in the code.\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 449\u001B[0;31m \u001B[0msix\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mraise_from\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0me\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;32mNone\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 450\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0;34m(\u001B[0m\u001B[0mSocketTimeout\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mBaseSSLError\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mSocketError\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 451\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_raise_timeout\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0merr\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0me\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0murl\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0murl\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mtimeout_value\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mread_timeout\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/urllib3/packages/six.py\u001B[0m in \u001B[0;36mraise_from\u001B[0;34m(value, from_value)\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/urllib3/connectionpool.py\u001B[0m in \u001B[0;36m_make_request\u001B[0;34m(self, conn, method, url, timeout, chunked, **httplib_request_kw)\u001B[0m\n\u001B[1;32m 442\u001B[0m \u001B[0;31m# Python 3\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 443\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 444\u001B[0;31m \u001B[0mhttplib_response\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mconn\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mgetresponse\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 445\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0mBaseException\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 446\u001B[0m \u001B[0;31m# Remove the TypeError from the exception chain in\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/http/client.py\u001B[0m in \u001B[0;36mgetresponse\u001B[0;34m(self)\u001B[0m\n\u001B[1;32m 1375\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 1376\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m-> 1377\u001B[0;31m \u001B[0mresponse\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mbegin\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 1378\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0mConnectionError\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 1379\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mclose\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/http/client.py\u001B[0m in \u001B[0;36mbegin\u001B[0;34m(self)\u001B[0m\n\u001B[1;32m 318\u001B[0m \u001B[0;31m# read until we get a non-100 response\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 319\u001B[0m \u001B[0;32mwhile\u001B[0m \u001B[0;32mTrue\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 320\u001B[0;31m \u001B[0mversion\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mstatus\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mreason\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_read_status\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 321\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mstatus\u001B[0m \u001B[0;34m!=\u001B[0m \u001B[0mCONTINUE\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 322\u001B[0m \u001B[0;32mbreak\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/http/client.py\u001B[0m in \u001B[0;36m_read_status\u001B[0;34m(self)\u001B[0m\n\u001B[1;32m 279\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 280\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0m_read_status\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 281\u001B[0;31m \u001B[0mline\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mstr\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mfp\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mreadline\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0m_MAXLINE\u001B[0m \u001B[0;34m+\u001B[0m \u001B[0;36m1\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m\"iso-8859-1\"\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 282\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mlen\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mline\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m>\u001B[0m \u001B[0m_MAXLINE\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 283\u001B[0m \u001B[0;32mraise\u001B[0m \u001B[0mLineTooLong\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m\"status line\"\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/socket.py\u001B[0m in \u001B[0;36mreadinto\u001B[0;34m(self, b)\u001B[0m\n\u001B[1;32m 702\u001B[0m \u001B[0;32mwhile\u001B[0m \u001B[0;32mTrue\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 703\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 704\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_sock\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mrecv_into\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mb\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 705\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0mtimeout\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 706\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_timeout_occurred\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0;32mTrue\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/ssl.py\u001B[0m in \u001B[0;36mrecv_into\u001B[0;34m(self, buffer, nbytes, flags)\u001B[0m\n\u001B[1;32m 1240\u001B[0m \u001B[0;34m\"non-zero flags not allowed in calls to recv_into() on %s\"\u001B[0m \u001B[0;34m%\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 1241\u001B[0m self.__class__)\n\u001B[0;32m-> 1242\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mread\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mnbytes\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mbuffer\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 1243\u001B[0m \u001B[0;32melse\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 1244\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0msuper\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mrecv_into\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mbuffer\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mnbytes\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mflags\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/ssl.py\u001B[0m in \u001B[0;36mread\u001B[0;34m(self, len, buffer)\u001B[0m\n\u001B[1;32m 1098\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 1099\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mbuffer\u001B[0m \u001B[0;32mis\u001B[0m \u001B[0;32mnot\u001B[0m \u001B[0;32mNone\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m-> 1100\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_sslobj\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mread\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mlen\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mbuffer\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 1101\u001B[0m \u001B[0;32melse\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 1102\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_sslobj\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mread\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mlen\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;31mKeyboardInterrupt\u001B[0m: " ] } ], diff --git a/bots/Twitter_Reply_Bot/Twitter Reply Bot Notebook.ipynb b/bots/Twitter_Reply_Bot/Twitter Reply Bot Notebook.ipynb index 370adc5..4c0359b 100644 --- a/bots/Twitter_Reply_Bot/Twitter Reply Bot Notebook.ipynb +++ b/bots/Twitter_Reply_Bot/Twitter Reply Bot Notebook.ipynb @@ -14,10 +14,10 @@ "from langchain.prompts import ChatPromptTemplate, PromptTemplate, SystemMessagePromptTemplate, AIMessagePromptTemplate, HumanMessagePromptTemplate\n", "import schedule\n", "import time\n", - "from dotenv import load_dotenv\n", "import os\n", + "from dotenv import find_dotenv, load_dotenv\n", "\n", - "load_dotenv()\n", + "load_dotenv(find_dotenv())\n", "\n", "# load your Twitter and Airtable API keys (preferably from environment variables or a config file)\n", "TWITTER_API_KEY = os.getenv(\"TWITTER_API_KEY\", \"YourKey\")\n", diff --git a/chains/Chain Types.ipynb b/chains/Chain Types.ipynb index 17568bb..f0aa14f 100644 --- a/chains/Chain Types.ipynb +++ b/chains/Chain Types.ipynb @@ -124,7 +124,10 @@ }, "outputs": [], "source": [ - "OPENAI_API_KEY = '...'" + "from dotenv import find_dotenv, load_dotenv\n", + "load_dotenv(find_dotenv())\n", + "\n", + "#OPENAI_API_KEY = '...'" ] }, { @@ -169,12 +172,12 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new StuffDocumentsChain chain...\u001b[0m\n", + "\u001B[1m> Entering new StuffDocumentsChain chain...\u001B[0m\n", "\n", "\n", - "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", + "\u001B[1m> Entering new LLMChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"The winter glory of the Sierra ! How little is known of it! Californians admire descriptions of the Swiss Alps, reading with breathless interest how ice and snow load their sublime heights, and booming avalanches sweep in glorious array through their crowded forests, while our own icy, snow-laden mountains, with their unrivaled forests, loom unnoticed along our eastern horizon. True, only mountaineers may penetrate their snow-blocked fastnesses to behold them in all their white wild grandeur, but to every healthy man and woman, and even to children, many of the subalpine valleys and lake-basins, six or seven thousand feet above the sea, remain invitingly open and approachable all winter. With a friend and his two little sons I have just returned from a week of bracing weathering around Lake Tahoe, in which we enjoyed glorious views of winter, fine rolling and sliding in the snow, swimming in the icy lake, and lusty reviving exercise on snow-shoes that kept our pulses dancing right merrily. All the weather was hearty and exhilarating, though varying almost from hour to hour: snowing, blowing, clear and cloudy, but never rigorously cold.\n", @@ -200,7 +203,7 @@ "We also spent some rare evenings by the huge fire in McKinney's old cabin. The log walls are covered with trophies of the chase, for our host has been a great hunter in his day. Two live pet coons were frolicking on the floor while our grand old host smiled benignly and played with them, the firelight gleaming on his weathered face. How big he seems, thus brought into relief, and what a shadow he casts! The fragrant rosiny fire is the very god of the home. No wonder the old nations, with their fresher instincts, had their fireside gods. At last, when a mild snow-storm was blowing, we rowed to the lower end of the lake and completed our excursion by slipping on snow-shoes down the Truckee canon to the railroad.\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n" + "CONCISE SUMMARY:\u001B[0m\n" ] }, { @@ -208,9 +211,9 @@ "output_type": "stream", "text": [ "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] }, { @@ -240,12 +243,12 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new StuffDocumentsChain chain...\u001b[0m\n", + "\u001B[1m> Entering new StuffDocumentsChain chain...\u001B[0m\n", "\n", "\n", - "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", + "\u001B[1m> Entering new LLMChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"February 2021Before college the two main things I worked on, outside of school,\n", @@ -2435,7 +2438,7 @@ "Taggar for reading drafts of this.\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n" + "CONCISE SUMMARY:\u001B[0m\n" ] }, { @@ -2443,37 +2446,37 @@ "evalue": "This model's maximum context length is 4097 tokens, however you requested 19068 tokens (18812 in your prompt; 256 for the completion). Please reduce your prompt; or completion length.", "output_type": "error", "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mInvalidRequestError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/var/folders/5c/csjfqsk97xz704h7v3fzjqph0000gn/T/ipykernel_4303/3610895313.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mchain\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlg_doc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 237\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 238\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"`run` supports only one positional argument.\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 239\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0moutput_keys\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 240\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 241\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mkwargs\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0margs\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, inputs, return_only_outputs)\u001b[0m\n\u001b[1;32m 140\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 141\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_chain_error\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 142\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 143\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_chain_end\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moutputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 144\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprep_outputs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moutputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreturn_only_outputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, inputs, return_only_outputs)\u001b[0m\n\u001b[1;32m 137\u001b[0m )\n\u001b[1;32m 138\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 139\u001b[0;31m \u001b[0moutputs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 140\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 141\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_chain_error\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/combine_documents/base.py\u001b[0m in \u001b[0;36m_call\u001b[0;34m(self, inputs)\u001b[0m\n\u001b[1;32m 54\u001b[0m \u001b[0;31m# Other keys are assumed to be needed for LLM prediction\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 55\u001b[0m \u001b[0mother_keys\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0mk\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mv\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mk\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mv\u001b[0m \u001b[0;32min\u001b[0m \u001b[0minputs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mk\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minput_key\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 56\u001b[0;31m \u001b[0moutput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mextra_return_dict\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcombine_docs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdocs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mother_keys\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 57\u001b[0m \u001b[0mextra_return_dict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0moutput_key\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 58\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mextra_return_dict\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/combine_documents/stuff.py\u001b[0m in \u001b[0;36mcombine_docs\u001b[0;34m(self, docs, **kwargs)\u001b[0m\n\u001b[1;32m 87\u001b[0m \u001b[0minputs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_inputs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdocs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 88\u001b[0m \u001b[0;31m# Call predict on the LLM.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 89\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mllm_chain\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpredict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 90\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 91\u001b[0m async def acombine_docs(\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/llm.py\u001b[0m in \u001b[0;36mpredict\u001b[0;34m(self, **kwargs)\u001b[0m\n\u001b[1;32m 151\u001b[0m \u001b[0mcompletion\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mllm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpredict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0madjective\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"funny\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 152\u001b[0m \"\"\"\n\u001b[0;32m--> 153\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0moutput_key\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 154\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 155\u001b[0m \u001b[0;32masync\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mapredict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mAny\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, inputs, return_only_outputs)\u001b[0m\n\u001b[1;32m 140\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 141\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_chain_error\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 142\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 143\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_chain_end\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moutputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 144\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprep_outputs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moutputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreturn_only_outputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, inputs, return_only_outputs)\u001b[0m\n\u001b[1;32m 137\u001b[0m )\n\u001b[1;32m 138\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 139\u001b[0;31m \u001b[0moutputs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 140\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 141\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_chain_error\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/llm.py\u001b[0m in \u001b[0;36m_call\u001b[0;34m(self, inputs)\u001b[0m\n\u001b[1;32m 132\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 133\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minputs\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mDict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mstr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mAny\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mDict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mstr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 134\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapply\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 135\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 136\u001b[0m \u001b[0;32masync\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_acall\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minputs\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mDict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mstr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mAny\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mDict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mstr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/llm.py\u001b[0m in \u001b[0;36mapply\u001b[0;34m(self, input_list)\u001b[0m\n\u001b[1;32m 115\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mapply\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minput_list\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mList\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mDict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mstr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mAny\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mList\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mDict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mstr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 116\u001b[0m \u001b[0;34m\"\"\"Utilize the LLM generate method for speed gains.\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 117\u001b[0;31m \u001b[0mresponse\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgenerate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput_list\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 118\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcreate_outputs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresponse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 119\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/llm.py\u001b[0m in \u001b[0;36mgenerate\u001b[0;34m(self, input_list)\u001b[0m\n\u001b[1;32m 57\u001b[0m \u001b[0;34m\"\"\"Generate LLM result from inputs.\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 58\u001b[0m \u001b[0mprompts\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstop\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprep_prompts\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput_list\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 59\u001b[0;31m \u001b[0mresponse\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mllm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgenerate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprompts\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstop\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mstop\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 60\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mresponse\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/base.py\u001b[0m in \u001b[0;36mgenerate\u001b[0;34m(self, prompts, stop)\u001b[0m\n\u001b[1;32m 126\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 127\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_llm_error\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 128\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 129\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_llm_end\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moutput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 130\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/base.py\u001b[0m in \u001b[0;36mgenerate\u001b[0;34m(self, prompts, stop)\u001b[0m\n\u001b[1;32m 123\u001b[0m )\n\u001b[1;32m 124\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 125\u001b[0;31m \u001b[0moutput\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_generate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprompts\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstop\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mstop\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 126\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 127\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_llm_error\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/openai.py\u001b[0m in \u001b[0;36m_generate\u001b[0;34m(self, prompts, stop)\u001b[0m\n\u001b[1;32m 257\u001b[0m \u001b[0mchoices\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mextend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresponse\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"choices\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 258\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 259\u001b[0;31m \u001b[0mresponse\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcompletion_with_retry\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprompt\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0m_prompts\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mparams\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 260\u001b[0m \u001b[0mchoices\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mextend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresponse\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"choices\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 261\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstreaming\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/openai.py\u001b[0m in \u001b[0;36mcompletion_with_retry\u001b[0;34m(self, **kwargs)\u001b[0m\n\u001b[1;32m 204\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclient\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcreate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 206\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0m_completion_with_retry\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 207\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 208\u001b[0m \u001b[0;32masync\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0macompletion_with_retry\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mAny\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mAny\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/tenacity/__init__.py\u001b[0m in \u001b[0;36mwrapped_f\u001b[0;34m(*args, **kw)\u001b[0m\n\u001b[1;32m 287\u001b[0m \u001b[0;34m@\u001b[0m\u001b[0mfunctools\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwraps\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 288\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mwrapped_f\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mAny\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mAny\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mAny\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 289\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 290\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 291\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mretry_with\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mAny\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mAny\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mWrappedFn\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/tenacity/__init__.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, fn, *args, **kwargs)\u001b[0m\n\u001b[1;32m 377\u001b[0m \u001b[0mretry_state\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mRetryCallState\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mretry_object\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfn\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfn\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0margs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 378\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 379\u001b[0;31m \u001b[0mdo\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0miter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mretry_state\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mretry_state\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 380\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdo\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mDoAttempt\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 381\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/tenacity/__init__.py\u001b[0m in \u001b[0;36miter\u001b[0;34m(self, retry_state)\u001b[0m\n\u001b[1;32m 312\u001b[0m \u001b[0mis_explicit_retry\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfut\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfailed\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfut\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexception\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mTryAgain\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 313\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mis_explicit_retry\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mretry\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mretry_state\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 314\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfut\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mresult\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 315\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 316\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mafter\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/concurrent/futures/_base.py\u001b[0m in \u001b[0;36mresult\u001b[0;34m(self, timeout)\u001b[0m\n\u001b[1;32m 437\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mCancelledError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 438\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_state\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mFINISHED\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 439\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__get_result\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 440\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 441\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_condition\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwait\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/concurrent/futures/_base.py\u001b[0m in \u001b[0;36m__get_result\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 389\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_exception\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 390\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 391\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_exception\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 392\u001b[0m \u001b[0;32mfinally\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 393\u001b[0m \u001b[0;31m# Break a reference cycle with the exception in self._exception\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/tenacity/__init__.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, fn, *args, **kwargs)\u001b[0m\n\u001b[1;32m 380\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdo\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mDoAttempt\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 381\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 382\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 383\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mBaseException\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# noqa: B902\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 384\u001b[0m \u001b[0mretry_state\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mset_exception\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msys\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexc_info\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# type: ignore[arg-type]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/openai.py\u001b[0m in \u001b[0;36m_completion_with_retry\u001b[0;34m(**kwargs)\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;34m@\u001b[0m\u001b[0mretry_decorator\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 203\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_completion_with_retry\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mAny\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mAny\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 204\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclient\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcreate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 205\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 206\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0m_completion_with_retry\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_resources/completion.py\u001b[0m in \u001b[0;36mcreate\u001b[0;34m(cls, *args, **kwargs)\u001b[0m\n\u001b[1;32m 23\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 24\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 25\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcreate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 26\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mTryAgain\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 27\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mtimeout\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mtime\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtime\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m>\u001b[0m \u001b[0mstart\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_resources/abstract/engine_api_resource.py\u001b[0m in \u001b[0;36mcreate\u001b[0;34m(cls, api_key, api_base, api_type, request_id, api_version, organization, **params)\u001b[0m\n\u001b[1;32m 151\u001b[0m )\n\u001b[1;32m 152\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 153\u001b[0;31m response, _, api_key = requestor.request(\n\u001b[0m\u001b[1;32m 154\u001b[0m \u001b[0;34m\"post\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 155\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_requestor.py\u001b[0m in \u001b[0;36mrequest\u001b[0;34m(self, method, url, params, headers, files, stream, request_id, request_timeout)\u001b[0m\n\u001b[1;32m 225\u001b[0m \u001b[0mrequest_timeout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mrequest_timeout\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 226\u001b[0m )\n\u001b[0;32m--> 227\u001b[0;31m \u001b[0mresp\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mgot_stream\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_interpret_response\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresult\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstream\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 228\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mresp\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mgot_stream\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapi_key\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 229\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_requestor.py\u001b[0m in \u001b[0;36m_interpret_response\u001b[0;34m(self, result, stream)\u001b[0m\n\u001b[1;32m 618\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 619\u001b[0m return (\n\u001b[0;32m--> 620\u001b[0;31m self._interpret_response_line(\n\u001b[0m\u001b[1;32m 621\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcontent\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdecode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"utf-8\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 622\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatus_code\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_requestor.py\u001b[0m in \u001b[0;36m_interpret_response_line\u001b[0;34m(self, rbody, rcode, rheaders, stream)\u001b[0m\n\u001b[1;32m 678\u001b[0m \u001b[0mstream_error\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstream\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;34m\"error\"\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mresp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 679\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mstream_error\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;36m200\u001b[0m \u001b[0;34m<=\u001b[0m \u001b[0mrcode\u001b[0m \u001b[0;34m<\u001b[0m \u001b[0;36m300\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 680\u001b[0;31m raise self.handle_error_response(\n\u001b[0m\u001b[1;32m 681\u001b[0m \u001b[0mrbody\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrcode\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mresp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrheaders\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstream_error\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mstream_error\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 682\u001b[0m )\n", - "\u001b[0;31mInvalidRequestError\u001b[0m: This model's maximum context length is 4097 tokens, however you requested 19068 tokens (18812 in your prompt; 256 for the completion). Please reduce your prompt; or completion length." + "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m", + "\u001B[0;31mInvalidRequestError\u001B[0m Traceback (most recent call last)", + "\u001B[0;32m/var/folders/5c/csjfqsk97xz704h7v3fzjqph0000gn/T/ipykernel_4303/3610895313.py\u001B[0m in \u001B[0;36m\u001B[0;34m\u001B[0m\n\u001B[0;32m----> 1\u001B[0;31m \u001B[0mchain\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mrun\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mlg_doc\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001B[0m in \u001B[0;36mrun\u001B[0;34m(self, *args, **kwargs)\u001B[0m\n\u001B[1;32m 237\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mlen\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0margs\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m!=\u001B[0m \u001B[0;36m1\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 238\u001B[0m \u001B[0;32mraise\u001B[0m \u001B[0mValueError\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m\"`run` supports only one positional argument.\"\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 239\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0margs\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0;36m0\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0moutput_keys\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0;36m0\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 240\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 241\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mkwargs\u001B[0m \u001B[0;32mand\u001B[0m \u001B[0;32mnot\u001B[0m \u001B[0margs\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001B[0m in \u001B[0;36m__call__\u001B[0;34m(self, inputs, return_only_outputs)\u001B[0m\n\u001B[1;32m 140\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0;34m(\u001B[0m\u001B[0mKeyboardInterrupt\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mException\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 141\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_chain_error\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0me\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 142\u001B[0;31m \u001B[0;32mraise\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 143\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_chain_end\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0moutputs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 144\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mprep_outputs\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0minputs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0moutputs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mreturn_only_outputs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001B[0m in \u001B[0;36m__call__\u001B[0;34m(self, inputs, return_only_outputs)\u001B[0m\n\u001B[1;32m 137\u001B[0m )\n\u001B[1;32m 138\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 139\u001B[0;31m \u001B[0moutputs\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_call\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0minputs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 140\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0;34m(\u001B[0m\u001B[0mKeyboardInterrupt\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mException\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 141\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_chain_error\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0me\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/combine_documents/base.py\u001B[0m in \u001B[0;36m_call\u001B[0;34m(self, inputs)\u001B[0m\n\u001B[1;32m 54\u001B[0m \u001B[0;31m# Other keys are assumed to be needed for LLM prediction\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 55\u001B[0m \u001B[0mother_keys\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0;34m{\u001B[0m\u001B[0mk\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mv\u001B[0m \u001B[0;32mfor\u001B[0m \u001B[0mk\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mv\u001B[0m \u001B[0;32min\u001B[0m \u001B[0minputs\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mitems\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mk\u001B[0m \u001B[0;34m!=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0minput_key\u001B[0m\u001B[0;34m}\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m---> 56\u001B[0;31m \u001B[0moutput\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mextra_return_dict\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcombine_docs\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mdocs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mother_keys\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 57\u001B[0m \u001B[0mextra_return_dict\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0moutput_key\u001B[0m\u001B[0;34m]\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0moutput\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 58\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0mextra_return_dict\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/combine_documents/stuff.py\u001B[0m in \u001B[0;36mcombine_docs\u001B[0;34m(self, docs, **kwargs)\u001B[0m\n\u001B[1;32m 87\u001B[0m \u001B[0minputs\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_get_inputs\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mdocs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 88\u001B[0m \u001B[0;31m# Call predict on the LLM.\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m---> 89\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mllm_chain\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mpredict\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m**\u001B[0m\u001B[0minputs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m{\u001B[0m\u001B[0;34m}\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 90\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 91\u001B[0m async def acombine_docs(\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/llm.py\u001B[0m in \u001B[0;36mpredict\u001B[0;34m(self, **kwargs)\u001B[0m\n\u001B[1;32m 151\u001B[0m \u001B[0mcompletion\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mllm\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mpredict\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0madjective\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0;34m\"funny\"\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 152\u001B[0m \"\"\"\n\u001B[0;32m--> 153\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0moutput_key\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 154\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 155\u001B[0m \u001B[0;32masync\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0mapredict\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mAny\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m->\u001B[0m \u001B[0mstr\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001B[0m in \u001B[0;36m__call__\u001B[0;34m(self, inputs, return_only_outputs)\u001B[0m\n\u001B[1;32m 140\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0;34m(\u001B[0m\u001B[0mKeyboardInterrupt\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mException\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 141\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_chain_error\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0me\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 142\u001B[0;31m \u001B[0;32mraise\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 143\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_chain_end\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0moutputs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 144\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mprep_outputs\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0minputs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0moutputs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mreturn_only_outputs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001B[0m in \u001B[0;36m__call__\u001B[0;34m(self, inputs, return_only_outputs)\u001B[0m\n\u001B[1;32m 137\u001B[0m )\n\u001B[1;32m 138\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 139\u001B[0;31m \u001B[0moutputs\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_call\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0minputs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 140\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0;34m(\u001B[0m\u001B[0mKeyboardInterrupt\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mException\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 141\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_chain_error\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0me\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/llm.py\u001B[0m in \u001B[0;36m_call\u001B[0;34m(self, inputs)\u001B[0m\n\u001B[1;32m 132\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 133\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0m_call\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0minputs\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mDict\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mstr\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mAny\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m->\u001B[0m \u001B[0mDict\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mstr\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mstr\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 134\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mapply\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0minputs\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0;36m0\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 135\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 136\u001B[0m \u001B[0;32masync\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0m_acall\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0minputs\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mDict\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mstr\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mAny\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m->\u001B[0m \u001B[0mDict\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mstr\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mstr\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/llm.py\u001B[0m in \u001B[0;36mapply\u001B[0;34m(self, input_list)\u001B[0m\n\u001B[1;32m 115\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0mapply\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0minput_list\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mList\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mDict\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mstr\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mAny\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m->\u001B[0m \u001B[0mList\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mDict\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mstr\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mstr\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 116\u001B[0m \u001B[0;34m\"\"\"Utilize the LLM generate method for speed gains.\"\"\"\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 117\u001B[0;31m \u001B[0mresponse\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mgenerate\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0minput_list\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 118\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcreate_outputs\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mresponse\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 119\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/llm.py\u001B[0m in \u001B[0;36mgenerate\u001B[0;34m(self, input_list)\u001B[0m\n\u001B[1;32m 57\u001B[0m \u001B[0;34m\"\"\"Generate LLM result from inputs.\"\"\"\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 58\u001B[0m \u001B[0mprompts\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mstop\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mprep_prompts\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0minput_list\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m---> 59\u001B[0;31m \u001B[0mresponse\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mllm\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mgenerate\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mprompts\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mstop\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mstop\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 60\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0mresponse\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 61\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/base.py\u001B[0m in \u001B[0;36mgenerate\u001B[0;34m(self, prompts, stop)\u001B[0m\n\u001B[1;32m 126\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0;34m(\u001B[0m\u001B[0mKeyboardInterrupt\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mException\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 127\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_llm_error\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0me\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 128\u001B[0;31m \u001B[0;32mraise\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 129\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_llm_end\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0moutput\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 130\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0moutput\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/base.py\u001B[0m in \u001B[0;36mgenerate\u001B[0;34m(self, prompts, stop)\u001B[0m\n\u001B[1;32m 123\u001B[0m )\n\u001B[1;32m 124\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 125\u001B[0;31m \u001B[0moutput\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_generate\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mprompts\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mstop\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mstop\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 126\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0;34m(\u001B[0m\u001B[0mKeyboardInterrupt\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mException\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 127\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_llm_error\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0me\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/openai.py\u001B[0m in \u001B[0;36m_generate\u001B[0;34m(self, prompts, stop)\u001B[0m\n\u001B[1;32m 257\u001B[0m \u001B[0mchoices\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mextend\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mresponse\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0;34m\"choices\"\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 258\u001B[0m \u001B[0;32melse\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 259\u001B[0;31m \u001B[0mresponse\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcompletion_with_retry\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mprompt\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0m_prompts\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mparams\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 260\u001B[0m \u001B[0mchoices\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mextend\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mresponse\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0;34m\"choices\"\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 261\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0;32mnot\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mstreaming\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/openai.py\u001B[0m in \u001B[0;36mcompletion_with_retry\u001B[0;34m(self, **kwargs)\u001B[0m\n\u001B[1;32m 204\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mclient\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcreate\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 205\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 206\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0m_completion_with_retry\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 207\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 208\u001B[0m \u001B[0;32masync\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0macompletion_with_retry\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mAny\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m->\u001B[0m \u001B[0mAny\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/tenacity/__init__.py\u001B[0m in \u001B[0;36mwrapped_f\u001B[0;34m(*args, **kw)\u001B[0m\n\u001B[1;32m 287\u001B[0m \u001B[0;34m@\u001B[0m\u001B[0mfunctools\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mwraps\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mf\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 288\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0mwrapped_f\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m*\u001B[0m\u001B[0margs\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mt\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mAny\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mkw\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mt\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mAny\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m->\u001B[0m \u001B[0mt\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mAny\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 289\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mf\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m*\u001B[0m\u001B[0margs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mkw\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 290\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 291\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0mretry_with\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m*\u001B[0m\u001B[0margs\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mt\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mAny\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mt\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mAny\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m->\u001B[0m \u001B[0mWrappedFn\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/tenacity/__init__.py\u001B[0m in \u001B[0;36m__call__\u001B[0;34m(self, fn, *args, **kwargs)\u001B[0m\n\u001B[1;32m 377\u001B[0m \u001B[0mretry_state\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mRetryCallState\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mretry_object\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mfn\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mfn\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0margs\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0margs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mkwargs\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 378\u001B[0m \u001B[0;32mwhile\u001B[0m \u001B[0;32mTrue\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 379\u001B[0;31m \u001B[0mdo\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0miter\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mretry_state\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mretry_state\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 380\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0misinstance\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mdo\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mDoAttempt\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 381\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/tenacity/__init__.py\u001B[0m in \u001B[0;36miter\u001B[0;34m(self, retry_state)\u001B[0m\n\u001B[1;32m 312\u001B[0m \u001B[0mis_explicit_retry\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mfut\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mfailed\u001B[0m \u001B[0;32mand\u001B[0m \u001B[0misinstance\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mfut\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mexception\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mTryAgain\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 313\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0;32mnot\u001B[0m \u001B[0;34m(\u001B[0m\u001B[0mis_explicit_retry\u001B[0m \u001B[0;32mor\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mretry\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mretry_state\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 314\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mfut\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mresult\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 315\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 316\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mafter\u001B[0m \u001B[0;32mis\u001B[0m \u001B[0;32mnot\u001B[0m \u001B[0;32mNone\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/concurrent/futures/_base.py\u001B[0m in \u001B[0;36mresult\u001B[0;34m(self, timeout)\u001B[0m\n\u001B[1;32m 437\u001B[0m \u001B[0;32mraise\u001B[0m \u001B[0mCancelledError\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 438\u001B[0m \u001B[0;32melif\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_state\u001B[0m \u001B[0;34m==\u001B[0m \u001B[0mFINISHED\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 439\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m__get_result\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 440\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 441\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_condition\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mwait\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mtimeout\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/concurrent/futures/_base.py\u001B[0m in \u001B[0;36m__get_result\u001B[0;34m(self)\u001B[0m\n\u001B[1;32m 389\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_exception\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 390\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 391\u001B[0;31m \u001B[0;32mraise\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_exception\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 392\u001B[0m \u001B[0;32mfinally\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 393\u001B[0m \u001B[0;31m# Break a reference cycle with the exception in self._exception\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/tenacity/__init__.py\u001B[0m in \u001B[0;36m__call__\u001B[0;34m(self, fn, *args, **kwargs)\u001B[0m\n\u001B[1;32m 380\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0misinstance\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mdo\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mDoAttempt\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 381\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 382\u001B[0;31m \u001B[0mresult\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mfn\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m*\u001B[0m\u001B[0margs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 383\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0mBaseException\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0;31m# noqa: B902\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 384\u001B[0m \u001B[0mretry_state\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mset_exception\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0msys\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mexc_info\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;31m# type: ignore[arg-type]\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/openai.py\u001B[0m in \u001B[0;36m_completion_with_retry\u001B[0;34m(**kwargs)\u001B[0m\n\u001B[1;32m 202\u001B[0m \u001B[0;34m@\u001B[0m\u001B[0mretry_decorator\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 203\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0m_completion_with_retry\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mAny\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m->\u001B[0m \u001B[0mAny\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 204\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mclient\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcreate\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 205\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 206\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0m_completion_with_retry\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_resources/completion.py\u001B[0m in \u001B[0;36mcreate\u001B[0;34m(cls, *args, **kwargs)\u001B[0m\n\u001B[1;32m 23\u001B[0m \u001B[0;32mwhile\u001B[0m \u001B[0;32mTrue\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 24\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m---> 25\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0msuper\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcreate\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m*\u001B[0m\u001B[0margs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 26\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0mTryAgain\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 27\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mtimeout\u001B[0m \u001B[0;32mis\u001B[0m \u001B[0;32mnot\u001B[0m \u001B[0;32mNone\u001B[0m \u001B[0;32mand\u001B[0m \u001B[0mtime\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mtime\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m>\u001B[0m \u001B[0mstart\u001B[0m \u001B[0;34m+\u001B[0m \u001B[0mtimeout\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_resources/abstract/engine_api_resource.py\u001B[0m in \u001B[0;36mcreate\u001B[0;34m(cls, api_key, api_base, api_type, request_id, api_version, organization, **params)\u001B[0m\n\u001B[1;32m 151\u001B[0m )\n\u001B[1;32m 152\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 153\u001B[0;31m response, _, api_key = requestor.request(\n\u001B[0m\u001B[1;32m 154\u001B[0m \u001B[0;34m\"post\"\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 155\u001B[0m \u001B[0murl\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_requestor.py\u001B[0m in \u001B[0;36mrequest\u001B[0;34m(self, method, url, params, headers, files, stream, request_id, request_timeout)\u001B[0m\n\u001B[1;32m 225\u001B[0m \u001B[0mrequest_timeout\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mrequest_timeout\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 226\u001B[0m )\n\u001B[0;32m--> 227\u001B[0;31m \u001B[0mresp\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mgot_stream\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_interpret_response\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mresult\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mstream\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 228\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0mresp\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mgot_stream\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mapi_key\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 229\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_requestor.py\u001B[0m in \u001B[0;36m_interpret_response\u001B[0;34m(self, result, stream)\u001B[0m\n\u001B[1;32m 618\u001B[0m \u001B[0;32melse\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 619\u001B[0m return (\n\u001B[0;32m--> 620\u001B[0;31m self._interpret_response_line(\n\u001B[0m\u001B[1;32m 621\u001B[0m \u001B[0mresult\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcontent\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mdecode\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m\"utf-8\"\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 622\u001B[0m \u001B[0mresult\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mstatus_code\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_requestor.py\u001B[0m in \u001B[0;36m_interpret_response_line\u001B[0;34m(self, rbody, rcode, rheaders, stream)\u001B[0m\n\u001B[1;32m 678\u001B[0m \u001B[0mstream_error\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mstream\u001B[0m \u001B[0;32mand\u001B[0m \u001B[0;34m\"error\"\u001B[0m \u001B[0;32min\u001B[0m \u001B[0mresp\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mdata\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 679\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mstream_error\u001B[0m \u001B[0;32mor\u001B[0m \u001B[0;32mnot\u001B[0m \u001B[0;36m200\u001B[0m \u001B[0;34m<=\u001B[0m \u001B[0mrcode\u001B[0m \u001B[0;34m<\u001B[0m \u001B[0;36m300\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 680\u001B[0;31m raise self.handle_error_response(\n\u001B[0m\u001B[1;32m 681\u001B[0m \u001B[0mrbody\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mrcode\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mresp\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mdata\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mrheaders\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mstream_error\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mstream_error\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 682\u001B[0m )\n", + "\u001B[0;31mInvalidRequestError\u001B[0m: This model's maximum context length is 4097 tokens, however you requested 19068 tokens (18812 in your prompt; 256 for the completion). Please reduce your prompt; or completion length." ] } ], @@ -2511,9 +2514,9 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new MapReduceDocumentsChain chain...\u001b[0m\n", + "\u001B[1m> Entering new MapReduceDocumentsChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"The winter glory of the Sierra ! How little is known of it! Californians admire descriptions of the Swiss Alps, reading with breathless interest how ice and snow load their sublime heights, and booming avalanches sweep in glorious array through their crowded forests, while our own icy, snow-laden mountains, with their unrivaled forests, loom unnoticed along our eastern horizon. True, only mountaineers may penetrate their snow-blocked fastnesses to behold them in all their white wild grandeur, but to every healthy man and woman, and even to children, many of the subalpine valleys and lake-basins, six or seven thousand feet above the sea, remain invitingly open and approachable all winter. With a friend and his two little sons I have just returned from a week of bracing weathering around Lake Tahoe, in which we enjoyed glorious views of winter, fine rolling and sliding in the snow, swimming in the icy lake, and lusty reviving exercise on snow-shoes that kept our pulses dancing right merrily. All the weather was hearty and exhilarating, though varying almost from hour to hour: snowing, blowing, clear and cloudy, but never rigorously cold.\n", @@ -2539,7 +2542,7 @@ "We also spent some rare evenings by the huge fire in McKinney's old cabin. The log walls are covered with trophies of the chase, for our host has been a great hunter in his day. Two live pet coons were frolicking on the floor while our grand old host smiled benignly and played with them, the firelight gleaming on his weathered face. How big he seems, thus brought into relief, and what a shadow he casts! The fragrant rosiny fire is the very god of the home. No wonder the old nations, with their fresher instincts, had their fireside gods. At last, when a mild snow-storm was blowing, we rowed to the lower end of the lake and completed our excursion by slipping on snow-shoes down the Truckee canon to the railroad.\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n" + "CONCISE SUMMARY:\u001B[0m\n" ] }, { @@ -2548,19 +2551,19 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", + "\u001B[1m> Entering new LLMChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\" This article is an account of a winter excursion to Lake Tahoe in California, where the snowfall this season has been recorded at 22 feet and 4 inches. Despite the deep snow around the lake, the mild winter has kept temperatures above freezing. The post-glacial changes to the lake are minimal and the surrounding forests are still mostly intact, though logging has begun in earnest, with a contract for 96,000,000 feet of lumber and 60,000 cords of wood this season. The author recounts their adventures, including rowing, bathing, snow shoeing, and visits to old cabins. They ended the trip by snowshoeing down the Truckee canon to the railroad.\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] }, { @@ -2648,9 +2651,9 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new MapReduceDocumentsChain chain...\u001b[0m\n", + "\u001B[1m> Entering new MapReduceDocumentsChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"February 2021Before college the two main things I worked on, outside of school,\n", @@ -2664,9 +2667,9 @@ "just characters with strong feelings, which I imagined made them\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"deep.The first programs I tried writing were on the IBM 1401 that our\n", @@ -2682,9 +2685,9 @@ "a mini Bond villain's lair down there, with all these alien-looking\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"machines — CPU, disk drives, printer, card reader — sitting up\n", @@ -2698,9 +2701,9 @@ "result would ordinarily be to print something on the spectacularly\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"loud printer.I was puzzled by the 1401. I couldn't figure out what to do with\n", @@ -2714,9 +2717,9 @@ "option was to do things that didn't rely on any input, like calculate\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"approximations of pi, but I didn't know enough math to do anything\n", @@ -2732,12 +2735,12 @@ "time-sharing, this was a social as well as a technical error, as\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "\n", "\n", - "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", + "\u001B[1m> Entering new LLMChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"\n", @@ -2753,11 +2756,11 @@ " This person remembers the moment they learned that programs can not terminate and the moment of surprise when one of their programs didn't terminate. They also remember attempting to approximate pi with math, but they were not successful in doing anything interesting with it.\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] }, { @@ -2805,12 +2808,12 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new RefineDocumentsChain chain...\u001b[0m\n", + "\u001B[1m> Entering new RefineDocumentsChain chain...\u001B[0m\n", "\n", "\n", - "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", + "\u001B[1m> Entering new LLMChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"February 2021Before college the two main things I worked on, outside of school,\n", @@ -2824,14 +2827,14 @@ "just characters with strong feelings, which I imagined made them\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", "\n", - "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", + "\u001B[1m> Entering new LLMChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mYour job is to produce a final summary\n", + "\u001B[32;1m\u001B[1;3mYour job is to produce a final summary\n", "We have provided an existing summary up to a certain point: Prior to college, the author practiced writing and programming in their spare time. The author wrote short stories that lacked plot, but the characters did have strong emotions.\n", "We have the opportunity to refine the existing summary(only if needed) with some more context below.\n", "------------\n", @@ -2847,14 +2850,14 @@ "\n", "a mini Bond villain's lair down there, with all these alien-looking\n", "------------\n", - "Given the new context, refine the original summaryIf the context isn't useful, return the original summary.\u001b[0m\n", + "Given the new context, refine the original summaryIf the context isn't useful, return the original summary.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", "\n", - "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", + "\u001B[1m> Entering new LLMChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mYour job is to produce a final summary\n", + "\u001B[32;1m\u001B[1;3mYour job is to produce a final summary\n", "We have provided an existing summary up to a certain point: \n", "\n", "Prior to college, the author practiced writing and programming in their spare time. The author wrote short stories that lacked plot, but the characters did have strong emotions. In 9th grade, the author and a friend got permission to use an IBM 1401 in the basement of their junior high school for data processing. This experience exposed the author to programming and helped to develop their skills.\n", @@ -2870,14 +2873,14 @@ "\n", "result would ordinarily be to print something on the spectacularly\n", "------------\n", - "Given the new context, refine the original summaryIf the context isn't useful, return the original summary.\u001b[0m\n", + "Given the new context, refine the original summaryIf the context isn't useful, return the original summary.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", "\n", - "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", + "\u001B[1m> Entering new LLMChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mYour job is to produce a final summary\n", + "\u001B[32;1m\u001B[1;3mYour job is to produce a final summary\n", "We have provided an existing summary up to a certain point: \n", "\n", "Prior to college, the author practiced writing and programming in their spare time. The author wrote short stories that lacked plot, but the characters did have strong emotions. In 9th grade, the author and a friend got permission to use an IBM 1401 in the basement of their junior high school for data processing. This experience exposed the author to programming and helped to develop their skills, using an early version of Fortran on machines such as CPU, disk drives, printer, card reader, and printing the results on the printer.\n", @@ -2893,14 +2896,14 @@ "\n", "option was to do things that didn't rely on any input, like calculate\n", "------------\n", - "Given the new context, refine the original summaryIf the context isn't useful, return the original summary.\u001b[0m\n", + "Given the new context, refine the original summaryIf the context isn't useful, return the original summary.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", "\n", - "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", + "\u001B[1m> Entering new LLMChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mYour job is to produce a final summary\n", + "\u001B[32;1m\u001B[1;3mYour job is to produce a final summary\n", "We have provided an existing summary up to a certain point: \n", "\n", "Prior to college, the author practiced writing and programming in their spare time. The author wrote short stories that lacked plot, but the characters did have strong emotions. In 9th grade, the author and a friend got permission to use an IBM 1401 in the basement of their junior high school for data processing. This experience exposed the author to programming and helped to develop their skills, using an early version of Fortran on machines such as CPU, disk drives, printer, card reader, and printing the results on the printer. The author was initially puzzled by the 1401, as the only form of input to programs was data stored on punched cards, and they had no data stored on punched cards. As a result, the author had to do things that didn't rely on any input, like calculate, in order to use the machine.\n", @@ -2918,11 +2921,11 @@ "\n", "time-sharing, this was a social as well as a technical error, as\n", "------------\n", - "Given the new context, refine the original summaryIf the context isn't useful, return the original summary.\u001b[0m\n", + "Given the new context, refine the original summaryIf the context isn't useful, return the original summary.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] }, { @@ -2970,9 +2973,9 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new MapRerankDocumentsChain chain...\u001b[0m\n", + "\u001B[1m> Entering new MapRerankDocumentsChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mUse the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.\n", + "\u001B[32;1m\u001B[1;3mUse the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.\n", "\n", "In addition to giving an answer, also return a score of how fully it answered the user's question. This should be in the following format:\n", "\n", @@ -3031,9 +3034,9 @@ "just characters with strong feelings, which I imagined made them\n", "---------\n", "Question: Who was the authors friend who he got permission from to use the IBM 1401?\n", - "Helpful Answer:\u001b[0m\n", + "Helpful Answer:\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mUse the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.\n", + "\u001B[32;1m\u001B[1;3mUse the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.\n", "\n", "In addition to giving an answer, also return a score of how fully it answered the user's question. This should be in the following format:\n", "\n", @@ -3094,9 +3097,9 @@ "a mini Bond villain's lair down there, with all these alien-looking\n", "---------\n", "Question: Who was the authors friend who he got permission from to use the IBM 1401?\n", - "Helpful Answer:\u001b[0m\n", + "Helpful Answer:\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mUse the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.\n", + "\u001B[32;1m\u001B[1;3mUse the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.\n", "\n", "In addition to giving an answer, also return a score of how fully it answered the user's question. This should be in the following format:\n", "\n", @@ -3155,9 +3158,9 @@ "result would ordinarily be to print something on the spectacularly\n", "---------\n", "Question: Who was the authors friend who he got permission from to use the IBM 1401?\n", - "Helpful Answer:\u001b[0m\n", + "Helpful Answer:\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mUse the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.\n", + "\u001B[32;1m\u001B[1;3mUse the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.\n", "\n", "In addition to giving an answer, also return a score of how fully it answered the user's question. This should be in the following format:\n", "\n", @@ -3216,9 +3219,9 @@ "option was to do things that didn't rely on any input, like calculate\n", "---------\n", "Question: Who was the authors friend who he got permission from to use the IBM 1401?\n", - "Helpful Answer:\u001b[0m\n", + "Helpful Answer:\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mUse the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.\n", + "\u001B[32;1m\u001B[1;3mUse the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.\n", "\n", "In addition to giving an answer, also return a score of how fully it answered the user's question. This should be in the following format:\n", "\n", @@ -3279,7 +3282,7 @@ "time-sharing, this was a social as well as a technical error, as\n", "---------\n", "Question: Who was the authors friend who he got permission from to use the IBM 1401?\n", - "Helpful Answer:\u001b[0m\n" + "Helpful Answer:\u001B[0m\n" ] }, { @@ -3287,7 +3290,7 @@ "output_type": "stream", "text": [ "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] } ], diff --git a/chatapi/ChatAPI + LangChain Basics.ipynb b/chatapi/ChatAPI + LangChain Basics.ipynb index bd5f35a..61330fb 100644 --- a/chatapi/ChatAPI + LangChain Basics.ipynb +++ b/chatapi/ChatAPI + LangChain Basics.ipynb @@ -40,7 +40,10 @@ }, "outputs": [], "source": [ - "OPENAI_API_KEY = '...'" + "from dotenv import find_dotenv, load_dotenv\n", + "load_dotenv(find_dotenv())\n", + "\n", + "#OPENAI_API_KEY = '...'" ] }, { diff --git a/data_generation/5 Levels Of Summarization - Novice To Expert.ipynb b/data_generation/5 Levels Of Summarization - Novice To Expert.ipynb index 0ad6cdc..06484b9 100644 --- a/data_generation/5 Levels Of Summarization - Novice To Expert.ipynb +++ b/data_generation/5 Levels Of Summarization - Novice To Expert.ipynb @@ -36,7 +36,10 @@ "metadata": {}, "outputs": [], "source": [ - "openai_api_key = 'YourAPIKey'" + "from dotenv import find_dotenv, load_dotenv\n", + "load_dotenv(find_dotenv())\n", + "\n", + "#openai_api_key = 'YourAPIKey'" ] }, { @@ -1353,11 +1356,11 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n", - "\u001b[32;1m\u001b[1;3mI need to find information about Napoleon Bonaparte and then about Serena Williams to identify commonalities between them.\n", + "\u001B[1m> Entering new AgentExecutor chain...\u001B[0m\n", + "\u001B[32;1m\u001B[1;3mI need to find information about Napoleon Bonaparte and then about Serena Williams to identify commonalities between them.\n", "Action: Wikipedia\n", - "Action Input: Napoleon Bonaparte\u001b[0m\n", - "Observation: \u001b[36;1m\u001b[1;3mPage: Napoleon\n", + "Action Input: Napoleon Bonaparte\u001B[0m\n", + "Observation: \u001B[36;1m\u001B[1;3mPage: Napoleon\n", "Summary: Napoleon Bonaparte (born Napoleone Buonaparte; 15 August 1769 – 5 May 1821), later known by his regnal name Napoleon I, was a Corsican-born French military commander and political leader who rose to prominence during the French Revolution and led successful campaigns during the Revolutionary Wars. He was the de facto leader of the French Republic as First Consul from 1799 to 1804, then Emperor of the French from 1804 until 1814 and again in 1815. Napoleon's political and cultural legacy endures to this day, as a highly celebrated and controversial leader. He initiated many liberal reforms that have persisted in society, and is considered one of the greatest military commanders in history. His campaigns are still studied at military academies worldwide. Between three and six million civilians and soldiers died in what became known as the Napoleonic Wars.Napoleon was born on the island of Corsica, not long after its annexation by France, to a native family descending from minor Italian nobility. He supported the French Revolution in 1789 while serving in the French army, and tried to spread its ideals to his native Corsica. He rose rapidly in the Army after he saved the governing French Directory by firing on royalist insurgents. In 1796, he began a military campaign against the Austrians and their Italian allies, scoring decisive victories and becoming a national hero. Two years later, he led a military expedition to Egypt that served as a springboard to political power. He engineered a coup in November 1799 and became First Consul of the Republic.\n", "Differences with the United Kingdom meant France faced the War of the Third Coalition by 1805. Napoleon shattered this coalition with victories in the Ulm campaign, and at the Battle of Austerlitz, which led to the dissolution of the Holy Roman Empire. In 1806, the Fourth Coalition took up arms against him. Napoleon defeated Prussia at the battles of Jena and Auerstedt, marched the Grande Armée into Eastern Europe, and defeated the Russians in June 1807 at Friedland, forcing the defeated nations of the Fourth Coalition to accept the Treaties of Tilsit. Two years later, the Austrians challenged the French again during the War of the Fifth Coalition, but Napoleon solidified his grip over Europe after triumphing at the Battle of Wagram.\n", "Hoping to extend the Continental System, his embargo against Britain, Napoleon invaded the Iberian Peninsula and declared his brother Joseph the King of Spain in 1808. The Spanish and the Portuguese revolted in the Peninsular War aided by a British army, culminating in defeat for Napoleon's marshals. Napoleon launched an invasion of Russia in the summer of 1812. The resulting campaign witnessed the catastrophic retreat of Napoleon's Grande Armée. In 1813, Prussia and Austria joined Russian forces in a Sixth Coalition against France, resulting in a large coalition army defeating Napoleon at the Battle of Leipzig. The coalition invaded France and captured Paris, forcing Napoleon to abdicate in April 1814. He was exiled to the island of Elba, between Corsica and Italy. In France, the Bourbons were restored to power.\n", @@ -1375,17 +1378,17 @@ "Summary: The House of Bonaparte (originally Buonaparte) is a former imperial and royal European dynasty of Italian (Genoese) origin. It was founded in 1804 by Napoleon I, the son of Corsican nobleman Carlo Buonaparte and Letizia Buonaparte (née Ramolino). Napoleon was a French military leader who rose to power during the French Revolution and who, in 1804, transformed the First French Republic into the First French Empire, five years after his coup d'état of November 1799 (18 Brumaire). Napoleon and the Grande Armée had to fight against every major European power (except for the ones he was allied with, including Denmark-Norway) and dominated continental Europe through a series of military victories during the Napoleonic Wars. He installed members of his family on the thrones of client states, expanding the power of the dynasty.\n", "The House of Bonaparte formed the Imperial House of France during the French Empire, together with some non-Bonaparte family members. In addition to holding the title of Emperor of the French, the Bonaparte dynasty held various other titles and territories during the Napoleonic Wars, including the Kingdom of Italy, the Kingdom of Spain, the Kingdom of Westphalia, the Kingdom of Holland, and the Kingdom of Naples. The dynasty held power for around a decade until the Napoleonic Wars began to take their toll. Making very powerful enemies, such as Austria, Britain, Russia, and Prussia, as well as royalist (particularly Bourbon) restorational movements in France, Spain, the Two Sicilies, and Sardinia, the dynasty eventually collapsed due to the final defeat of Napoleon at the Battle of Waterloo and the restoration of former dynasties by the Congress of Vienna.\n", "During the reign of Napoleon I, the Imperial Family consisted of the Emperor's immediate relations – his wife, son, siblings, and some other close relatives, namely his brother-in-law Joachim Murat, his uncle Joseph Fesch, and his stepson Eugène de Beauharnais.\n", - "Between 1852 and 1870, there was a Second French Empire, when a member of the Bonaparte dynasty again ruled France: Napoleon III, the youngest son of Louis Bonaparte. However, during the Franco-Prussian War of 1870–1871, the dynasty was again ousted from the Imperial Throne. Since that time, there has been a series of pretenders. Supporters of the Bonaparte family's claim to the throne of France are known as Bonapartists. Current head Jean-Christophe, Prince Napoléon, has a Bourbon mother.\u001b[0m\n" + "Between 1852 and 1870, there was a Second French Empire, when a member of the Bonaparte dynasty again ruled France: Napoleon III, the youngest son of Louis Bonaparte. However, during the Franco-Prussian War of 1870–1871, the dynasty was again ousted from the Imperial Throne. Since that time, there has been a series of pretenders. Supporters of the Bonaparte family's claim to the throne of France are known as Bonapartists. Current head Jean-Christophe, Prince Napoléon, has a Bourbon mother.\u001B[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "Thought:\u001b[32;1m\u001b[1;3mI now know the summary of Napoleon Bonaparte. I need to find information about Serena Williams to identify commonalities between them.\n", + "Thought:\u001B[32;1m\u001B[1;3mI now know the summary of Napoleon Bonaparte. I need to find information about Serena Williams to identify commonalities between them.\n", "Action: Wikipedia\n", - "Action Input: Serena Williams\u001b[0m\n", - "Observation: \u001b[36;1m\u001b[1;3mPage: Serena Williams\n", + "Action Input: Serena Williams\u001B[0m\n", + "Observation: \u001B[36;1m\u001B[1;3mPage: Serena Williams\n", "Summary: Serena Jameka Williams (born September 26, 1981) is an American retired professional tennis player. Considered among the greatest tennis players of all time, she was ranked world No. 1 in singles by the Women's Tennis Association (WTA) for 319 weeks, including a joint-record 186 consecutive weeks, and finished as the year-end No. 1 five times. She won 23 Grand Slam singles titles, the most by any player in the Open Era, and the second-most of all time. She is the only player, male or female, to accomplish a Career Golden Slam in both singles and doubles.Along with her older sister Venus, Serena Williams was coached by her parents Oracene Price and Richard Williams. Turning professional in 1995, she won her first major singles title at the 1999 US Open. From the 2002 French Open to the 2003 Australian Open, she was dominant, winning all four major singles titles (each time over Venus in the final) to achieve a non-calendar year Grand Slam and the career Grand Slam, known as the 'Serena Slam'. The next few years saw her claim two more singles majors, but suffer from injury and decline in form. Beginning in 2007, however, she gradually returned to form despite continued injuries, retaking the world No. 1 singles ranking. Beginning at the 2012 Wimbledon Championships, Williams returned to dominance, claiming Olympic gold (completing the Career Golden Slam in singles) and winning eight out of thirteen singles majors, including all four in a row from 2014–15 to achieve a second \"Serena Slam\". At the 2017 Australian Open, she won her 23rd major singles title, surpassing Steffi Graf's Open Era record. She then took a break from professional tennis after becoming pregnant and reached four major finals upon returning to play. In August 2022, Williams announced her impending \"evolution\" away from professional tennis and played what was expected to be her final match at the 2022 US Open.Williams also won 14 major women's doubles titles, all with her sister Venus, and the pair was unbeaten in major doubles finals (the best unbeaten record in major finals in any discipline of the sport). The pair achieved a non-calendar year Grand Slam between the 2009 Wimbledon Championships and the 2010 French Open, which granted the sisters the doubles world No. 1 ranking. Serena won four Olympic gold medals, three in women's doubles—an all-time joint record in tennis, shared with her sister. The duo are the only women in the Open Era to win Olympic gold in both singles and doubles. She also won two major mixed doubles titles, both in 1998. She is the only singles player, male or female, to complete three Career Golden Slams – one in women's singles and two in same-sex doubles.The arrival of the Williams sisters has been credited with ushering in a new era of power and athleticism on the women's professional tennis tour. Serena holds a combined 39 major titles: 23 in singles, 14 in women's doubles, and two in mixed doubles. She is joint-third on the all-time list and second in the Open Era for total major titles. She is the most recent woman to simultaneously hold all four major singles titles (2002–03 and 2014–15), and the most recent woman to win the Surface Slam (major titles on hard, clay and grass courts in the same calendar year), doing so in 2015. She is also, with Venus, the most recent player to have simultaneously held all four major women's doubles titles (2009–10).\n", "Williams was the world's highest paid woman athlete in 2016, earning almost $29 million. She repeated this feat in 2017 when she was the only woman on Forbes' list of the 100 highest-paid athletes, with $27 million in prize money and endorsements. She won the Laureus Sportswoman of the Year award a record four times (2003, 2010, 2016, 2018), and in December 2015 was named Sportsperson of the Year by Sports Illustrated magazine. She is the highest-earning woman athlete of all time.\n", "\n", @@ -1401,18 +1404,18 @@ "Page: Venus Williams\n", "Summary: Venus Ebony Starr Williams (born June 17, 1980) is an American professional tennis player. A former world No. 1 in both singles and doubles, Williams has won seven Grand Slam singles titles, five at Wimbledon and two at the US Open. She is widely regarded as one of the all-time greats of the sport.Along with her younger sister, Serena, Venus Williams was coached by her parents Oracene Price and Richard Williams. Turning professional in 1994, she reached her first major final at the 1997 US Open. In 2000 and 2001, Williams claimed the Wimbledon and US Open titles, as well as Olympic singles gold at the 2000 Sydney Olympics. She first reached the singles world No. 1 ranking on 25 February 2002, becoming the first African American woman to do so in the Open era, and the second of all-time after Althea Gibson. She reached four consecutive major finals between 2002 and 2003, but lost each time to Serena. She then suffered from injuries, winning just one major title between 2003 and 2006. Williams returned to form starting in 2007, when she won Wimbledon (a feat she repeated the following year). In 2010, she returned to the world No. 2 position in singles, but then suffered again from injuries. Starting in 2014, she again gradually returned to form, culminating in two major final appearances at the Australian Open and Wimbledon in 2017.\n", "Along with her seven singles major titles, Williams has also won 14 women's doubles major titles, all partnering Serena; the pair are unbeaten in Grand Slam doubles finals. She became the world No. 1 in doubles for the first time on June 7, 2010, alongside Serena, after the pair completed a non-calendar-year Grand Slam at the French Open. The pair also won three Olympic gold medals in women's doubles, in 2000, 2008, and 2012, adding to Venus' singles gold in 2000 and her mixed doubles silver in 2016. Williams has also won two mixed doubles major titles, both in 1998.\n", - "The Williams sisters are credited with ushering in a new era of power and athleticism on the women's professional tennis tour. With 49 WTA Tour singles titles, Williams trails only her sister Serena among active players with the most singles titles. With 22 WTA doubles titles and two mixed doubles titles, her combined total of 73 WTA titles is also second among active players behind Serena. She is also one of only two active players to have reached the singles finals of all four majors, along with Serena. Williams was twice the season prize money leader (in 2001 and 2017), and ranks second behind Serena in all-time career prize money winnings, having earned over US$42 million as of March 2022.\u001b[0m\n" + "The Williams sisters are credited with ushering in a new era of power and athleticism on the women's professional tennis tour. With 49 WTA Tour singles titles, Williams trails only her sister Serena among active players with the most singles titles. With 22 WTA doubles titles and two mixed doubles titles, her combined total of 73 WTA titles is also second among active players behind Serena. She is also one of only two active players to have reached the singles finals of all four majors, along with Serena. Williams was twice the season prize money leader (in 2001 and 2017), and ranks second behind Serena in all-time career prize money winnings, having earned over US$42 million as of March 2022.\u001B[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "Thought:\u001b[32;1m\u001b[1;3mI now know the summaries of both Napoleon Bonaparte and Serena Williams. I can identify commonalities between them.\n", + "Thought:\u001B[32;1m\u001B[1;3mI now know the summaries of both Napoleon Bonaparte and Serena Williams. I can identify commonalities between them.\n", "\n", - "Final Answer: Napoleon Bonaparte and Serena Williams both achieved remarkable success in their respective fields, with Napoleon being one of the greatest military commanders in history and Serena being one of the greatest tennis players of all time. They both dominated their fields during their peak years and have left lasting legacies. Additionally, they both faced challenges and setbacks in their careers but managed to overcome them and continue to excel. However, it is important to note that their fields of expertise are vastly different, with Napoleon being a military and political leader, while Serena is a professional athlete.\u001b[0m\n", + "Final Answer: Napoleon Bonaparte and Serena Williams both achieved remarkable success in their respective fields, with Napoleon being one of the greatest military commanders in history and Serena being one of the greatest tennis players of all time. They both dominated their fields during their peak years and have left lasting legacies. Additionally, they both faced challenges and setbacks in their careers but managed to overcome them and continue to excel. However, it is important to note that their fields of expertise are vastly different, with Napoleon being a military and political leader, while Serena is a professional athlete.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] } ], diff --git a/data_generation/Ask A Book Questions.ipynb b/data_generation/Ask A Book Questions.ipynb index a820890..87cc9d5 100644 --- a/data_generation/Ask A Book Questions.ipynb +++ b/data_generation/Ask A Book Questions.ipynb @@ -159,10 +159,12 @@ "outputs": [], "source": [ "# Check to see if there is an environment variable with you API keys, if not, use what you put below\n", - "OPENAI_API_KEY = os.environ.get('OPENAI_API_KEY', 'YourAPIKey')\n", + "from dotenv import find_dotenv, load_dotenv\n", + "load_dotenv(find_dotenv())\n", "\n", - "PINECONE_API_KEY = os.environ.get('PINECONE_API_KEY', 'YourAPIKey')\n", - "PINECONE_API_ENV = os.environ.get('PINECONE_API_ENV', 'us-east1-gcp') # You may need to switch with your env" + "#OPENAI_API_KEY = os.environ.get('OPENAI_API_KEY', 'YourAPIKey')\n", + "#PINECONE_API_KEY = os.environ.get('PINECONE_API_KEY', 'YourAPIKey')\n", + "#PINECONE_API_ENV = os.environ.get('PINECONE_API_ENV', 'us-east1-gcp') # You may need to switch with your env" ] }, { diff --git a/data_generation/Clean and Standardize Data.ipynb b/data_generation/Clean and Standardize Data.ipynb index 6ba130c..b91e8f6 100644 --- a/data_generation/Clean and Standardize Data.ipynb +++ b/data_generation/Clean and Standardize Data.ipynb @@ -24,6 +24,9 @@ }, "outputs": [], "source": [ + "from dotenv import find_dotenv, load_dotenv\n", + "load_dotenv(find_dotenv())\n", + "\n", "openai_api_key = '...'" ] }, diff --git a/data_generation/Custom Files Question & Answer.ipynb b/data_generation/Custom Files Question & Answer.ipynb index 27a97b4..a4f4af7 100644 --- a/data_generation/Custom Files Question & Answer.ipynb +++ b/data_generation/Custom Files Question & Answer.ipynb @@ -15,6 +15,8 @@ "import magic\n", "import os\n", "import nltk\n", + "from dotenv import find_dotenv, load_dotenv\n", + "load_dotenv(find_dotenv())\n", "\n", "# os.environ['OPENAI_API_KEY'] = '...'\n", "\n", diff --git a/data_generation/Expert Structured Output (Using Kor).ipynb b/data_generation/Expert Structured Output (Using Kor).ipynb index 9ae29fa..436371f 100644 --- a/data_generation/Expert Structured Output (Using Kor).ipynb +++ b/data_generation/Expert Structured Output (Using Kor).ipynb @@ -57,6 +57,9 @@ "metadata": {}, "outputs": [], "source": [ + "from dotenv import find_dotenv, load_dotenv\n", + "load_dotenv(find_dotenv())\n", + "\n", "# It's better to do this an environment variable but putting it in plain text for clarity\n", "openai_api_key = 'your_api_key'" ] diff --git a/data_generation/Instructing LLMs To Match Tone.ipynb b/data_generation/Instructing LLMs To Match Tone.ipynb index dd91e8b..17ae08c 100644 --- a/data_generation/Instructing LLMs To Match Tone.ipynb +++ b/data_generation/Instructing LLMs To Match Tone.ipynb @@ -52,12 +52,11 @@ "\n", "# Environment Variables\n", "import os\n", - "from dotenv import load_dotenv\n", - "\n", "# Twitter\n", "import tweepy\n", "\n", - "load_dotenv()" + "from dotenv import find_dotenv, load_dotenv\n", + "load_dotenv(find_dotenv())" ] }, { diff --git a/data_generation/Personalized Email Generation.ipynb b/data_generation/Personalized Email Generation.ipynb index 9ce046b..b16af3a 100644 --- a/data_generation/Personalized Email Generation.ipynb +++ b/data_generation/Personalized Email Generation.ipynb @@ -23,6 +23,9 @@ }, "outputs": [], "source": [ + "from dotenv import find_dotenv, load_dotenv\n", + "load_dotenv(find_dotenv())\n", + "\n", "openai_api_key = '...'" ] }, @@ -239,9 +242,9 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new MapReduceDocumentsChain chain...\u001b[0m\n", + "\u001B[1m> Entering new MapReduceDocumentsChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mBelow is a section of a website about Poly\n", + "\u001B[32;1m\u001B[1;3mBelow is a section of a website about Poly\n", "\n", "Write a concise summary about Poly. If the information is not about Poly, exclude it from your summary.\n", "\n", @@ -351,9 +354,9 @@ "\n", "Generate Design Assets in Seconds\n", "\n", - "% CONCISE SUMMARY:\u001b[0m\n", + "% CONCISE SUMMARY:\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mBelow is a section of a website about Poly\n", + "\u001B[32;1m\u001B[1;3mBelow is a section of a website about Poly\n", "\n", "Write a concise summary about Poly. If the information is not about Poly, exclude it from your summary.\n", "\n", @@ -405,9 +408,9 @@ "\n", "Abhay Agarwal\n", "\n", - "% CONCISE SUMMARY:\u001b[0m\n", + "% CONCISE SUMMARY:\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mBelow is a section of a website about Poly\n", + "\u001B[32;1m\u001B[1;3mBelow is a section of a website about Poly\n", "\n", "Write a concise summary about Poly. If the information is not about Poly, exclude it from your summary.\n", "\n", @@ -487,12 +490,12 @@ "\n", "© 2023 Y Combinator.\n", "\n", - "% CONCISE SUMMARY:\u001b[0m\n", + "% CONCISE SUMMARY:\u001B[0m\n", "\n", "\n", - "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", + "\u001B[1m> Entering new LLMChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3m\n", + "\u001B[32;1m\u001B[1;3m\n", "Your goal is to write a personalized outbound email from Greg, a sales rep at RapidRoad to Poly.\n", "\n", "A good email is personalized and combines information about the two companies on how they can help each other.\n", @@ -527,11 +530,11 @@ "- End your email with a call-to-action such as asking them to set up time to talk more\n", "\n", "% YOUR RESPONSE:\n", - "\u001b[0m\n", + "\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] } ], diff --git a/data_generation/Working With Call or Video Transcripts.ipynb b/data_generation/Working With Call or Video Transcripts.ipynb index 7e97f24..3d0e039 100644 --- a/data_generation/Working With Call or Video Transcripts.ipynb +++ b/data_generation/Working With Call or Video Transcripts.ipynb @@ -85,7 +85,10 @@ }, "outputs": [], "source": [ - "os.environ['OPENAI_API_KEY'] = '...'" + "from dotenv import find_dotenv, load_dotenv\n", + "load_dotenv(find_dotenv())\n", + "\n", + "#os.environ['OPENAI_API_KEY'] = '...'" ] }, { @@ -232,9 +235,9 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new MapReduceDocumentsChain chain...\u001b[0m\n", + "\u001B[1m> Entering new MapReduceDocumentsChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"Greg (Marin Transitions Partner): Does this say the call is recording for you at all? \n", @@ -268,9 +271,9 @@ "Eliza (ACME Co): I'd say about 10 times a month?\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"Eliza (ACME Co): I'd say about 10 times a month? \n", @@ -298,9 +301,9 @@ "Greg (Marin Transitions Partner): Interesting. And so as we think about this social monitoring even more, what are your priorities for a tool? What would you like to see?\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"Greg (Marin Transitions Partner): Interesting. And so as we think about this social monitoring even more, what are your priorities for a tool? What would you like to see? \n", @@ -322,9 +325,9 @@ "Greg (Marin Transitions Partner): Interesting. Well, first, I wanna thank you very much for being such a big supporter of what we're doing here at Marin transitions?\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"Eliza (ACME Co): We're also looking at Hootsuite. \n", @@ -342,9 +345,9 @@ "Eliza (ACME Co): Perfect.\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"Eliza (ACME Co): Perfect. \n", @@ -370,7 +373,7 @@ "Greg (Marin Transitions Partner): It all right. We'll see you later. Bye bye.\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n" + "CONCISE SUMMARY:\u001B[0m\n" ] }, { @@ -379,12 +382,12 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new StuffDocumentsChain chain...\u001b[0m\n", + "\u001B[1m> Entering new StuffDocumentsChain chain...\u001B[0m\n", "\n", "\n", - "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", + "\u001B[1m> Entering new LLMChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"Greg from Marin Transitions Partner speaks with Eliza from ACME Co about their business and social media presence. They discuss ACME Co's position as a software company that helps nonprofits grow their business, their number of employees and marketing team, and their technology stack. Greg also asks about their social media activity, to which Eliza responds that they post about 10 times a month.\n", @@ -398,13 +401,13 @@ "Greg, a Marin Transitions Partner, plans to send a brochure and pricing information to Eliza from ACME Co. He schedules a follow-up meeting for next week and asks about her personal interests, including her Australian Shepherd dog and hiking in the bay area. They end the conversation with plans to speak again next week.\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] } ], @@ -679,9 +682,9 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new MapReduceDocumentsChain chain...\u001b[0m\n", + "\u001B[1m> Entering new MapReduceDocumentsChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mSystem: \n", + "\u001B[32;1m\u001B[1;3mSystem: \n", "\n", "You are a helpful assistant that helps Greg, a sales rep at Marin Transitions Partner, summarize information from a sales call.\n", "Your goal is to write a summary from the perspective of Greg that will highlight key points that will be relevant to making a sale\n", @@ -715,9 +718,9 @@ "\n", "Greg (Marin Transitions Partner): That's awesome. And so, because we do social monitoring, I wanna go into a little bit of questions around your social experience, if you will, and what acne code does. So, how many times would you say that you post on social media per month? \n", "\n", - "Eliza (ACME Co): I'd say about 10 times a month?\u001b[0m\n", + "Eliza (ACME Co): I'd say about 10 times a month?\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mSystem: \n", + "\u001B[32;1m\u001B[1;3mSystem: \n", "\n", "You are a helpful assistant that helps Greg, a sales rep at Marin Transitions Partner, summarize information from a sales call.\n", "Your goal is to write a summary from the perspective of Greg that will highlight key points that will be relevant to making a sale\n", @@ -745,9 +748,9 @@ "\n", "Eliza (ACME Co): So there would be, that would be a committee decision between myself and the rest of the leadership team. But the ultimate signer of the contract would be my CEO Christina. \n", "\n", - "Greg (Marin Transitions Partner): Interesting. And so as we think about this social monitoring even more, what are your priorities for a tool? What would you like to see?\u001b[0m\n", + "Greg (Marin Transitions Partner): Interesting. And so as we think about this social monitoring even more, what are your priorities for a tool? What would you like to see?\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mSystem: \n", + "\u001B[32;1m\u001B[1;3mSystem: \n", "\n", "You are a helpful assistant that helps Greg, a sales rep at Marin Transitions Partner, summarize information from a sales call.\n", "Your goal is to write a summary from the perspective of Greg that will highlight key points that will be relevant to making a sale\n", @@ -769,9 +772,9 @@ "\n", "Eliza (ACME Co): We're also looking at Hootsuite. \n", "\n", - "Greg (Marin Transitions Partner): Interesting. Well, first, I wanna thank you very much for being such a big supporter of what we're doing here at Marin transitions?\u001b[0m\n", + "Greg (Marin Transitions Partner): Interesting. Well, first, I wanna thank you very much for being such a big supporter of what we're doing here at Marin transitions?\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mSystem: \n", + "\u001B[32;1m\u001B[1;3mSystem: \n", "\n", "You are a helpful assistant that helps Greg, a sales rep at Marin Transitions Partner, summarize information from a sales call.\n", "Your goal is to write a summary from the perspective of Greg that will highlight key points that will be relevant to making a sale\n", @@ -789,9 +792,9 @@ "\n", "Greg (Marin Transitions Partner): Absolutely. So the implementation process is really in two parts. Part number one is just gonna be a about an hour long session with one of our implementation partners and your head of social media that's just to make sure that your accounts get set up and that we're doing the tracking properly. Then part two is going to be the actual monitoring part. It takes about four hours to start monitoring, but after that, it'll be available for you in real time and that's just so we can go scrape all the data off the social sites. So that net you should be up and running in about half a day's work. That sounds. \n", "\n", - "Eliza (ACME Co): Perfect.\u001b[0m\n", + "Eliza (ACME Co): Perfect.\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mSystem: \n", + "\u001B[32;1m\u001B[1;3mSystem: \n", "\n", "You are a helpful assistant that helps Greg, a sales rep at Marin Transitions Partner, summarize information from a sales call.\n", "Your goal is to write a summary from the perspective of Greg that will highlight key points that will be relevant to making a sale\n", @@ -817,7 +820,7 @@ "\n", "Eliza (ACME Co): Great. I'm looking forward to. \n", "\n", - "Greg (Marin Transitions Partner): It all right. We'll see you later. Bye bye.\u001b[0m\n" + "Greg (Marin Transitions Partner): It all right. We'll see you later. Bye bye.\u001B[0m\n" ] }, { @@ -826,12 +829,12 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new StuffDocumentsChain chain...\u001b[0m\n", + "\u001B[1m> Entering new StuffDocumentsChain chain...\u001B[0m\n", "\n", "\n", - "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", + "\u001B[1m> Entering new LLMChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mSystem: \n", + "\u001B[32;1m\u001B[1;3mSystem: \n", "\n", "You are a helpful assistant that helps Greg, a sales rep at Marin Transitions Partner, summarize information from a sales call.\n", "Your goal is to write a summary from the perspective of Greg that will highlight key points that will be relevant to making a sale\n", @@ -851,13 +854,13 @@ "\n", "Eliza from ACME Co is interested in Hootsuite, but is a big supporter of Marin Transitions Partner. She is concerned about support and avoiding shelfware. She asks about the implementation process and how long it takes to get started on the platform. Greg explains that the implementation process is in two parts, with an hour-long session with an implementation partner and the head of social media to set up accounts and ensure proper tracking. The second part is the monitoring process, which takes about four hours to start, but after that, it will be available in real-time. Overall, the implementation process takes about half a day's work.\n", "\n", - "Greg from Marin Transitions Partner had a successful sales call with Eliza from ACME Co. He will be sending over a brochure and pricing information for their company. They scheduled a follow-up meeting for next Wednesday between 2-4 PM Pacific Time. Greg also asked Eliza about her personal life and found out that she has an Australian Shepherd dog and enjoys hiking and wine tasting in the nearby trails and wine country.\u001b[0m\n", + "Greg from Marin Transitions Partner had a successful sales call with Eliza from ACME Co. He will be sending over a brochure and pricing information for their company. They scheduled a follow-up meeting for next Wednesday between 2-4 PM Pacific Time. Greg also asked Eliza about her personal life and found out that she has an Australian Shepherd dog and enjoys hiking and wine tasting in the nearby trails and wine country.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] } ], diff --git a/getting_started/Quickstart Guide.ipynb b/getting_started/Quickstart Guide.ipynb index 24286f8..b04e74e 100644 --- a/getting_started/Quickstart Guide.ipynb +++ b/getting_started/Quickstart Guide.ipynb @@ -14,32 +14,45 @@ "execution_count": 1, "id": "a05530b1", "metadata": { - "collapsed": true + "collapsed": true, + "ExecuteTime": { + "end_time": "2023-05-28T18:15:20.561403038Z", + "start_time": "2023-05-28T18:15:19.466238066Z" + } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Requirement already satisfied: langchain in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (0.0.75)\n", - "Requirement already satisfied: PyYAML<7,>=6 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from langchain) (6.0)\n", - "Requirement already satisfied: dataclasses-json<0.6.0,>=0.5.7 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from langchain) (0.5.7)\n", - "Requirement already satisfied: numpy<2,>=1 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from langchain) (1.21.5)\n", - "Requirement already satisfied: SQLAlchemy<2,>=1 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from langchain) (1.4.39)\n", - "Requirement already satisfied: pydantic<2,>=1 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from langchain) (1.10.4)\n", - "Requirement already satisfied: requests<3,>=2 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from langchain) (2.28.1)\n", - "Requirement already satisfied: marshmallow<4.0.0,>=3.3.0 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from dataclasses-json<0.6.0,>=0.5.7->langchain) (3.19.0)\n", - "Requirement already satisfied: marshmallow-enum<2.0.0,>=1.5.1 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from dataclasses-json<0.6.0,>=0.5.7->langchain) (1.5.1)\n", - "Requirement already satisfied: typing-inspect>=0.4.0 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from dataclasses-json<0.6.0,>=0.5.7->langchain) (0.8.0)\n", - "Requirement already satisfied: typing-extensions>=4.2.0 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from pydantic<2,>=1->langchain) (4.3.0)\n", - "Requirement already satisfied: certifi>=2017.4.17 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from requests<3,>=2->langchain) (2022.9.24)\n", - "Requirement already satisfied: charset-normalizer<3,>=2 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from requests<3,>=2->langchain) (2.0.4)\n", - "Requirement already satisfied: idna<4,>=2.5 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from requests<3,>=2->langchain) (3.3)\n", - "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from requests<3,>=2->langchain) (1.26.11)\n", - "Requirement already satisfied: greenlet!=0.4.17 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from SQLAlchemy<2,>=1->langchain) (1.1.1)\n", - "Requirement already satisfied: packaging>=17.0 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from marshmallow<4.0.0,>=3.3.0->dataclasses-json<0.6.0,>=0.5.7->langchain) (21.3)\n", - "Requirement already satisfied: mypy-extensions>=0.3.0 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from typing-inspect>=0.4.0->dataclasses-json<0.6.0,>=0.5.7->langchain) (0.4.3)\n", - "Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from packaging>=17.0->marshmallow<4.0.0,>=3.3.0->dataclasses-json<0.6.0,>=0.5.7->langchain) (3.0.9)\n", + "Requirement already satisfied: langchain in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (0.0.182)\r\n", + "Requirement already satisfied: PyYAML>=5.4.1 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from langchain) (6.0)\r\n", + "Requirement already satisfied: SQLAlchemy<3,>=1.4 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from langchain) (2.0.15)\r\n", + "Requirement already satisfied: aiohttp<4.0.0,>=3.8.3 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from langchain) (3.8.4)\r\n", + "Requirement already satisfied: dataclasses-json<0.6.0,>=0.5.7 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from langchain) (0.5.7)\r\n", + "Requirement already satisfied: numexpr<3.0.0,>=2.8.4 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from langchain) (2.8.4)\r\n", + "Requirement already satisfied: numpy<2,>=1 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from langchain) (1.24.3)\r\n", + "Requirement already satisfied: openapi-schema-pydantic<2.0,>=1.2 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from langchain) (1.2.4)\r\n", + "Requirement already satisfied: pydantic<2,>=1 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from langchain) (1.10.8)\r\n", + "Requirement already satisfied: requests<3,>=2 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from langchain) (2.31.0)\r\n", + "Requirement already satisfied: tenacity<9.0.0,>=8.1.0 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from langchain) (8.2.2)\r\n", + "Requirement already satisfied: attrs>=17.3.0 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (23.1.0)\r\n", + "Requirement already satisfied: charset-normalizer<4.0,>=2.0 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (3.1.0)\r\n", + "Requirement already satisfied: multidict<7.0,>=4.5 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (6.0.4)\r\n", + "Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (4.0.2)\r\n", + "Requirement already satisfied: yarl<2.0,>=1.0 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (1.9.2)\r\n", + "Requirement already satisfied: frozenlist>=1.1.1 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (1.3.3)\r\n", + "Requirement already satisfied: aiosignal>=1.1.2 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (1.3.1)\r\n", + "Requirement already satisfied: marshmallow<4.0.0,>=3.3.0 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from dataclasses-json<0.6.0,>=0.5.7->langchain) (3.19.0)\r\n", + "Requirement already satisfied: marshmallow-enum<2.0.0,>=1.5.1 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from dataclasses-json<0.6.0,>=0.5.7->langchain) (1.5.1)\r\n", + "Requirement already satisfied: typing-inspect>=0.4.0 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from dataclasses-json<0.6.0,>=0.5.7->langchain) (0.9.0)\r\n", + "Requirement already satisfied: typing-extensions>=4.2.0 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from pydantic<2,>=1->langchain) (4.6.2)\r\n", + "Requirement already satisfied: idna<4,>=2.5 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from requests<3,>=2->langchain) (3.4)\r\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from requests<3,>=2->langchain) (2.0.2)\r\n", + "Requirement already satisfied: certifi>=2017.4.17 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from requests<3,>=2->langchain) (2023.5.7)\r\n", + "Requirement already satisfied: greenlet!=0.4.17 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from SQLAlchemy<3,>=1.4->langchain) (2.0.2)\r\n", + "Requirement already satisfied: packaging>=17.0 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from marshmallow<4.0.0,>=3.3.0->dataclasses-json<0.6.0,>=0.5.7->langchain) (23.1)\r\n", + "Requirement already satisfied: mypy-extensions>=0.3.0 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from typing-inspect>=0.4.0->dataclasses-json<0.6.0,>=0.5.7->langchain) (1.0.0)\r\n", "Note: you may need to restart the kernel to use updated packages.\n" ] } @@ -53,27 +66,31 @@ "execution_count": 2, "id": "3b556fc2", "metadata": { - "collapsed": true + "collapsed": true, + "ExecuteTime": { + "end_time": "2023-05-28T18:15:21.466288786Z", + "start_time": "2023-05-28T18:15:20.563783888Z" + } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Requirement already satisfied: openai in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (0.26.3)\n", - "Requirement already satisfied: tqdm in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from openai) (4.64.1)\n", - "Requirement already satisfied: aiohttp in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from openai) (3.8.3)\n", - "Requirement already satisfied: requests>=2.20 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from openai) (2.28.1)\n", - "Requirement already satisfied: idna<4,>=2.5 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from requests>=2.20->openai) (3.3)\n", - "Requirement already satisfied: charset-normalizer<3,>=2 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from requests>=2.20->openai) (2.0.4)\n", - "Requirement already satisfied: certifi>=2017.4.17 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from requests>=2.20->openai) (2022.9.24)\n", - "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from requests>=2.20->openai) (1.26.11)\n", - "Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from aiohttp->openai) (4.0.2)\n", - "Requirement already satisfied: yarl<2.0,>=1.0 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from aiohttp->openai) (1.8.2)\n", - "Requirement already satisfied: attrs>=17.3.0 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from aiohttp->openai) (21.4.0)\n", - "Requirement already satisfied: frozenlist>=1.1.1 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from aiohttp->openai) (1.3.3)\n", - "Requirement already satisfied: aiosignal>=1.1.2 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from aiohttp->openai) (1.3.1)\n", - "Requirement already satisfied: multidict<7.0,>=4.5 in /Users/gregorykamradt/opt/anaconda3/lib/python3.9/site-packages (from aiohttp->openai) (6.0.4)\n", + "Requirement already satisfied: openai in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (0.27.7)\r\n", + "Requirement already satisfied: requests>=2.20 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from openai) (2.31.0)\r\n", + "Requirement already satisfied: tqdm in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from openai) (4.65.0)\r\n", + "Requirement already satisfied: aiohttp in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from openai) (3.8.4)\r\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from requests>=2.20->openai) (3.1.0)\r\n", + "Requirement already satisfied: idna<4,>=2.5 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from requests>=2.20->openai) (3.4)\r\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from requests>=2.20->openai) (2.0.2)\r\n", + "Requirement already satisfied: certifi>=2017.4.17 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from requests>=2.20->openai) (2023.5.7)\r\n", + "Requirement already satisfied: attrs>=17.3.0 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from aiohttp->openai) (23.1.0)\r\n", + "Requirement already satisfied: multidict<7.0,>=4.5 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from aiohttp->openai) (6.0.4)\r\n", + "Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from aiohttp->openai) (4.0.2)\r\n", + "Requirement already satisfied: yarl<2.0,>=1.0 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from aiohttp->openai) (1.9.2)\r\n", + "Requirement already satisfied: frozenlist>=1.1.1 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from aiohttp->openai) (1.3.3)\r\n", + "Requirement already satisfied: aiosignal>=1.1.2 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from aiohttp->openai) (1.3.1)\r\n", "Note: you may need to restart the kernel to use updated packages.\n" ] } @@ -84,9 +101,36 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 6, + "outputs": [ + { + "data": { + "text/plain": "True" + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2023-05-28T18:17:21.465096604Z", + "start_time": "2023-05-28T18:17:21.459541985Z" + } + } + }, + { + "cell_type": "code", + "execution_count": 7, "id": "0c07fe20", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:17:23.232240537Z", + "start_time": "2023-05-28T18:17:23.222303604Z" + } + }, "outputs": [], "source": [ "import os\n", @@ -104,9 +148,14 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 8, "id": "4bef95a9", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:17:25.515001511Z", + "start_time": "2023-05-28T18:17:24.976166130Z" + } + }, "outputs": [], "source": [ "from langchain.llms import OpenAI" @@ -114,9 +163,14 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 9, "id": "3596e426", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:17:26.578217417Z", + "start_time": "2023-05-28T18:17:26.572910969Z" + } + }, "outputs": [], "source": [ "llm = OpenAI(temperature=0.9)" @@ -124,9 +178,14 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 10, "id": "9ebe6d15", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:17:31.781441938Z", + "start_time": "2023-05-28T18:17:27.192847611Z" + } + }, "outputs": [ { "name": "stdout", @@ -136,9 +195,9 @@ "\n", "1. Rome, Italy \n", "2. Bologna, Italy \n", - "3. Venice, Italy\n", - "4. Amalfi Coast, Italy\n", - "5. Sicily, Italy\n" + "3. Napoli, Italy \n", + "4. Florence, Italy \n", + "5. Amalfi Coast, Italy\n" ] } ], @@ -157,9 +216,14 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 11, "id": "168f2277", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:17:31.783371978Z", + "start_time": "2023-05-28T18:17:31.782304005Z" + } + }, "outputs": [], "source": [ "from langchain.prompts import PromptTemplate" @@ -167,9 +231,14 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 12, "id": "9d6d3761", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:17:35.680170360Z", + "start_time": "2023-05-28T18:17:35.672656592Z" + } + }, "outputs": [], "source": [ "prompt = PromptTemplate(\n", @@ -180,9 +249,14 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 13, "id": "160f8a0f", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:17:36.273818290Z", + "start_time": "2023-05-28T18:17:36.269825308Z" + } + }, "outputs": [ { "name": "stdout", @@ -198,9 +272,14 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 14, "id": "4309f2a0", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:17:50.013878332Z", + "start_time": "2023-05-28T18:17:37.003289219Z" + } + }, "outputs": [ { "name": "stdout", @@ -208,11 +287,15 @@ "text": [ "\n", "\n", - "1. New York City, USA\n", - "2. Tokyo, Japan\n", - "3. Paris, France\n", - "4. San Francisco, USA\n", - "5. Vancouver, Canada\n" + "1. France: The country is known for the world-renowned cuisine, including delicious desserts such as crème brûlée, macarons, and tarte tatin.\n", + "\n", + "2. Italy: From gelato to cannoli, and from tiramisu to panna cotta, Italy is home to some of the most iconic desserts in the world.\n", + "\n", + "3. Canada: Head to Canada for sweet treats such as Nanaimo bars, butter tarts, beaver tails, and sugar pie.\n", + "\n", + "4. Japan: From mochi to matcha mousse cake, there is something for every sweet tooth in Japan.\n", + "\n", + "5. United States: From the classic apple pie to the sinfully-delicious pecan pie, the USA has no shortage of delicious desserts.\n" ] } ], @@ -230,9 +313,14 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 15, "id": "a34ff024", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:17:50.014088334Z", + "start_time": "2023-05-28T18:17:50.013715650Z" + } + }, "outputs": [], "source": [ "from langchain.prompts import PromptTemplate\n", @@ -242,9 +330,14 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 16, "id": "ffbdf4a9", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:17:50.014186045Z", + "start_time": "2023-05-28T18:17:50.014042683Z" + } + }, "outputs": [], "source": [ "llm = OpenAI(temperature=0.9)\n", @@ -257,9 +350,14 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 17, "id": "7efda77b", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:17:50.014613765Z", + "start_time": "2023-05-28T18:17:50.014138866Z" + } + }, "outputs": [], "source": [ "chain = LLMChain(llm=llm, prompt=prompt)" @@ -267,9 +365,14 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 18, "id": "0b08b76a", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:17:53.084561952Z", + "start_time": "2023-05-28T18:17:50.014565424Z" + } + }, "outputs": [ { "name": "stdout", @@ -277,11 +380,11 @@ "text": [ "\n", "\n", - "1. Costa Rica \n", - "2. Hawaii \n", - "3. Malaysia \n", - "4. India \n", - "5. Thailand\n" + "1. Hawaii\n", + "2. California\n", + "3. Costa Rica\n", + "4. Florida\n", + "5. The Caribbean\n" ] } ], @@ -299,19 +402,46 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "id": "c19db4aa", - "metadata": {}, - "outputs": [], + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:17:54.525783739Z", + "start_time": "2023-05-28T18:17:53.085081423Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Collecting google-search-results\r\n", + " Using cached google_search_results-2.4.2-py3-none-any.whl\r\n", + "Requirement already satisfied: requests in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from google-search-results) (2.31.0)\r\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from requests->google-search-results) (3.1.0)\r\n", + "Requirement already satisfied: idna<4,>=2.5 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from requests->google-search-results) (3.4)\r\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from requests->google-search-results) (2.0.2)\r\n", + "Requirement already satisfied: certifi>=2017.4.17 in /home/rajeshsharma/code/others/langchain-tutorials/venv/lib/python3.11/site-packages (from requests->google-search-results) (2023.5.7)\r\n", + "Installing collected packages: google-search-results\r\n", + "Successfully installed google-search-results-2.4.2\r\n", + "Note: you may need to restart the kernel to use updated packages.\n" + ] + } + ], "source": [ "pip install google-search-results" ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 20, "id": "6d22c464", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:17:54.527519113Z", + "start_time": "2023-05-28T18:17:54.526516921Z" + } + }, "outputs": [], "source": [ "from langchain.agents import load_tools\n", @@ -321,9 +451,14 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 21, "id": "ba25bb42", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:17:54.550679252Z", + "start_time": "2023-05-28T18:17:54.528269443Z" + } + }, "outputs": [], "source": [ "# Load the model\n", @@ -332,9 +467,14 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 22, "id": "0740ce8f", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:17:54.560009085Z", + "start_time": "2023-05-28T18:17:54.546860947Z" + } + }, "outputs": [], "source": [ "# Load in some tools to use\n", @@ -346,9 +486,14 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 23, "id": "b20f48e3", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:17:54.605868371Z", + "start_time": "2023-05-28T18:17:54.558699028Z" + } + }, "outputs": [], "source": [ "# Finally, let's initialize an agent with:\n", @@ -369,9 +514,14 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 24, "id": "89728919", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:18:14.550955137Z", + "start_time": "2023-05-28T18:17:59.616986194Z" + } + }, "outputs": [ { "name": "stdout", @@ -379,34 +529,48 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n", - "\u001b[32;1m\u001b[1;3m I need to find out who the leader of Japan is and then calculate the largest prime number that is smaller than their age.\n", - "Action: Search\n", - "Action Input: \"current leader of Japan\"\u001b[0m\n", - "Observation: \u001b[36;1m\u001b[1;3mFumio Kishida\u001b[0m\n", - "Thought:\u001b[32;1m\u001b[1;3m I need to find out the age of the leader of Japan\n", + "\u001B[1m> Entering new AgentExecutor chain...\u001B[0m\n", + "\u001B[32;1m\u001B[1;3m I need to find out who the leader of Japan is and then use a calculator to find the largest prime number that is smaller than their age.\n", "Action: Search\n", - "Action Input: \"age of Fumio Kishida\"\u001b[0m\n", - "Observation: \u001b[36;1m\u001b[1;3m65 years\u001b[0m\n", - "Thought:\u001b[32;1m\u001b[1;3m I need to calculate the largest prime number that is smaller than 65\n", + "Action Input: \"Current leader of Japan\"\u001B[0m\n", + "Observation: \u001B[36;1m\u001B[1;3mFumio Kishida\u001B[0m\n", + "Thought:\u001B[32;1m\u001B[1;3m I now need to find the largest prime number that is smaller than their age.\n", "Action: Calculator\n", - "Action Input: 65\u001b[0m\n", - "Observation: \u001b[33;1m\u001b[1;3mAnswer: 65\u001b[0m\n", - "Thought:\u001b[32;1m\u001b[1;3m I now know the final answer\n", - "Final Answer: The current leader of Japan is Fumio Kishida and the largest prime number that is smaller than their age is 61.\u001b[0m\n", - "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "Action Input: \"Largest prime number smaller than 68\"\u001B[0m" ] }, { - "data": { - "text/plain": [ - "'The current leader of Japan is Fumio Kishida and the largest prime number that is smaller than their age is 61.'" - ] - }, - "execution_count": 25, - "metadata": {}, - "output_type": "execute_result" + "ename": "ValueError", + "evalue": "LLMMathChain._evaluate(\"\nint(numexpr.evaluate(\"max(prime_numbers(68))\"))\n\") raised error: 'VariableNode' object has no attribute 'evaluate'. Please try again with a valid numerical expression", + "output_type": "error", + "traceback": [ + "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m", + "\u001B[0;31mAttributeError\u001B[0m Traceback (most recent call last)", + "File \u001B[0;32m~/code/others/langchain-tutorials/venv/lib/python3.11/site-packages/langchain/chains/llm_math/base.py:80\u001B[0m, in \u001B[0;36mLLMMathChain._evaluate_expression\u001B[0;34m(self, expression)\u001B[0m\n\u001B[1;32m 78\u001B[0m local_dict \u001B[38;5;241m=\u001B[39m {\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mpi\u001B[39m\u001B[38;5;124m\"\u001B[39m: math\u001B[38;5;241m.\u001B[39mpi, \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124me\u001B[39m\u001B[38;5;124m\"\u001B[39m: math\u001B[38;5;241m.\u001B[39me}\n\u001B[1;32m 79\u001B[0m output \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mstr\u001B[39m(\n\u001B[0;32m---> 80\u001B[0m \u001B[43mnumexpr\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mevaluate\u001B[49m\u001B[43m(\u001B[49m\n\u001B[1;32m 81\u001B[0m \u001B[43m \u001B[49m\u001B[43mexpression\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mstrip\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 82\u001B[0m \u001B[43m \u001B[49m\u001B[43mglobal_dict\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43m{\u001B[49m\u001B[43m}\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;66;43;03m# restrict access to globals\u001B[39;49;00m\n\u001B[1;32m 83\u001B[0m \u001B[43m \u001B[49m\u001B[43mlocal_dict\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mlocal_dict\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;66;43;03m# add common mathematical functions\u001B[39;49;00m\n\u001B[1;32m 84\u001B[0m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 85\u001B[0m )\n\u001B[1;32m 86\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mException\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m e:\n", + "File \u001B[0;32m~/code/others/langchain-tutorials/venv/lib/python3.11/site-packages/numexpr/necompiler.py:817\u001B[0m, in \u001B[0;36mevaluate\u001B[0;34m(ex, local_dict, global_dict, out, order, casting, **kwargs)\u001B[0m\n\u001B[1;32m 816\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m expr_key \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;129;01min\u001B[39;00m _names_cache:\n\u001B[0;32m--> 817\u001B[0m _names_cache[expr_key] \u001B[38;5;241m=\u001B[39m \u001B[43mgetExprNames\u001B[49m\u001B[43m(\u001B[49m\u001B[43mex\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcontext\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 818\u001B[0m names, ex_uses_vml \u001B[38;5;241m=\u001B[39m _names_cache[expr_key]\n", + "File \u001B[0;32m~/code/others/langchain-tutorials/venv/lib/python3.11/site-packages/numexpr/necompiler.py:704\u001B[0m, in \u001B[0;36mgetExprNames\u001B[0;34m(text, context)\u001B[0m\n\u001B[1;32m 703\u001B[0m \u001B[38;5;28;01mdef\u001B[39;00m \u001B[38;5;21mgetExprNames\u001B[39m(text, context):\n\u001B[0;32m--> 704\u001B[0m ex \u001B[38;5;241m=\u001B[39m \u001B[43mstringToExpression\u001B[49m\u001B[43m(\u001B[49m\u001B[43mtext\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43m{\u001B[49m\u001B[43m}\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcontext\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 705\u001B[0m ast \u001B[38;5;241m=\u001B[39m expressionToAST(ex)\n", + "File \u001B[0;32m~/code/others/langchain-tutorials/venv/lib/python3.11/site-packages/numexpr/necompiler.py:289\u001B[0m, in \u001B[0;36mstringToExpression\u001B[0;34m(s, types, context)\u001B[0m\n\u001B[1;32m 288\u001B[0m \u001B[38;5;66;03m# now build the expression\u001B[39;00m\n\u001B[0;32m--> 289\u001B[0m ex \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;43meval\u001B[39;49m\u001B[43m(\u001B[49m\u001B[43mc\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mnames\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 290\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m expressions\u001B[38;5;241m.\u001B[39misConstant(ex):\n", + "File \u001B[0;32m:1\u001B[0m\n", + "\u001B[0;31mAttributeError\u001B[0m: 'VariableNode' object has no attribute 'evaluate'", + "\nDuring handling of the above exception, another exception occurred:\n", + "\u001B[0;31mValueError\u001B[0m Traceback (most recent call last)", + "Cell \u001B[0;32mIn[24], line 2\u001B[0m\n\u001B[1;32m 1\u001B[0m \u001B[38;5;66;03m# Now let's test it out!\u001B[39;00m\n\u001B[0;32m----> 2\u001B[0m \u001B[43magent\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mrun\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mWho is the current leader of Japan? What is the largest prime number that is smaller than their age?\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m)\u001B[49m\n", + "File \u001B[0;32m~/code/others/langchain-tutorials/venv/lib/python3.11/site-packages/langchain/chains/base.py:236\u001B[0m, in \u001B[0;36mChain.run\u001B[0;34m(self, callbacks, *args, **kwargs)\u001B[0m\n\u001B[1;32m 234\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mlen\u001B[39m(args) \u001B[38;5;241m!=\u001B[39m \u001B[38;5;241m1\u001B[39m:\n\u001B[1;32m 235\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m \u001B[38;5;167;01mValueError\u001B[39;00m(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m`run` supports only one positional argument.\u001B[39m\u001B[38;5;124m\"\u001B[39m)\n\u001B[0;32m--> 236\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m(\u001B[49m\u001B[43margs\u001B[49m\u001B[43m[\u001B[49m\u001B[38;5;241;43m0\u001B[39;49m\u001B[43m]\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcallbacks\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mcallbacks\u001B[49m\u001B[43m)\u001B[49m[\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39moutput_keys[\u001B[38;5;241m0\u001B[39m]]\n\u001B[1;32m 238\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m kwargs \u001B[38;5;129;01mand\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m args:\n\u001B[1;32m 239\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m(kwargs, callbacks\u001B[38;5;241m=\u001B[39mcallbacks)[\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39moutput_keys[\u001B[38;5;241m0\u001B[39m]]\n", + "File \u001B[0;32m~/code/others/langchain-tutorials/venv/lib/python3.11/site-packages/langchain/chains/base.py:140\u001B[0m, in \u001B[0;36mChain.__call__\u001B[0;34m(self, inputs, return_only_outputs, callbacks)\u001B[0m\n\u001B[1;32m 138\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m (\u001B[38;5;167;01mKeyboardInterrupt\u001B[39;00m, \u001B[38;5;167;01mException\u001B[39;00m) \u001B[38;5;28;01mas\u001B[39;00m e:\n\u001B[1;32m 139\u001B[0m run_manager\u001B[38;5;241m.\u001B[39mon_chain_error(e)\n\u001B[0;32m--> 140\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m e\n\u001B[1;32m 141\u001B[0m run_manager\u001B[38;5;241m.\u001B[39mon_chain_end(outputs)\n\u001B[1;32m 142\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mprep_outputs(inputs, outputs, return_only_outputs)\n", + "File \u001B[0;32m~/code/others/langchain-tutorials/venv/lib/python3.11/site-packages/langchain/chains/base.py:134\u001B[0m, in \u001B[0;36mChain.__call__\u001B[0;34m(self, inputs, return_only_outputs, callbacks)\u001B[0m\n\u001B[1;32m 128\u001B[0m run_manager \u001B[38;5;241m=\u001B[39m callback_manager\u001B[38;5;241m.\u001B[39mon_chain_start(\n\u001B[1;32m 129\u001B[0m {\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mname\u001B[39m\u001B[38;5;124m\"\u001B[39m: \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m\u001B[38;5;18m__class__\u001B[39m\u001B[38;5;241m.\u001B[39m\u001B[38;5;18m__name__\u001B[39m},\n\u001B[1;32m 130\u001B[0m inputs,\n\u001B[1;32m 131\u001B[0m )\n\u001B[1;32m 132\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[1;32m 133\u001B[0m outputs \u001B[38;5;241m=\u001B[39m (\n\u001B[0;32m--> 134\u001B[0m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_call\u001B[49m\u001B[43m(\u001B[49m\u001B[43minputs\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mrun_manager\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mrun_manager\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 135\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m new_arg_supported\n\u001B[1;32m 136\u001B[0m \u001B[38;5;28;01melse\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_call(inputs)\n\u001B[1;32m 137\u001B[0m )\n\u001B[1;32m 138\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m (\u001B[38;5;167;01mKeyboardInterrupt\u001B[39;00m, \u001B[38;5;167;01mException\u001B[39;00m) \u001B[38;5;28;01mas\u001B[39;00m e:\n\u001B[1;32m 139\u001B[0m run_manager\u001B[38;5;241m.\u001B[39mon_chain_error(e)\n", + "File \u001B[0;32m~/code/others/langchain-tutorials/venv/lib/python3.11/site-packages/langchain/agents/agent.py:953\u001B[0m, in \u001B[0;36mAgentExecutor._call\u001B[0;34m(self, inputs, run_manager)\u001B[0m\n\u001B[1;32m 951\u001B[0m \u001B[38;5;66;03m# We now enter the agent loop (until it returns something).\u001B[39;00m\n\u001B[1;32m 952\u001B[0m \u001B[38;5;28;01mwhile\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_should_continue(iterations, time_elapsed):\n\u001B[0;32m--> 953\u001B[0m next_step_output \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_take_next_step\u001B[49m\u001B[43m(\u001B[49m\n\u001B[1;32m 954\u001B[0m \u001B[43m \u001B[49m\u001B[43mname_to_tool_map\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 955\u001B[0m \u001B[43m \u001B[49m\u001B[43mcolor_mapping\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 956\u001B[0m \u001B[43m \u001B[49m\u001B[43minputs\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 957\u001B[0m \u001B[43m \u001B[49m\u001B[43mintermediate_steps\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 958\u001B[0m \u001B[43m \u001B[49m\u001B[43mrun_manager\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mrun_manager\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 959\u001B[0m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 960\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28misinstance\u001B[39m(next_step_output, AgentFinish):\n\u001B[1;32m 961\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_return(\n\u001B[1;32m 962\u001B[0m next_step_output, intermediate_steps, run_manager\u001B[38;5;241m=\u001B[39mrun_manager\n\u001B[1;32m 963\u001B[0m )\n", + "File \u001B[0;32m~/code/others/langchain-tutorials/venv/lib/python3.11/site-packages/langchain/agents/agent.py:820\u001B[0m, in \u001B[0;36mAgentExecutor._take_next_step\u001B[0;34m(self, name_to_tool_map, color_mapping, inputs, intermediate_steps, run_manager)\u001B[0m\n\u001B[1;32m 818\u001B[0m tool_run_kwargs[\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mllm_prefix\u001B[39m\u001B[38;5;124m\"\u001B[39m] \u001B[38;5;241m=\u001B[39m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[1;32m 819\u001B[0m \u001B[38;5;66;03m# We then call the tool on the tool input to get an observation\u001B[39;00m\n\u001B[0;32m--> 820\u001B[0m observation \u001B[38;5;241m=\u001B[39m \u001B[43mtool\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mrun\u001B[49m\u001B[43m(\u001B[49m\n\u001B[1;32m 821\u001B[0m \u001B[43m \u001B[49m\u001B[43magent_action\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mtool_input\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 822\u001B[0m \u001B[43m \u001B[49m\u001B[43mverbose\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mverbose\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 823\u001B[0m \u001B[43m \u001B[49m\u001B[43mcolor\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mcolor\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 824\u001B[0m \u001B[43m \u001B[49m\u001B[43mcallbacks\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mrun_manager\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mget_child\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43;01mif\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mrun_manager\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43;01melse\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[38;5;28;43;01mNone\u001B[39;49;00m\u001B[43m,\u001B[49m\n\u001B[1;32m 825\u001B[0m \u001B[43m \u001B[49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[43mtool_run_kwargs\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 826\u001B[0m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 827\u001B[0m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[1;32m 828\u001B[0m tool_run_kwargs \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39magent\u001B[38;5;241m.\u001B[39mtool_run_logging_kwargs()\n", + "File \u001B[0;32m~/code/others/langchain-tutorials/venv/lib/python3.11/site-packages/langchain/tools/base.py:255\u001B[0m, in \u001B[0;36mBaseTool.run\u001B[0;34m(self, tool_input, verbose, start_color, color, callbacks, **kwargs)\u001B[0m\n\u001B[1;32m 253\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m (\u001B[38;5;167;01mException\u001B[39;00m, \u001B[38;5;167;01mKeyboardInterrupt\u001B[39;00m) \u001B[38;5;28;01mas\u001B[39;00m e:\n\u001B[1;32m 254\u001B[0m run_manager\u001B[38;5;241m.\u001B[39mon_tool_error(e)\n\u001B[0;32m--> 255\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m e\n\u001B[1;32m 256\u001B[0m run_manager\u001B[38;5;241m.\u001B[39mon_tool_end(\u001B[38;5;28mstr\u001B[39m(observation), color\u001B[38;5;241m=\u001B[39mcolor, name\u001B[38;5;241m=\u001B[39m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mname, \u001B[38;5;241m*\u001B[39m\u001B[38;5;241m*\u001B[39mkwargs)\n\u001B[1;32m 257\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m observation\n", + "File \u001B[0;32m~/code/others/langchain-tutorials/venv/lib/python3.11/site-packages/langchain/tools/base.py:249\u001B[0m, in \u001B[0;36mBaseTool.run\u001B[0;34m(self, tool_input, verbose, start_color, color, callbacks, **kwargs)\u001B[0m\n\u001B[1;32m 246\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[1;32m 247\u001B[0m tool_args, tool_kwargs \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_to_args_and_kwargs(parsed_input)\n\u001B[1;32m 248\u001B[0m observation \u001B[38;5;241m=\u001B[39m (\n\u001B[0;32m--> 249\u001B[0m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_run\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[43mtool_args\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mrun_manager\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mrun_manager\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[43mtool_kwargs\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 250\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m new_arg_supported\n\u001B[1;32m 251\u001B[0m \u001B[38;5;28;01melse\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_run(\u001B[38;5;241m*\u001B[39mtool_args, \u001B[38;5;241m*\u001B[39m\u001B[38;5;241m*\u001B[39mtool_kwargs)\n\u001B[1;32m 252\u001B[0m )\n\u001B[1;32m 253\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m (\u001B[38;5;167;01mException\u001B[39;00m, \u001B[38;5;167;01mKeyboardInterrupt\u001B[39;00m) \u001B[38;5;28;01mas\u001B[39;00m e:\n\u001B[1;32m 254\u001B[0m run_manager\u001B[38;5;241m.\u001B[39mon_tool_error(e)\n", + "File \u001B[0;32m~/code/others/langchain-tutorials/venv/lib/python3.11/site-packages/langchain/tools/base.py:344\u001B[0m, in \u001B[0;36mTool._run\u001B[0;34m(self, run_manager, *args, **kwargs)\u001B[0m\n\u001B[1;32m 341\u001B[0m \u001B[38;5;250m\u001B[39m\u001B[38;5;124;03m\"\"\"Use the tool.\"\"\"\u001B[39;00m\n\u001B[1;32m 342\u001B[0m new_argument_supported \u001B[38;5;241m=\u001B[39m signature(\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mfunc)\u001B[38;5;241m.\u001B[39mparameters\u001B[38;5;241m.\u001B[39mget(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mcallbacks\u001B[39m\u001B[38;5;124m\"\u001B[39m)\n\u001B[1;32m 343\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m (\n\u001B[0;32m--> 344\u001B[0m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mfunc\u001B[49m\u001B[43m(\u001B[49m\n\u001B[1;32m 345\u001B[0m \u001B[43m \u001B[49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[43margs\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 346\u001B[0m \u001B[43m \u001B[49m\u001B[43mcallbacks\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mrun_manager\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mget_child\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43;01mif\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mrun_manager\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43;01melse\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[38;5;28;43;01mNone\u001B[39;49;00m\u001B[43m,\u001B[49m\n\u001B[1;32m 347\u001B[0m \u001B[43m \u001B[49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[43mkwargs\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 348\u001B[0m \u001B[43m \u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 349\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m new_argument_supported\n\u001B[1;32m 350\u001B[0m \u001B[38;5;28;01melse\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mfunc(\u001B[38;5;241m*\u001B[39margs, \u001B[38;5;241m*\u001B[39m\u001B[38;5;241m*\u001B[39mkwargs)\n\u001B[1;32m 351\u001B[0m )\n", + "File \u001B[0;32m~/code/others/langchain-tutorials/venv/lib/python3.11/site-packages/langchain/chains/base.py:236\u001B[0m, in \u001B[0;36mChain.run\u001B[0;34m(self, callbacks, *args, **kwargs)\u001B[0m\n\u001B[1;32m 234\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mlen\u001B[39m(args) \u001B[38;5;241m!=\u001B[39m \u001B[38;5;241m1\u001B[39m:\n\u001B[1;32m 235\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m \u001B[38;5;167;01mValueError\u001B[39;00m(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m`run` supports only one positional argument.\u001B[39m\u001B[38;5;124m\"\u001B[39m)\n\u001B[0;32m--> 236\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[43m(\u001B[49m\u001B[43margs\u001B[49m\u001B[43m[\u001B[49m\u001B[38;5;241;43m0\u001B[39;49m\u001B[43m]\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcallbacks\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mcallbacks\u001B[49m\u001B[43m)\u001B[49m[\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39moutput_keys[\u001B[38;5;241m0\u001B[39m]]\n\u001B[1;32m 238\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m kwargs \u001B[38;5;129;01mand\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m args:\n\u001B[1;32m 239\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m(kwargs, callbacks\u001B[38;5;241m=\u001B[39mcallbacks)[\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39moutput_keys[\u001B[38;5;241m0\u001B[39m]]\n", + "File \u001B[0;32m~/code/others/langchain-tutorials/venv/lib/python3.11/site-packages/langchain/chains/base.py:140\u001B[0m, in \u001B[0;36mChain.__call__\u001B[0;34m(self, inputs, return_only_outputs, callbacks)\u001B[0m\n\u001B[1;32m 138\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m (\u001B[38;5;167;01mKeyboardInterrupt\u001B[39;00m, \u001B[38;5;167;01mException\u001B[39;00m) \u001B[38;5;28;01mas\u001B[39;00m e:\n\u001B[1;32m 139\u001B[0m run_manager\u001B[38;5;241m.\u001B[39mon_chain_error(e)\n\u001B[0;32m--> 140\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m e\n\u001B[1;32m 141\u001B[0m run_manager\u001B[38;5;241m.\u001B[39mon_chain_end(outputs)\n\u001B[1;32m 142\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mprep_outputs(inputs, outputs, return_only_outputs)\n", + "File \u001B[0;32m~/code/others/langchain-tutorials/venv/lib/python3.11/site-packages/langchain/chains/base.py:134\u001B[0m, in \u001B[0;36mChain.__call__\u001B[0;34m(self, inputs, return_only_outputs, callbacks)\u001B[0m\n\u001B[1;32m 128\u001B[0m run_manager \u001B[38;5;241m=\u001B[39m callback_manager\u001B[38;5;241m.\u001B[39mon_chain_start(\n\u001B[1;32m 129\u001B[0m {\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mname\u001B[39m\u001B[38;5;124m\"\u001B[39m: \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m\u001B[38;5;18m__class__\u001B[39m\u001B[38;5;241m.\u001B[39m\u001B[38;5;18m__name__\u001B[39m},\n\u001B[1;32m 130\u001B[0m inputs,\n\u001B[1;32m 131\u001B[0m )\n\u001B[1;32m 132\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[1;32m 133\u001B[0m outputs \u001B[38;5;241m=\u001B[39m (\n\u001B[0;32m--> 134\u001B[0m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_call\u001B[49m\u001B[43m(\u001B[49m\u001B[43minputs\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mrun_manager\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mrun_manager\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 135\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m new_arg_supported\n\u001B[1;32m 136\u001B[0m \u001B[38;5;28;01melse\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_call(inputs)\n\u001B[1;32m 137\u001B[0m )\n\u001B[1;32m 138\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m (\u001B[38;5;167;01mKeyboardInterrupt\u001B[39;00m, \u001B[38;5;167;01mException\u001B[39;00m) \u001B[38;5;28;01mas\u001B[39;00m e:\n\u001B[1;32m 139\u001B[0m run_manager\u001B[38;5;241m.\u001B[39mon_chain_error(e)\n", + "File \u001B[0;32m~/code/others/langchain-tutorials/venv/lib/python3.11/site-packages/langchain/chains/llm_math/base.py:149\u001B[0m, in \u001B[0;36mLLMMathChain._call\u001B[0;34m(self, inputs, run_manager)\u001B[0m\n\u001B[1;32m 143\u001B[0m _run_manager\u001B[38;5;241m.\u001B[39mon_text(inputs[\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39minput_key])\n\u001B[1;32m 144\u001B[0m llm_output \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mllm_chain\u001B[38;5;241m.\u001B[39mpredict(\n\u001B[1;32m 145\u001B[0m question\u001B[38;5;241m=\u001B[39minputs[\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39minput_key],\n\u001B[1;32m 146\u001B[0m stop\u001B[38;5;241m=\u001B[39m[\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m```output\u001B[39m\u001B[38;5;124m\"\u001B[39m],\n\u001B[1;32m 147\u001B[0m callbacks\u001B[38;5;241m=\u001B[39m_run_manager\u001B[38;5;241m.\u001B[39mget_child(),\n\u001B[1;32m 148\u001B[0m )\n\u001B[0;32m--> 149\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_process_llm_result\u001B[49m\u001B[43m(\u001B[49m\u001B[43mllm_output\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43m_run_manager\u001B[49m\u001B[43m)\u001B[49m\n", + "File \u001B[0;32m~/code/others/langchain-tutorials/venv/lib/python3.11/site-packages/langchain/chains/llm_math/base.py:103\u001B[0m, in \u001B[0;36mLLMMathChain._process_llm_result\u001B[0;34m(self, llm_output, run_manager)\u001B[0m\n\u001B[1;32m 101\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m text_match:\n\u001B[1;32m 102\u001B[0m expression \u001B[38;5;241m=\u001B[39m text_match\u001B[38;5;241m.\u001B[39mgroup(\u001B[38;5;241m1\u001B[39m)\n\u001B[0;32m--> 103\u001B[0m output \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_evaluate_expression\u001B[49m\u001B[43m(\u001B[49m\u001B[43mexpression\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 104\u001B[0m run_manager\u001B[38;5;241m.\u001B[39mon_text(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;130;01m\\n\u001B[39;00m\u001B[38;5;124mAnswer: \u001B[39m\u001B[38;5;124m\"\u001B[39m, verbose\u001B[38;5;241m=\u001B[39m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mverbose)\n\u001B[1;32m 105\u001B[0m run_manager\u001B[38;5;241m.\u001B[39mon_text(output, color\u001B[38;5;241m=\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124myellow\u001B[39m\u001B[38;5;124m\"\u001B[39m, verbose\u001B[38;5;241m=\u001B[39m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mverbose)\n", + "File \u001B[0;32m~/code/others/langchain-tutorials/venv/lib/python3.11/site-packages/langchain/chains/llm_math/base.py:87\u001B[0m, in \u001B[0;36mLLMMathChain._evaluate_expression\u001B[0;34m(self, expression)\u001B[0m\n\u001B[1;32m 79\u001B[0m output \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mstr\u001B[39m(\n\u001B[1;32m 80\u001B[0m numexpr\u001B[38;5;241m.\u001B[39mevaluate(\n\u001B[1;32m 81\u001B[0m expression\u001B[38;5;241m.\u001B[39mstrip(),\n\u001B[0;32m (...)\u001B[0m\n\u001B[1;32m 84\u001B[0m )\n\u001B[1;32m 85\u001B[0m )\n\u001B[1;32m 86\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mException\u001B[39;00m \u001B[38;5;28;01mas\u001B[39;00m e:\n\u001B[0;32m---> 87\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m \u001B[38;5;167;01mValueError\u001B[39;00m(\n\u001B[1;32m 88\u001B[0m \u001B[38;5;124mf\u001B[39m\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mLLMMathChain._evaluate(\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;132;01m{\u001B[39;00mexpression\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m) raised error: \u001B[39m\u001B[38;5;132;01m{\u001B[39;00me\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m.\u001B[39m\u001B[38;5;124m'\u001B[39m\n\u001B[1;32m 89\u001B[0m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m Please try again with a valid numerical expression\u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[1;32m 90\u001B[0m )\n\u001B[1;32m 92\u001B[0m \u001B[38;5;66;03m# Remove any leading and trailing brackets from the output\u001B[39;00m\n\u001B[1;32m 93\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m re\u001B[38;5;241m.\u001B[39msub(\u001B[38;5;124mr\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m^\u001B[39m\u001B[38;5;124m\\\u001B[39m\u001B[38;5;124m[|\u001B[39m\u001B[38;5;124m\\\u001B[39m\u001B[38;5;124m]$\u001B[39m\u001B[38;5;124m\"\u001B[39m, \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m\"\u001B[39m, output)\n", + "\u001B[0;31mValueError\u001B[0m: LLMMathChain._evaluate(\"\nint(numexpr.evaluate(\"max(prime_numbers(68))\"))\n\") raised error: 'VariableNode' object has no attribute 'evaluate'. Please try again with a valid numerical expression" + ] } ], "source": [ @@ -426,7 +590,12 @@ "cell_type": "code", "execution_count": 26, "id": "dc3294d3", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:18:33.041115278Z", + "start_time": "2023-05-28T18:18:33.039383358Z" + } + }, "outputs": [], "source": [ "from langchain import OpenAI, ConversationChain" @@ -436,7 +605,12 @@ "cell_type": "code", "execution_count": 27, "id": "397ac43c", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:18:33.716373771Z", + "start_time": "2023-05-28T18:18:33.708438529Z" + } + }, "outputs": [], "source": [ "llm = OpenAI(temperature=0)\n", @@ -447,7 +621,12 @@ "cell_type": "code", "execution_count": 28, "id": "9823cde5", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:18:37.218665170Z", + "start_time": "2023-05-28T18:18:34.801447705Z" + } + }, "outputs": [ { "name": "stdout", @@ -455,23 +634,21 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new ConversationChain chain...\u001b[0m\n", + "\u001B[1m> Entering new ConversationChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mThe following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.\n", + "\u001B[32;1m\u001B[1;3mThe following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.\n", "\n", "Current conversation:\n", "\n", "Human: Hi there!\n", - "AI:\u001b[0m\n", + "AI:\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] }, { "data": { - "text/plain": [ - "\" Hi there! It's nice to meet you. How can I help you today?\"" - ] + "text/plain": "\" Hi there! It's nice to meet you. My name is AI. What's your name?\"" }, "execution_count": 28, "metadata": {}, @@ -486,7 +663,12 @@ "cell_type": "code", "execution_count": 29, "id": "a3d547bc", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:18:42.224743272Z", + "start_time": "2023-05-28T18:18:38.999004379Z" + } + }, "outputs": [ { "name": "stdout", @@ -494,25 +676,22 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new ConversationChain chain...\u001b[0m\n", + "\u001B[1m> Entering new ConversationChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mThe following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.\n", + "\u001B[32;1m\u001B[1;3mThe following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.\n", "\n", "Current conversation:\n", - "\n", "Human: Hi there!\n", - "AI: Hi there! It's nice to meet you. How can I help you today?\n", + "AI: Hi there! It's nice to meet you. My name is AI. What's your name?\n", "Human: I'm doing well! Just having a conversation with an AI.\n", - "AI:\u001b[0m\n", + "AI:\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] }, { "data": { - "text/plain": [ - "\" That's great! It's always nice to have a conversation with someone new. What would you like to talk about?\"" - ] + "text/plain": "\" That's great! It's always nice to have a conversation with someone new. What would you like to talk about?\"" }, "execution_count": 29, "metadata": {}, @@ -527,7 +706,12 @@ "cell_type": "code", "execution_count": 30, "id": "bb71a25c", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:18:44.387781903Z", + "start_time": "2023-05-28T18:18:43.380569167Z" + } + }, "outputs": [ { "name": "stdout", @@ -535,27 +719,24 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new ConversationChain chain...\u001b[0m\n", + "\u001B[1m> Entering new ConversationChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mThe following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.\n", + "\u001B[32;1m\u001B[1;3mThe following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.\n", "\n", "Current conversation:\n", - "\n", "Human: Hi there!\n", - "AI: Hi there! It's nice to meet you. How can I help you today?\n", + "AI: Hi there! It's nice to meet you. My name is AI. What's your name?\n", "Human: I'm doing well! Just having a conversation with an AI.\n", "AI: That's great! It's always nice to have a conversation with someone new. What would you like to talk about?\n", "Human: What was the first thing I said to you?\n", - "AI:\u001b[0m\n", + "AI:\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] }, { "data": { - "text/plain": [ - "' You said \"Hi there!\"'" - ] + "text/plain": "' You said \"Hi there!\"'" }, "execution_count": 30, "metadata": {}, @@ -570,7 +751,12 @@ "cell_type": "code", "execution_count": 31, "id": "0d7daf49", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:18:46.330270580Z", + "start_time": "2023-05-28T18:18:44.891510349Z" + } + }, "outputs": [ { "name": "stdout", @@ -578,29 +764,26 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new ConversationChain chain...\u001b[0m\n", + "\u001B[1m> Entering new ConversationChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mThe following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.\n", + "\u001B[32;1m\u001B[1;3mThe following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.\n", "\n", "Current conversation:\n", - "\n", "Human: Hi there!\n", - "AI: Hi there! It's nice to meet you. How can I help you today?\n", + "AI: Hi there! It's nice to meet you. My name is AI. What's your name?\n", "Human: I'm doing well! Just having a conversation with an AI.\n", "AI: That's great! It's always nice to have a conversation with someone new. What would you like to talk about?\n", "Human: What was the first thing I said to you?\n", "AI: You said \"Hi there!\"\n", "Human: what is an alternative phrase for the first thing I said to you?\n", - "AI:\u001b[0m\n", + "AI:\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] }, { "data": { - "text/plain": [ - "' An alternative phrase for the first thing you said to me could be \"Greetings!\"'" - ] + "text/plain": "' An alternative phrase for the first thing you said to me could be \"Greetings!\"'" }, "execution_count": 31, "metadata": {}, @@ -613,11 +796,25 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "id": "f3934501", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2023-05-28T18:18:15.406271656Z", + "start_time": "2023-05-28T18:18:15.401792098Z" + } + }, "outputs": [], "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [], + "metadata": { + "collapsed": false + } } ], "metadata": { diff --git a/loaders/Google Drive Loader.ipynb b/loaders/Google Drive Loader.ipynb index 73f4372..c0505de 100644 --- a/loaders/Google Drive Loader.ipynb +++ b/loaders/Google Drive Loader.ipynb @@ -30,6 +30,9 @@ "metadata": {}, "outputs": [], "source": [ + "from dotenv import find_dotenv, load_dotenv\n", + "load_dotenv(find_dotenv())\n", + "\n", "# %set_env OPENAI_API_KEY = ..." ] }, @@ -74,9 +77,9 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new MapReduceDocumentsChain chain...\u001b[0m\n", + "\u001B[1m> Entering new MapReduceDocumentsChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"SecondaryEquityHub\n", @@ -126,22 +129,22 @@ " 1. Benefit: This feature ensures that buyers and sellers are matched efficiently based on their preferences, resulting in a faster and more efficient transaction process. It provides buyers with a wider range of investment options, while also ensuring that sellers can access a larger pool of potential buyers.\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "\n", "\n", - "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", + "\u001B[1m> Entering new LLMChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\" SecondaryEquityHub is a marketplace that connects startup employees who want to sell vested equity to buyers of secondary market shares. It provides a win-win situation for both parties by providing liquidity options for employees and investment opportunities for buyers. The platform also ensures secure transactions, automated compliance, transparent pricing, and an efficient matching system.\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] }, { @@ -224,12 +227,12 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new StuffDocumentsChain chain...\u001b[0m\n", + "\u001B[1m> Entering new StuffDocumentsChain chain...\u001B[0m\n", "\n", "\n", - "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", + "\u001B[1m> Entering new LLMChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mUse the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.\n", + "\u001B[32;1m\u001B[1;3mUse the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.\n", "\n", "SecondaryEquityHub\n", "2/21/2023\n", @@ -278,11 +281,11 @@ " 1. Benefit: This feature ensures that buyers and sellers are matched efficiently based on their preferences, resulting in a faster and more efficient transaction process. It provides buyers with a wider range of investment options, while also ensuring that sellers can access a larger pool of potential buyers.\n", "\n", "Question: How should we reach our target audience of this product?\n", - "Helpful Answer:\u001b[0m\n", + "Helpful Answer:\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] }, { @@ -339,12 +342,12 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new StuffDocumentsChain chain...\u001b[0m\n", + "\u001B[1m> Entering new StuffDocumentsChain chain...\u001B[0m\n", "\n", "\n", - "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", + "\u001B[1m> Entering new LLMChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mUse the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.\n", + "\u001B[32;1m\u001B[1;3mUse the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.\n", "\n", "SecondaryEquityHub\n", "2/21/2023\n", @@ -418,11 +421,11 @@ "Eliza: Yes, those are all great points. We've been working on developing a secure platform that includes a vetting process for the sellers and the shares they're selling, and we're also planning to provide transparent pricing information. Thank you for your input, Sally. It was great to chat with you today.\n", "\n", "Question: What are users saying about our product?\n", - "Helpful Answer:\u001b[0m\n", + "Helpful Answer:\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] }, { diff --git a/loaders/YouTube Loader.ipynb b/loaders/YouTube Loader.ipynb index def8593..40e19f8 100644 --- a/loaders/YouTube Loader.ipynb +++ b/loaders/YouTube Loader.ipynb @@ -21,7 +21,10 @@ }, "outputs": [], "source": [ - "OPENAI_API_KEY = '...'" + "from dotenv import find_dotenv, load_dotenv\n", + "load_dotenv(find_dotenv())\n", + "\n", + "#OPENAI_API_KEY = '...'" ] }, { @@ -162,37 +165,37 @@ "evalue": "This model's maximum context length is 4097 tokens, however you requested 14199 tokens (13943 in your prompt; 256 for the completion). Please reduce your prompt; or completion length.", "output_type": "error", "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mInvalidRequestError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/var/folders/5c/csjfqsk97xz704h7v3fzjqph0000gn/T/ipykernel_10827/3887462961.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0mchain\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mload_summarize_chain\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mllm\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mchain_type\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"stuff\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mchain\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresult\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 237\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 238\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"`run` supports only one positional argument.\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 239\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0moutput_keys\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 240\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 241\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mkwargs\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0margs\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, inputs, return_only_outputs)\u001b[0m\n\u001b[1;32m 140\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 141\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_chain_error\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 142\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 143\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_chain_end\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moutputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 144\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprep_outputs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moutputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreturn_only_outputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, inputs, return_only_outputs)\u001b[0m\n\u001b[1;32m 137\u001b[0m )\n\u001b[1;32m 138\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 139\u001b[0;31m \u001b[0moutputs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 140\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 141\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_chain_error\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/combine_documents/base.py\u001b[0m in \u001b[0;36m_call\u001b[0;34m(self, inputs)\u001b[0m\n\u001b[1;32m 54\u001b[0m \u001b[0;31m# Other keys are assumed to be needed for LLM prediction\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 55\u001b[0m \u001b[0mother_keys\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0mk\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mv\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mk\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mv\u001b[0m \u001b[0;32min\u001b[0m \u001b[0minputs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mk\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minput_key\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 56\u001b[0;31m \u001b[0moutput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mextra_return_dict\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcombine_docs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdocs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mother_keys\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 57\u001b[0m \u001b[0mextra_return_dict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0moutput_key\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 58\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mextra_return_dict\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/combine_documents/stuff.py\u001b[0m in \u001b[0;36mcombine_docs\u001b[0;34m(self, docs, **kwargs)\u001b[0m\n\u001b[1;32m 87\u001b[0m \u001b[0minputs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_inputs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdocs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 88\u001b[0m \u001b[0;31m# Call predict on the LLM.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 89\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mllm_chain\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpredict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 90\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 91\u001b[0m async def acombine_docs(\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/llm.py\u001b[0m in \u001b[0;36mpredict\u001b[0;34m(self, **kwargs)\u001b[0m\n\u001b[1;32m 151\u001b[0m \u001b[0mcompletion\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mllm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpredict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0madjective\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"funny\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 152\u001b[0m \"\"\"\n\u001b[0;32m--> 153\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0moutput_key\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 154\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 155\u001b[0m \u001b[0;32masync\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mapredict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mAny\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, inputs, return_only_outputs)\u001b[0m\n\u001b[1;32m 140\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 141\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_chain_error\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 142\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 143\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_chain_end\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moutputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 144\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprep_outputs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moutputs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreturn_only_outputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, inputs, return_only_outputs)\u001b[0m\n\u001b[1;32m 137\u001b[0m )\n\u001b[1;32m 138\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 139\u001b[0;31m \u001b[0moutputs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 140\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 141\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_chain_error\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/llm.py\u001b[0m in \u001b[0;36m_call\u001b[0;34m(self, inputs)\u001b[0m\n\u001b[1;32m 132\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 133\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minputs\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mDict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mstr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mAny\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mDict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mstr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 134\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapply\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0minputs\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 135\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 136\u001b[0m \u001b[0;32masync\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_acall\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minputs\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mDict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mstr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mAny\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mDict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mstr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/llm.py\u001b[0m in \u001b[0;36mapply\u001b[0;34m(self, input_list)\u001b[0m\n\u001b[1;32m 115\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mapply\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minput_list\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mList\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mDict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mstr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mAny\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mList\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mDict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mstr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 116\u001b[0m \u001b[0;34m\"\"\"Utilize the LLM generate method for speed gains.\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 117\u001b[0;31m \u001b[0mresponse\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgenerate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput_list\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 118\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcreate_outputs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresponse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 119\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/llm.py\u001b[0m in \u001b[0;36mgenerate\u001b[0;34m(self, input_list)\u001b[0m\n\u001b[1;32m 57\u001b[0m \u001b[0;34m\"\"\"Generate LLM result from inputs.\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 58\u001b[0m \u001b[0mprompts\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstop\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprep_prompts\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput_list\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 59\u001b[0;31m \u001b[0mresponse\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mllm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgenerate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprompts\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstop\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mstop\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 60\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mresponse\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/base.py\u001b[0m in \u001b[0;36mgenerate\u001b[0;34m(self, prompts, stop)\u001b[0m\n\u001b[1;32m 126\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 127\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_llm_error\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 128\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 129\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_llm_end\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moutput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 130\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0moutput\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/base.py\u001b[0m in \u001b[0;36mgenerate\u001b[0;34m(self, prompts, stop)\u001b[0m\n\u001b[1;32m 123\u001b[0m )\n\u001b[1;32m 124\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 125\u001b[0;31m \u001b[0moutput\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_generate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprompts\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstop\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mstop\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 126\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 127\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallback_manager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mon_llm_error\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0me\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mverbose\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mverbose\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/openai.py\u001b[0m in \u001b[0;36m_generate\u001b[0;34m(self, prompts, stop)\u001b[0m\n\u001b[1;32m 257\u001b[0m \u001b[0mchoices\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mextend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresponse\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"choices\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 258\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 259\u001b[0;31m \u001b[0mresponse\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcompletion_with_retry\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprompt\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0m_prompts\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mparams\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 260\u001b[0m \u001b[0mchoices\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mextend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresponse\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"choices\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 261\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstreaming\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/openai.py\u001b[0m in \u001b[0;36mcompletion_with_retry\u001b[0;34m(self, **kwargs)\u001b[0m\n\u001b[1;32m 204\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclient\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcreate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 206\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0m_completion_with_retry\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 207\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 208\u001b[0m \u001b[0;32masync\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0macompletion_with_retry\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mAny\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mAny\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/tenacity/__init__.py\u001b[0m in \u001b[0;36mwrapped_f\u001b[0;34m(*args, **kw)\u001b[0m\n\u001b[1;32m 287\u001b[0m \u001b[0;34m@\u001b[0m\u001b[0mfunctools\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwraps\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 288\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mwrapped_f\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mAny\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mAny\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mAny\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 289\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 290\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 291\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mretry_with\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mAny\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mAny\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mWrappedFn\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/tenacity/__init__.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, fn, *args, **kwargs)\u001b[0m\n\u001b[1;32m 377\u001b[0m \u001b[0mretry_state\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mRetryCallState\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mretry_object\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfn\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfn\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0margs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 378\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 379\u001b[0;31m \u001b[0mdo\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0miter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mretry_state\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mretry_state\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 380\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdo\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mDoAttempt\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 381\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/tenacity/__init__.py\u001b[0m in \u001b[0;36miter\u001b[0;34m(self, retry_state)\u001b[0m\n\u001b[1;32m 312\u001b[0m \u001b[0mis_explicit_retry\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfut\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfailed\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfut\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexception\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mTryAgain\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 313\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mis_explicit_retry\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mretry\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mretry_state\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 314\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfut\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mresult\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 315\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 316\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mafter\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/concurrent/futures/_base.py\u001b[0m in \u001b[0;36mresult\u001b[0;34m(self, timeout)\u001b[0m\n\u001b[1;32m 437\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mCancelledError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 438\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_state\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mFINISHED\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 439\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__get_result\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 440\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 441\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_condition\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwait\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/concurrent/futures/_base.py\u001b[0m in \u001b[0;36m__get_result\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 389\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_exception\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 390\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 391\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_exception\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 392\u001b[0m \u001b[0;32mfinally\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 393\u001b[0m \u001b[0;31m# Break a reference cycle with the exception in self._exception\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/tenacity/__init__.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, fn, *args, **kwargs)\u001b[0m\n\u001b[1;32m 380\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdo\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mDoAttempt\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 381\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 382\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 383\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mBaseException\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# noqa: B902\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 384\u001b[0m \u001b[0mretry_state\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mset_exception\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msys\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexc_info\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# type: ignore[arg-type]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/openai.py\u001b[0m in \u001b[0;36m_completion_with_retry\u001b[0;34m(**kwargs)\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;34m@\u001b[0m\u001b[0mretry_decorator\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 203\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_completion_with_retry\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mAny\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mAny\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 204\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclient\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcreate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 205\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 206\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0m_completion_with_retry\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_resources/completion.py\u001b[0m in \u001b[0;36mcreate\u001b[0;34m(cls, *args, **kwargs)\u001b[0m\n\u001b[1;32m 23\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 24\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 25\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcreate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 26\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mTryAgain\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 27\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mtimeout\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mtime\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtime\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m>\u001b[0m \u001b[0mstart\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_resources/abstract/engine_api_resource.py\u001b[0m in \u001b[0;36mcreate\u001b[0;34m(cls, api_key, api_base, api_type, request_id, api_version, organization, **params)\u001b[0m\n\u001b[1;32m 151\u001b[0m )\n\u001b[1;32m 152\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 153\u001b[0;31m response, _, api_key = requestor.request(\n\u001b[0m\u001b[1;32m 154\u001b[0m \u001b[0;34m\"post\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 155\u001b[0m \u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_requestor.py\u001b[0m in \u001b[0;36mrequest\u001b[0;34m(self, method, url, params, headers, files, stream, request_id, request_timeout)\u001b[0m\n\u001b[1;32m 225\u001b[0m \u001b[0mrequest_timeout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mrequest_timeout\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 226\u001b[0m )\n\u001b[0;32m--> 227\u001b[0;31m \u001b[0mresp\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mgot_stream\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_interpret_response\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresult\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstream\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 228\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mresp\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mgot_stream\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapi_key\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 229\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_requestor.py\u001b[0m in \u001b[0;36m_interpret_response\u001b[0;34m(self, result, stream)\u001b[0m\n\u001b[1;32m 618\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 619\u001b[0m return (\n\u001b[0;32m--> 620\u001b[0;31m self._interpret_response_line(\n\u001b[0m\u001b[1;32m 621\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcontent\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdecode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"utf-8\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 622\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatus_code\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_requestor.py\u001b[0m in \u001b[0;36m_interpret_response_line\u001b[0;34m(self, rbody, rcode, rheaders, stream)\u001b[0m\n\u001b[1;32m 678\u001b[0m \u001b[0mstream_error\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstream\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;34m\"error\"\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mresp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 679\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mstream_error\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;36m200\u001b[0m \u001b[0;34m<=\u001b[0m \u001b[0mrcode\u001b[0m \u001b[0;34m<\u001b[0m \u001b[0;36m300\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 680\u001b[0;31m raise self.handle_error_response(\n\u001b[0m\u001b[1;32m 681\u001b[0m \u001b[0mrbody\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrcode\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mresp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrheaders\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstream_error\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mstream_error\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 682\u001b[0m )\n", - "\u001b[0;31mInvalidRequestError\u001b[0m: This model's maximum context length is 4097 tokens, however you requested 14199 tokens (13943 in your prompt; 256 for the completion). Please reduce your prompt; or completion length." + "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m", + "\u001B[0;31mInvalidRequestError\u001B[0m Traceback (most recent call last)", + "\u001B[0;32m/var/folders/5c/csjfqsk97xz704h7v3fzjqph0000gn/T/ipykernel_10827/3887462961.py\u001B[0m in \u001B[0;36m\u001B[0;34m\u001B[0m\n\u001B[1;32m 1\u001B[0m \u001B[0mchain\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mload_summarize_chain\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mllm\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mchain_type\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0;34m\"stuff\"\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0;32mFalse\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m----> 2\u001B[0;31m \u001B[0mchain\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mrun\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mresult\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001B[0m in \u001B[0;36mrun\u001B[0;34m(self, *args, **kwargs)\u001B[0m\n\u001B[1;32m 237\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mlen\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0margs\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m!=\u001B[0m \u001B[0;36m1\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 238\u001B[0m \u001B[0;32mraise\u001B[0m \u001B[0mValueError\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m\"`run` supports only one positional argument.\"\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 239\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0margs\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0;36m0\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0moutput_keys\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0;36m0\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 240\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 241\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mkwargs\u001B[0m \u001B[0;32mand\u001B[0m \u001B[0;32mnot\u001B[0m \u001B[0margs\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001B[0m in \u001B[0;36m__call__\u001B[0;34m(self, inputs, return_only_outputs)\u001B[0m\n\u001B[1;32m 140\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0;34m(\u001B[0m\u001B[0mKeyboardInterrupt\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mException\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 141\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_chain_error\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0me\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 142\u001B[0;31m \u001B[0;32mraise\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 143\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_chain_end\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0moutputs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 144\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mprep_outputs\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0minputs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0moutputs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mreturn_only_outputs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001B[0m in \u001B[0;36m__call__\u001B[0;34m(self, inputs, return_only_outputs)\u001B[0m\n\u001B[1;32m 137\u001B[0m )\n\u001B[1;32m 138\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 139\u001B[0;31m \u001B[0moutputs\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_call\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0minputs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 140\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0;34m(\u001B[0m\u001B[0mKeyboardInterrupt\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mException\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 141\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_chain_error\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0me\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/combine_documents/base.py\u001B[0m in \u001B[0;36m_call\u001B[0;34m(self, inputs)\u001B[0m\n\u001B[1;32m 54\u001B[0m \u001B[0;31m# Other keys are assumed to be needed for LLM prediction\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 55\u001B[0m \u001B[0mother_keys\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0;34m{\u001B[0m\u001B[0mk\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mv\u001B[0m \u001B[0;32mfor\u001B[0m \u001B[0mk\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mv\u001B[0m \u001B[0;32min\u001B[0m \u001B[0minputs\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mitems\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mk\u001B[0m \u001B[0;34m!=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0minput_key\u001B[0m\u001B[0;34m}\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m---> 56\u001B[0;31m \u001B[0moutput\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mextra_return_dict\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcombine_docs\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mdocs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mother_keys\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 57\u001B[0m \u001B[0mextra_return_dict\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0moutput_key\u001B[0m\u001B[0;34m]\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0moutput\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 58\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0mextra_return_dict\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/combine_documents/stuff.py\u001B[0m in \u001B[0;36mcombine_docs\u001B[0;34m(self, docs, **kwargs)\u001B[0m\n\u001B[1;32m 87\u001B[0m \u001B[0minputs\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_get_inputs\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mdocs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 88\u001B[0m \u001B[0;31m# Call predict on the LLM.\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m---> 89\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mllm_chain\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mpredict\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m**\u001B[0m\u001B[0minputs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m{\u001B[0m\u001B[0;34m}\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 90\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 91\u001B[0m async def acombine_docs(\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/llm.py\u001B[0m in \u001B[0;36mpredict\u001B[0;34m(self, **kwargs)\u001B[0m\n\u001B[1;32m 151\u001B[0m \u001B[0mcompletion\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mllm\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mpredict\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0madjective\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0;34m\"funny\"\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 152\u001B[0m \"\"\"\n\u001B[0;32m--> 153\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0moutput_key\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 154\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 155\u001B[0m \u001B[0;32masync\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0mapredict\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mAny\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m->\u001B[0m \u001B[0mstr\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001B[0m in \u001B[0;36m__call__\u001B[0;34m(self, inputs, return_only_outputs)\u001B[0m\n\u001B[1;32m 140\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0;34m(\u001B[0m\u001B[0mKeyboardInterrupt\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mException\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 141\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_chain_error\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0me\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 142\u001B[0;31m \u001B[0;32mraise\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 143\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_chain_end\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0moutputs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 144\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mprep_outputs\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0minputs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0moutputs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mreturn_only_outputs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/base.py\u001B[0m in \u001B[0;36m__call__\u001B[0;34m(self, inputs, return_only_outputs)\u001B[0m\n\u001B[1;32m 137\u001B[0m )\n\u001B[1;32m 138\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 139\u001B[0;31m \u001B[0moutputs\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_call\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0minputs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 140\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0;34m(\u001B[0m\u001B[0mKeyboardInterrupt\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mException\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 141\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_chain_error\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0me\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/llm.py\u001B[0m in \u001B[0;36m_call\u001B[0;34m(self, inputs)\u001B[0m\n\u001B[1;32m 132\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 133\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0m_call\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0minputs\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mDict\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mstr\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mAny\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m->\u001B[0m \u001B[0mDict\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mstr\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mstr\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 134\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mapply\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0minputs\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0;36m0\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 135\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 136\u001B[0m \u001B[0;32masync\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0m_acall\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0minputs\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mDict\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mstr\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mAny\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m->\u001B[0m \u001B[0mDict\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mstr\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mstr\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/llm.py\u001B[0m in \u001B[0;36mapply\u001B[0;34m(self, input_list)\u001B[0m\n\u001B[1;32m 115\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0mapply\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0minput_list\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mList\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mDict\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mstr\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mAny\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m->\u001B[0m \u001B[0mList\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mDict\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mstr\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mstr\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 116\u001B[0m \u001B[0;34m\"\"\"Utilize the LLM generate method for speed gains.\"\"\"\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 117\u001B[0;31m \u001B[0mresponse\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mgenerate\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0minput_list\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 118\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcreate_outputs\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mresponse\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 119\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/chains/llm.py\u001B[0m in \u001B[0;36mgenerate\u001B[0;34m(self, input_list)\u001B[0m\n\u001B[1;32m 57\u001B[0m \u001B[0;34m\"\"\"Generate LLM result from inputs.\"\"\"\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 58\u001B[0m \u001B[0mprompts\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mstop\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mprep_prompts\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0minput_list\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m---> 59\u001B[0;31m \u001B[0mresponse\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mllm\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mgenerate\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mprompts\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mstop\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mstop\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 60\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0mresponse\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 61\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/base.py\u001B[0m in \u001B[0;36mgenerate\u001B[0;34m(self, prompts, stop)\u001B[0m\n\u001B[1;32m 126\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0;34m(\u001B[0m\u001B[0mKeyboardInterrupt\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mException\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 127\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_llm_error\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0me\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 128\u001B[0;31m \u001B[0;32mraise\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 129\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_llm_end\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0moutput\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 130\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0moutput\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/base.py\u001B[0m in \u001B[0;36mgenerate\u001B[0;34m(self, prompts, stop)\u001B[0m\n\u001B[1;32m 123\u001B[0m )\n\u001B[1;32m 124\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 125\u001B[0;31m \u001B[0moutput\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_generate\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mprompts\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mstop\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mstop\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 126\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0;34m(\u001B[0m\u001B[0mKeyboardInterrupt\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mException\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 127\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcallback_manager\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mon_llm_error\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0me\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mverbose\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mverbose\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/openai.py\u001B[0m in \u001B[0;36m_generate\u001B[0;34m(self, prompts, stop)\u001B[0m\n\u001B[1;32m 257\u001B[0m \u001B[0mchoices\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mextend\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mresponse\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0;34m\"choices\"\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 258\u001B[0m \u001B[0;32melse\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 259\u001B[0;31m \u001B[0mresponse\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcompletion_with_retry\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mprompt\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0m_prompts\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mparams\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 260\u001B[0m \u001B[0mchoices\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mextend\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mresponse\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0;34m\"choices\"\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 261\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0;32mnot\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mstreaming\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/openai.py\u001B[0m in \u001B[0;36mcompletion_with_retry\u001B[0;34m(self, **kwargs)\u001B[0m\n\u001B[1;32m 204\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mclient\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcreate\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 205\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 206\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0m_completion_with_retry\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 207\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 208\u001B[0m \u001B[0;32masync\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0macompletion_with_retry\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mAny\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m->\u001B[0m \u001B[0mAny\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/tenacity/__init__.py\u001B[0m in \u001B[0;36mwrapped_f\u001B[0;34m(*args, **kw)\u001B[0m\n\u001B[1;32m 287\u001B[0m \u001B[0;34m@\u001B[0m\u001B[0mfunctools\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mwraps\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mf\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 288\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0mwrapped_f\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m*\u001B[0m\u001B[0margs\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mt\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mAny\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mkw\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mt\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mAny\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m->\u001B[0m \u001B[0mt\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mAny\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 289\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mf\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m*\u001B[0m\u001B[0margs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mkw\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 290\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 291\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0mretry_with\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m*\u001B[0m\u001B[0margs\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mt\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mAny\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mt\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mAny\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m->\u001B[0m \u001B[0mWrappedFn\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/tenacity/__init__.py\u001B[0m in \u001B[0;36m__call__\u001B[0;34m(self, fn, *args, **kwargs)\u001B[0m\n\u001B[1;32m 377\u001B[0m \u001B[0mretry_state\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mRetryCallState\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mretry_object\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mself\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mfn\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mfn\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0margs\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0margs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mkwargs\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 378\u001B[0m \u001B[0;32mwhile\u001B[0m \u001B[0;32mTrue\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 379\u001B[0;31m \u001B[0mdo\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0miter\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mretry_state\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mretry_state\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 380\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0misinstance\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mdo\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mDoAttempt\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 381\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/tenacity/__init__.py\u001B[0m in \u001B[0;36miter\u001B[0;34m(self, retry_state)\u001B[0m\n\u001B[1;32m 312\u001B[0m \u001B[0mis_explicit_retry\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mfut\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mfailed\u001B[0m \u001B[0;32mand\u001B[0m \u001B[0misinstance\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mfut\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mexception\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mTryAgain\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 313\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0;32mnot\u001B[0m \u001B[0;34m(\u001B[0m\u001B[0mis_explicit_retry\u001B[0m \u001B[0;32mor\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mretry\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mretry_state\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 314\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mfut\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mresult\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 315\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 316\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mafter\u001B[0m \u001B[0;32mis\u001B[0m \u001B[0;32mnot\u001B[0m \u001B[0;32mNone\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/concurrent/futures/_base.py\u001B[0m in \u001B[0;36mresult\u001B[0;34m(self, timeout)\u001B[0m\n\u001B[1;32m 437\u001B[0m \u001B[0;32mraise\u001B[0m \u001B[0mCancelledError\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 438\u001B[0m \u001B[0;32melif\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_state\u001B[0m \u001B[0;34m==\u001B[0m \u001B[0mFINISHED\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 439\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m__get_result\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 440\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 441\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_condition\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mwait\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mtimeout\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/concurrent/futures/_base.py\u001B[0m in \u001B[0;36m__get_result\u001B[0;34m(self)\u001B[0m\n\u001B[1;32m 389\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_exception\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 390\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 391\u001B[0;31m \u001B[0;32mraise\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_exception\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 392\u001B[0m \u001B[0;32mfinally\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 393\u001B[0m \u001B[0;31m# Break a reference cycle with the exception in self._exception\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/tenacity/__init__.py\u001B[0m in \u001B[0;36m__call__\u001B[0;34m(self, fn, *args, **kwargs)\u001B[0m\n\u001B[1;32m 380\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0misinstance\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mdo\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mDoAttempt\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 381\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 382\u001B[0;31m \u001B[0mresult\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mfn\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m*\u001B[0m\u001B[0margs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 383\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0mBaseException\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0;31m# noqa: B902\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 384\u001B[0m \u001B[0mretry_state\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mset_exception\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0msys\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mexc_info\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;31m# type: ignore[arg-type]\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/langchain/llms/openai.py\u001B[0m in \u001B[0;36m_completion_with_retry\u001B[0;34m(**kwargs)\u001B[0m\n\u001B[1;32m 202\u001B[0m \u001B[0;34m@\u001B[0m\u001B[0mretry_decorator\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 203\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0m_completion_with_retry\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m:\u001B[0m \u001B[0mAny\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m->\u001B[0m \u001B[0mAny\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 204\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mclient\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcreate\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 205\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 206\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0m_completion_with_retry\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_resources/completion.py\u001B[0m in \u001B[0;36mcreate\u001B[0;34m(cls, *args, **kwargs)\u001B[0m\n\u001B[1;32m 23\u001B[0m \u001B[0;32mwhile\u001B[0m \u001B[0;32mTrue\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 24\u001B[0m \u001B[0;32mtry\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m---> 25\u001B[0;31m \u001B[0;32mreturn\u001B[0m \u001B[0msuper\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcreate\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m*\u001B[0m\u001B[0margs\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0;34m**\u001B[0m\u001B[0mkwargs\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 26\u001B[0m \u001B[0;32mexcept\u001B[0m \u001B[0mTryAgain\u001B[0m \u001B[0;32mas\u001B[0m \u001B[0me\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 27\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mtimeout\u001B[0m \u001B[0;32mis\u001B[0m \u001B[0;32mnot\u001B[0m \u001B[0;32mNone\u001B[0m \u001B[0;32mand\u001B[0m \u001B[0mtime\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mtime\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m)\u001B[0m \u001B[0;34m>\u001B[0m \u001B[0mstart\u001B[0m \u001B[0;34m+\u001B[0m \u001B[0mtimeout\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_resources/abstract/engine_api_resource.py\u001B[0m in \u001B[0;36mcreate\u001B[0;34m(cls, api_key, api_base, api_type, request_id, api_version, organization, **params)\u001B[0m\n\u001B[1;32m 151\u001B[0m )\n\u001B[1;32m 152\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 153\u001B[0;31m response, _, api_key = requestor.request(\n\u001B[0m\u001B[1;32m 154\u001B[0m \u001B[0;34m\"post\"\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 155\u001B[0m \u001B[0murl\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_requestor.py\u001B[0m in \u001B[0;36mrequest\u001B[0;34m(self, method, url, params, headers, files, stream, request_id, request_timeout)\u001B[0m\n\u001B[1;32m 225\u001B[0m \u001B[0mrequest_timeout\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mrequest_timeout\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 226\u001B[0m )\n\u001B[0;32m--> 227\u001B[0;31m \u001B[0mresp\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mgot_stream\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0m_interpret_response\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mresult\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mstream\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m 228\u001B[0m \u001B[0;32mreturn\u001B[0m \u001B[0mresp\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mgot_stream\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mself\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mapi_key\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 229\u001B[0m \u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_requestor.py\u001B[0m in \u001B[0;36m_interpret_response\u001B[0;34m(self, result, stream)\u001B[0m\n\u001B[1;32m 618\u001B[0m \u001B[0;32melse\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 619\u001B[0m return (\n\u001B[0;32m--> 620\u001B[0;31m self._interpret_response_line(\n\u001B[0m\u001B[1;32m 621\u001B[0m \u001B[0mresult\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mcontent\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mdecode\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m\"utf-8\"\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 622\u001B[0m \u001B[0mresult\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mstatus_code\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n", + "\u001B[0;32m~/opt/anaconda3/lib/python3.9/site-packages/openai/api_requestor.py\u001B[0m in \u001B[0;36m_interpret_response_line\u001B[0;34m(self, rbody, rcode, rheaders, stream)\u001B[0m\n\u001B[1;32m 678\u001B[0m \u001B[0mstream_error\u001B[0m \u001B[0;34m=\u001B[0m \u001B[0mstream\u001B[0m \u001B[0;32mand\u001B[0m \u001B[0;34m\"error\"\u001B[0m \u001B[0;32min\u001B[0m \u001B[0mresp\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mdata\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 679\u001B[0m \u001B[0;32mif\u001B[0m \u001B[0mstream_error\u001B[0m \u001B[0;32mor\u001B[0m \u001B[0;32mnot\u001B[0m \u001B[0;36m200\u001B[0m \u001B[0;34m<=\u001B[0m \u001B[0mrcode\u001B[0m \u001B[0;34m<\u001B[0m \u001B[0;36m300\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m--> 680\u001B[0;31m raise self.handle_error_response(\n\u001B[0m\u001B[1;32m 681\u001B[0m \u001B[0mrbody\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mrcode\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mresp\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mdata\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mrheaders\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mstream_error\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0mstream_error\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m 682\u001B[0m )\n", + "\u001B[0;31mInvalidRequestError\u001B[0m: This model's maximum context length is 4097 tokens, however you requested 14199 tokens (13943 in your prompt; 256 for the completion). Please reduce your prompt; or completion length." ] } ], @@ -253,39 +256,39 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new MapReduceDocumentsChain chain...\u001b[0m\n", + "\u001B[1m> Entering new MapReduceDocumentsChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"somehow five years later covet hits and you know what they decide to do they're like you know what let's go all in on creating like safety safety stuff for covert like masks respirators um gloves things like that and they become one of the like core providers right at the start of covet they shifted all their production manufacturing stuff they're like forget the vodka bottles forget the LED screens we need n95 masks and we need respirators and we need you know these testing kits and we need and they started producing this stuff and they started just winning all these contracts [Music] we're live Sean uh we have a bunch of stuff you you have a you have a a full menu over here and so do I yeah all right I want you to look at my menu here and I want you to just pick something off the menu go ahead and I'll Riff Off it we don't prefer people who they don't they don't know we only write like one or two words so you get like a teaser you're like man what the hell is this about but you don't know what it actually is but I have I put all my stuff in here an accident I have this new researcher who's crushing it he just gives me all the content like five minutes ahead of time but uh Rich neighbor how did I know you'd pick a rich neighbor so there's somebody in my neighborhood who I bumped into and I've just I'm you know I sort of get out there and I collect signals is this you know where where do I place this person on the uh the Billy scale like are they you know are they on their way up are they are they have they made it in life are they really balling out of control where where is this person these people have been balling out of control like when Christmas time came up there was just like the wife went outside and it was just pointing at windows and all of a sudden the house was lit up like a Christmas tree they had like so they had almost like decked out things and they go hey hey um invite your kids over uh this Thursday we have a snow machine they're we're building a Snow Hill in our driveway like uh you you want to do sledding without going to Tahoe what's that like a big snow cone is that what that no it's like a giant truck that comes that creates snow and it piles it up so that your like their house looked like it was in you know Michigan or something like that yeah but it's just like like it's like an ice machine or something yeah it's like yeah something like that yeah like a big snow cone like a big shaved ice thing yeah yeah you were right from the\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"from the beginning you're right so they did this and they had a fake Santa there and I was like man this is a lot for a Thursday afternoon but okay uh this is cool like these people's style they seem really nice and I didn't know what they did so I kind of I hit it with the Google the other day and I was like let's see who these people are and they have a crazy story so they created a company that back in 2014 did this thing it basically it lets you take a vodka bottle they had a vodka bottle that had an LED sign going around it so you could give somebody a vodka bottle that would say happy birthday Sam or like you could program any message I could be like you know uh whatever I could be like you're getting an old [ __ ] whatever I could write any message on it it would go on your your vodka bottle all right seems kind of gimmicky I don't really you know not a bad idea but but balling out of control from that didn't didn't 100 make sense but that was it sounds like a Drop Shipping like joke sounds like my first idea out of college it's like this is like me in college would have been like bro next next Google I got it what if we took you know this Jager bomb and we put an LED screen on it wouldn't that be incredible and so so they had this thing and they were like licensing this out or something like that somehow like Shaq became an advisor to their company it was really crazy it makes sense yeah as you would five years later covet hits and you know what they decide to do they're like you know what [ __ ] this vodka thing let's go all in on creating like safety safety stuff for cover like masks respirators um gloves things like that and they become one of the like core providers right at the start of covert they shifted all their production manufacturing stuff they're like forget the vodka bottles forget the LED screens we need n95 masks and we need respirators and we need you know these testing kits and we need and they started producing this stuff and they started just winning all these contracts and so now like if you go look at their website it's one of those I know your Rich websites because there's like not a lot of information on it but if you go to like the P they have like a press release section and it's like PR Newswire company gets 113 million dollar contract with the government for safety equipment oh my God local East Bay success story where they uh they're now the the sole testing provider for you know with the Lakers Stadium\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"Levi's Stadium like all these different places and so these guys are getting 100 million dollar plus contracts for their stuff now I think probably it's like you know probably only like 10 margin when you buy you think it's that selling masks I think for things like that probably it's like 10 15 is my guess maybe maybe during coven everyone was completely price insensitive and they could just charge whatever they wanted I'm not sure I would have thought that but um but wow dude what a what a pivot and uh you know that isn't that just kind of crazy and that was an opportunity kind of available to a lot of people right dude I know a bunch of people who did that and like I had a friend that did it and he's like dude check this out and he sends me a picture of a Shopify store and it's doing like 2 million a month I know a lot of people who did that and I've only followed up with one or two of them and uh I have a feeling that like of the eight people I know who did it like three of them it worked out and then the rest it was like a really quick cash grab but then they over bought inventory and it and it's like nothing do you know people who did that yes we there was a guy in um I had started this Mastermind group that's actually where I found Ben uh but like one of the other guys in The Mastermind group he like every time we came to the testimony does he live in Texas no he's in Canada every time he came to the Mastermind group I feel like he had a different business which is like not what you want in a mastermind group but he was a good dude and he would always be like oh I have this other business that's like oh you know for auto repair blah blah we do their SEO and I was like okay but then what about that thing you told me last time and then one time you came dude we're doing mobile covet testing trucks that will drive up to places and we can just do rapid testing for covet and we were like all right I mean that sounds cool but like are you like do you know anything about covet testing like does anybody in the world know about this like what he's like oh I got the scientist that's going to be great and then he came back and he was like hey um really excited to be here I need you guys help um like three months later he was like I really need you guys help about going public and I was like and he's like yeah we're gonna do like 85 million this year in revenue and I was like what and he's like yeah we're getting all these contracts with the state of uh with like the you\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"know the [ __ ] in Canada like these country Country-Wide contracts and um you know yeah we think maybe we should take this public next year and I was like oh my God so how did it end I I don't even know because I that that guy my head was just spinning every time uh you know he would talk because I'm like this is either too good to be true or I'm too dumb and this is amazing and I can't tell which one it is it's probably some mix of both but you're right I know several people that went all in on covid right when it happened and like low-key got like an absurd amount of traction very very fast yeah like a ton my dad had actually called me one day and he goes my friend works at this hospital they need extra equipment they need extra masks I talked to somebody in India and they could produce these masks and like I think we could do like a two or three million dollar contract and I was like fantastic um should do it and he's like yeah I wanna but my dad has this problem where my dad is addicted to meetings like he thinks winning is like this important person met with me and then he'll tell me the duration of the meeting to show me the value he's like only scheduled for one hour but we sat there for 90 minutes and I'd be like okay so what like everybody so you know he was really interested two hours right and he was just like he just like always just obsessed with that so he was he just had a bunch of meetings and I was like Dad you're gonna it's all about that action boss you're gonna take some action here what what's gonna happen like go go for it do it and he's like well no I want he's like I want everybody to like sign off on it and de-risk it completely pay me up front and I was just like dude this is this is like the cheap way to do business like you got to take a little risk here you're throwing shade on your dad right now I hope he doesn't listen to this and you called him boss if I said Cosby boss he's getting in the headlock yeah my dad yeah we make fun of each other like we call it like it is I do a bunch of dumb things and I say when I do dumb things this is his dumb thing he is high planning low action on these things and he says it all the time like um we went I went I took him to Tony Robbins and Tony Robbins is all about like taking massive action on like the things you want and he's like I was like what's your big takeaway he's like oh man I need to take Massive Action and I was like that yeah that's that you did it you learned the right lesson from this thing he\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n" + "CONCISE SUMMARY:\u001B[0m\n" ] }, { @@ -294,9 +297,9 @@ "text": [ "\n", "\n", - "\u001b[1m> Entering new LLMChain chain...\u001b[0m\n", + "\u001B[1m> Entering new LLMChain chain...\u001B[0m\n", "Prompt after formatting:\n", - "\u001b[32;1m\u001b[1;3mWrite a concise summary of the following:\n", + "\u001B[32;1m\u001B[1;3mWrite a concise summary of the following:\n", "\n", "\n", "\"\n", @@ -311,11 +314,11 @@ " A person's father was interested in a two or three million dollar contract, but was hesitant to take action due to wanting to de-risk it completely and get everyone to sign off on it. The person encouraged their father to take a risk and take action, and they both joked about it. The father attended a Tony Robbins event and learned the lesson to take massive action on the things he wants.\"\n", "\n", "\n", - "CONCISE SUMMARY:\u001b[0m\n", + "CONCISE SUMMARY:\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n", + "\u001B[1m> Finished chain.\u001B[0m\n", "\n", - "\u001b[1m> Finished chain.\u001b[0m\n" + "\u001B[1m> Finished chain.\u001B[0m\n" ] }, {