This commit is contained in:
Harrison Chase
2023-04-14 17:45:01 -07:00
parent 9860c09fa2
commit 3564568b4a
3 changed files with 255 additions and 30 deletions

View File

@@ -70,43 +70,268 @@
{
"cell_type": "code",
"execution_count": 5,
"id": "c032b182",
"id": "297e826c",
"metadata": {},
"outputs": [],
"source": [
"agent.chain.verbose = True"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "c032b182",
"metadata": {
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"\n",
"\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
"Prompt after formatting:\n",
"\u001b[32;1m\u001b[1;3mSystem: You are Tom, Assistant\n",
"Your decisions must always be made independently without seeking user assistance. Play to your strengths as an LLM and pursue simple strategies with no legal complications.\n",
"\n",
"GOALS:\n",
"\n",
"1. write a weather report for SF today\n",
"\n",
"\n",
"Constraints:\n",
"1. ~4000 word limit for short term memory. Your short term memory is short, so immediately save important information to files.\n",
"2. If you are unsure how you previously did something or want to recall past events, thinking about similar events will help you remember.\n",
"3. No user assistance\n",
"4. Exclusively use the commands listed in double quotes e.g. \"command name\"\n",
"\n",
"Commands:\n",
"1. Search: useful for when you need to answer questions about current events. You should ask targeted questions\n",
"\n",
"Resources:\n",
"1. Internet access for searches and information gathering.\n",
"2. Long Term memory management.\n",
"3. GPT-3.5 powered Agents for delegation of simple tasks.\n",
"4. File output.\n",
"\n",
"Performance Evaluation:\n",
"1. Continuously review and analyze your actions to ensure you are performing to the best of your abilities.\n",
"2. Constructively self-criticize your big-picture behavior constantly.\n",
"3. Reflect on past decisions and strategies to refine your approach.\n",
"4. Every command has a cost, so be smart and efficient. Aim to complete tasks in the least number of steps.\n",
"\n",
"You should only respond in JSON format as described below \n",
"Response Format: \n",
"{\n",
" \"thoughts\": {\n",
" \"text\": \"I should start by reviewing my current businesses and their performance. This will help me identify areas that need improvement and opportunities for growth.\",\n",
" \"reasoning\": \"Before I can make any decisions about how to increase my net worth or grow my Twitter account, I need to have a clear understanding of my current situation. By reviewing my businesses, I can identify areas that need improvement and opportunities for growth.\",\n",
" \"plan\": \"- Review each of my businesses and their financial performance\\n- Identify areas that need improvement and opportunities for growth\\n- Develop a plan to address these areas and capitalize on opportunities\",\n",
" \"criticism\": \"I need to make sure that I am not spending too much time on this review and that I am focusing on actionable insights. I also need to make sure that I am not getting bogged down in details that are not relevant to my goals.\",\n",
" \"speak\": \"I am going to review my current businesses and their performance to identify areas that need improvement and opportunities for growth.\"\n",
" \"text\": \"thought\",\n",
" \"reasoning\": \"reasoning\",\n",
" \"plan\": \"- short bulleted\\n- list that conveys\\n- long-term plan\",\n",
" \"criticism\": \"constructive self-criticism\",\n",
" \"speak\": \"thoughts summary to say to user\"\n",
" },\n",
" \"command\": {\n",
" \"name\": \"file output\",\n",
" \"input\": \"Review of current businesses and their performance\"\n",
" \"name\": \"tool name\",\n",
" \"input\": \"input to the tool\"\n",
" }\n",
"} \n",
"Ensure the response can be parsed by Python json.loads\n",
"System: The current time and date is Fri Apr 14 16:55:04 2023\n",
"System: This reminds you of these events from your past:\n",
"[]\n",
"\n",
"\n",
"Human: Determine which next command to use, and respond using the format specified above:\u001b[0m\n",
"\n",
"\u001b[1m> Finished chain.\u001b[0m\n",
"{\n",
" \"thoughts\": {\n",
" \"text\": \"I will start by checking the current weather in San Francisco to write a weather report.\",\n",
" \"reasoning\": \"Knowing the current weather is important to write an accurate weather report.\",\n",
" \"plan\": \"- Use the 'search' command to look up the current weather in San Francisco.\\n- Save the information to a file for later use.\",\n",
" \"criticism\": \"I need to make sure to save the information to a file so I don't have to look it up again later.\",\n",
" \"speak\": \"I will use the 'search' command to look up the current weather in San Francisco.\"\n",
" },\n",
" \"command\": {\n",
" \"name\": \"search\",\n",
" \"input\": \"current weather in San Francisco\"\n",
" }\n",
"}\n",
"\n",
"\n",
"\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
"Prompt after formatting:\n",
"\u001b[32;1m\u001b[1;3mSystem: You are Tom, Assistant\n",
"Your decisions must always be made independently without seeking user assistance. Play to your strengths as an LLM and pursue simple strategies with no legal complications.\n",
"\n",
"GOALS:\n",
"\n",
"1. write a weather report for SF today\n",
"\n",
"\n",
"Constraints:\n",
"1. ~4000 word limit for short term memory. Your short term memory is short, so immediately save important information to files.\n",
"2. If you are unsure how you previously did something or want to recall past events, thinking about similar events will help you remember.\n",
"3. No user assistance\n",
"4. Exclusively use the commands listed in double quotes e.g. \"command name\"\n",
"\n",
"Commands:\n",
"1. Search: useful for when you need to answer questions about current events. You should ask targeted questions\n",
"\n",
"Resources:\n",
"1. Internet access for searches and information gathering.\n",
"2. Long Term memory management.\n",
"3. GPT-3.5 powered Agents for delegation of simple tasks.\n",
"4. File output.\n",
"\n",
"Performance Evaluation:\n",
"1. Continuously review and analyze your actions to ensure you are performing to the best of your abilities.\n",
"2. Constructively self-criticize your big-picture behavior constantly.\n",
"3. Reflect on past decisions and strategies to refine your approach.\n",
"4. Every command has a cost, so be smart and efficient. Aim to complete tasks in the least number of steps.\n",
"\n",
"You should only respond in JSON format as described below \n",
"Response Format: \n",
"{\n",
" \"thoughts\": {\n",
" \"text\": \"thought\",\n",
" \"reasoning\": \"reasoning\",\n",
" \"plan\": \"- short bulleted\\n- list that conveys\\n- long-term plan\",\n",
" \"criticism\": \"constructive self-criticism\",\n",
" \"speak\": \"thoughts summary to say to user\"\n",
" },\n",
" \"command\": {\n",
" \"name\": \"tool name\",\n",
" \"input\": \"input to the tool\"\n",
" }\n",
"} \n",
"Ensure the response can be parsed by Python json.loads\n",
"System: The current time and date is Fri Apr 14 16:55:11 2023\n",
"System: This reminds you of these events from your past:\n",
"[Document(page_content='Assistant Reply: {\\n \"thoughts\": {\\n \"text\": \"I will start by checking the current weather in San Francisco to write a weather report.\",\\n \"reasoning\": \"Knowing the current weather is important to write an accurate weather report.\",\\n \"plan\": \"- Use the \\'search\\' command to look up the current weather in San Francisco.\\\\n- Save the information to a file for later use.\",\\n \"criticism\": \"I need to make sure to save the information to a file so I don\\'t have to look it up again later.\",\\n \"speak\": \"I will use the \\'search\\' command to look up the current weather in San Francisco.\"\\n },\\n \"command\": {\\n \"name\": \"search\",\\n \"input\": \"current weather in San Francisco\"\\n }\\n} \\nResult: Unknown command \\'search\\'. Please refer to the \\'COMMANDS\\' list for available commands and only respond in the specified JSON format. ', metadata={})]\n",
"\n",
"\n",
"System: Unknown command 'search'. Please refer to the 'COMMANDS' list for available commands and only respond in the specified JSON format.\n",
"Human: Determine which next command to use, and respond using the format specified above:\u001b[0m\n",
"\n",
"\u001b[1m> Finished chain.\u001b[0m\n",
"{\n",
" \"thoughts\": {\n",
" \"text\": \"I will start by checking the current weather in San Francisco to write a weather report.\",\n",
" \"reasoning\": \"Knowing the current weather is important to write an accurate weather report.\",\n",
" \"plan\": \"- Use the 'Search' command to look up the current weather in San Francisco.\\n- Save the information to a file for later use.\",\n",
" \"criticism\": \"I need to make sure to save the information to a file so I don't have to look it up again later.\",\n",
" \"speak\": \"I will use the 'Search' command to look up the current weather in San Francisco.\"\n",
" },\n",
" \"command\": {\n",
" \"name\": \"Search\",\n",
" \"input\": \"current weather in San Francisco\"\n",
" }\n",
"}\n",
"\n",
"\n",
"\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
"Prompt after formatting:\n",
"\u001b[32;1m\u001b[1;3mSystem: You are Tom, Assistant\n",
"Your decisions must always be made independently without seeking user assistance. Play to your strengths as an LLM and pursue simple strategies with no legal complications.\n",
"\n",
"GOALS:\n",
"\n",
"1. write a weather report for SF today\n",
"\n",
"\n",
"Constraints:\n",
"1. ~4000 word limit for short term memory. Your short term memory is short, so immediately save important information to files.\n",
"2. If you are unsure how you previously did something or want to recall past events, thinking about similar events will help you remember.\n",
"3. No user assistance\n",
"4. Exclusively use the commands listed in double quotes e.g. \"command name\"\n",
"\n",
"Commands:\n",
"1. Search: useful for when you need to answer questions about current events. You should ask targeted questions\n",
"\n",
"Resources:\n",
"1. Internet access for searches and information gathering.\n",
"2. Long Term memory management.\n",
"3. GPT-3.5 powered Agents for delegation of simple tasks.\n",
"4. File output.\n",
"\n",
"Performance Evaluation:\n",
"1. Continuously review and analyze your actions to ensure you are performing to the best of your abilities.\n",
"2. Constructively self-criticize your big-picture behavior constantly.\n",
"3. Reflect on past decisions and strategies to refine your approach.\n",
"4. Every command has a cost, so be smart and efficient. Aim to complete tasks in the least number of steps.\n",
"\n",
"You should only respond in JSON format as described below \n",
"Response Format: \n",
"{\n",
" \"thoughts\": {\n",
" \"text\": \"thought\",\n",
" \"reasoning\": \"reasoning\",\n",
" \"plan\": \"- short bulleted\\n- list that conveys\\n- long-term plan\",\n",
" \"criticism\": \"constructive self-criticism\",\n",
" \"speak\": \"thoughts summary to say to user\"\n",
" },\n",
" \"command\": {\n",
" \"name\": \"tool name\",\n",
" \"input\": \"input to the tool\"\n",
" }\n",
"} \n",
"Ensure the response can be parsed by Python json.loads\n",
"System: The current time and date is Fri Apr 14 16:55:19 2023\n",
"System: This reminds you of these events from your past:\n",
"[Document(page_content='Assistant Reply: {\\n \"thoughts\": {\\n \"text\": \"I will start by checking the current weather in San Francisco to write a weather report.\",\\n \"reasoning\": \"Knowing the current weather is important to write an accurate weather report.\",\\n \"plan\": \"- Use the \\'search\\' command to look up the current weather in San Francisco.\\\\n- Save the information to a file for later use.\",\\n \"criticism\": \"I need to make sure to save the information to a file so I don\\'t have to look it up again later.\",\\n \"speak\": \"I will use the \\'search\\' command to look up the current weather in San Francisco.\"\\n },\\n \"command\": {\\n \"name\": \"search\",\\n \"input\": \"current weather in San Francisco\"\\n }\\n} \\nResult: Unknown command \\'search\\'. Please refer to the \\'COMMANDS\\' list for available commands and only respond in the specified JSON format. ', metadata={}), Document(page_content='Assistant Reply: {\\n \"thoughts\": {\\n \"text\": \"I will start by checking the current weather in San Francisco to write a weather report.\",\\n \"reasoning\": \"Knowing the current weather is important to write an accurate weather report.\",\\n \"plan\": \"- Use the \\'Search\\' command to look up the current weather in San Francisco.\\\\n- Save the information to a file for later use.\",\\n \"criticism\": \"I need to make sure to save the information to a file so I don\\'t have to look it up again later.\",\\n \"speak\": \"I will use the \\'Search\\' command to look up the current weather in San Francisco.\"\\n },\\n \"command\": {\\n \"name\": \"Search\",\\n \"input\": \"current weather in San Francisco\"\\n }\\n} \\nResult: Command Search returned: Current Weather ; 54°F · Mostly sunny ; RealFeel® 67°. Pleasant. RealFeel Guide. Pleasant. 63° to 81°. Most consider this temperature range ideal. LEARN MORE. ', metadata={})]\n",
"\n",
"\n",
"System: Unknown command 'search'. Please refer to the 'COMMANDS' list for available commands and only respond in the specified JSON format.\n",
"System: Command Search returned: Current Weather ; 54°F · Mostly sunny ; RealFeel® 67°. Pleasant. RealFeel Guide. Pleasant. 63° to 81°. Most consider this temperature range ideal. LEARN MORE.\n",
"Human: Determine which next command to use, and respond using the format specified above:\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"\u001b[1m> Finished chain.\u001b[0m\n",
"{\n",
" \"thoughts\": {\n",
" \"text\": \"I will save the current weather information to a file for later use.\",\n",
" \"reasoning\": \"Saving the information to a file will allow me to access it later without having to look it up again.\",\n",
" \"plan\": \"- Use the \\'File output\\' command to save the current weather information to a file.\",\n",
" \"criticism\": \"I need to make sure to name the file something descriptive so I can easily find it later.\",\n",
" \"speak\": \"I will use the \\'File output\\' command to save the current weather information to a file.\"\n",
" },\n",
" \"command\": {\n",
" \"name\": \"File output\",\n",
" \"input\": {\n",
" \"content\": \"Current Weather ; 54°F · Mostly sunny ; RealFeel® 67°. Pleasant. RealFeel Guide. Pleasant. 63° to 81°. Most consider this temperature range ideal. LEARN MORE.\",\n",
" \"filename\": \"sf_weather.txt\"\n",
" }\n",
" }\n",
"}\n"
]
},
{
"ename": "KeyError",
"evalue": "'file output'",
"ename": "JSONDecodeError",
"evalue": "Invalid \\escape: line 5 column 28 (char 261)",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[5], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43magent\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/workplace/langchain/langchain/auto_agents/autogpt/agent.py:75\u001b[0m, in \u001b[0;36mAgent.run\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 73\u001b[0m \u001b[38;5;66;03m# Get command name and arguments\u001b[39;00m\n\u001b[1;32m 74\u001b[0m action \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39moutput_parser\u001b[38;5;241m.\u001b[39mparse(assistant_reply)\n\u001b[0;32m---> 75\u001b[0m tool \u001b[38;5;241m=\u001b[39m \u001b[43m{\u001b[49m\u001b[43mt\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mname\u001b[49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mt\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mfor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mt\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtools\u001b[49m\u001b[43m}\u001b[49m\u001b[43m[\u001b[49m\u001b[43maction\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtool\u001b[49m\u001b[43m]\u001b[49m\n\u001b[1;32m 76\u001b[0m \u001b[38;5;66;03m# Execute command\u001b[39;00m\n\u001b[1;32m 77\u001b[0m observation \u001b[38;5;241m=\u001b[39m tool\u001b[38;5;241m.\u001b[39mrun(action\u001b[38;5;241m.\u001b[39mtool_input)\n",
"\u001b[0;31mKeyError\u001b[0m: 'file output'"
"\u001b[0;31mJSONDecodeError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[6], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43magent\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mwrite a weather report for SF today\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m~/workplace/langchain/langchain/auto_agents/autogpt/agent.py:73\u001b[0m, in \u001b[0;36mAgent.run\u001b[0;34m(self, goals)\u001b[0m\n\u001b[1;32m 70\u001b[0m \u001b[38;5;28mprint\u001b[39m(assistant_reply)\n\u001b[1;32m 72\u001b[0m \u001b[38;5;66;03m# Get command name and arguments\u001b[39;00m\n\u001b[0;32m---> 73\u001b[0m action \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43moutput_parser\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparse\u001b[49m\u001b[43m(\u001b[49m\u001b[43massistant_reply\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 74\u001b[0m tools \u001b[38;5;241m=\u001b[39m {t\u001b[38;5;241m.\u001b[39mname: t \u001b[38;5;28;01mfor\u001b[39;00m t \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtools}\n\u001b[1;32m 75\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m action\u001b[38;5;241m.\u001b[39mtool \u001b[38;5;129;01min\u001b[39;00m tools:\n",
"File \u001b[0;32m~/workplace/langchain/langchain/auto_agents/autogpt/output_parser.py:10\u001b[0m, in \u001b[0;36mAutoGPTOutputParser.parse\u001b[0;34m(self, text)\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mparse\u001b[39m(\u001b[38;5;28mself\u001b[39m, text: \u001b[38;5;28mstr\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Union[AgentAction, AgentFinish]:\n\u001b[0;32m---> 10\u001b[0m parsed \u001b[38;5;241m=\u001b[39m \u001b[43mjson\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mloads\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtext\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 11\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m AgentAction(tool\u001b[38;5;241m=\u001b[39mparsed[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcommand\u001b[39m\u001b[38;5;124m\"\u001b[39m][\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mname\u001b[39m\u001b[38;5;124m\"\u001b[39m], tool_input\u001b[38;5;241m=\u001b[39mparsed[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcommand\u001b[39m\u001b[38;5;124m\"\u001b[39m][\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124minput\u001b[39m\u001b[38;5;124m\"\u001b[39m], log\u001b[38;5;241m=\u001b[39mtext)\n",
"File \u001b[0;32m~/.pyenv/versions/3.9.1/lib/python3.9/json/__init__.py:346\u001b[0m, in \u001b[0;36mloads\u001b[0;34m(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)\u001b[0m\n\u001b[1;32m 341\u001b[0m s \u001b[38;5;241m=\u001b[39m s\u001b[38;5;241m.\u001b[39mdecode(detect_encoding(s), \u001b[38;5;124m'\u001b[39m\u001b[38;5;124msurrogatepass\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 343\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\u001b[38;5;28mcls\u001b[39m \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m object_hook \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m\n\u001b[1;32m 344\u001b[0m parse_int \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m parse_float \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m\n\u001b[1;32m 345\u001b[0m parse_constant \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m object_pairs_hook \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m kw):\n\u001b[0;32m--> 346\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_default_decoder\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdecode\u001b[49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 347\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mcls\u001b[39m \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 348\u001b[0m \u001b[38;5;28mcls\u001b[39m \u001b[38;5;241m=\u001b[39m JSONDecoder\n",
"File \u001b[0;32m~/.pyenv/versions/3.9.1/lib/python3.9/json/decoder.py:337\u001b[0m, in \u001b[0;36mJSONDecoder.decode\u001b[0;34m(self, s, _w)\u001b[0m\n\u001b[1;32m 332\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdecode\u001b[39m(\u001b[38;5;28mself\u001b[39m, s, _w\u001b[38;5;241m=\u001b[39mWHITESPACE\u001b[38;5;241m.\u001b[39mmatch):\n\u001b[1;32m 333\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Return the Python representation of ``s`` (a ``str`` instance\u001b[39;00m\n\u001b[1;32m 334\u001b[0m \u001b[38;5;124;03m containing a JSON document).\u001b[39;00m\n\u001b[1;32m 335\u001b[0m \n\u001b[1;32m 336\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 337\u001b[0m obj, end \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mraw_decode\u001b[49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43midx\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m_w\u001b[49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mend\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 338\u001b[0m end \u001b[38;5;241m=\u001b[39m _w(s, end)\u001b[38;5;241m.\u001b[39mend()\n\u001b[1;32m 339\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m end \u001b[38;5;241m!=\u001b[39m \u001b[38;5;28mlen\u001b[39m(s):\n",
"File \u001b[0;32m~/.pyenv/versions/3.9.1/lib/python3.9/json/decoder.py:353\u001b[0m, in \u001b[0;36mJSONDecoder.raw_decode\u001b[0;34m(self, s, idx)\u001b[0m\n\u001b[1;32m 344\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Decode a JSON document from ``s`` (a ``str`` beginning with\u001b[39;00m\n\u001b[1;32m 345\u001b[0m \u001b[38;5;124;03ma JSON document) and return a 2-tuple of the Python\u001b[39;00m\n\u001b[1;32m 346\u001b[0m \u001b[38;5;124;03mrepresentation and the index in ``s`` where the document ended.\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 350\u001b[0m \n\u001b[1;32m 351\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 352\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 353\u001b[0m obj, end \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mscan_once\u001b[49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43midx\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 354\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mStopIteration\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m err:\n\u001b[1;32m 355\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m JSONDecodeError(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mExpecting value\u001b[39m\u001b[38;5;124m\"\u001b[39m, s, err\u001b[38;5;241m.\u001b[39mvalue) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;28mNone\u001b[39m\n",
"\u001b[0;31mJSONDecodeError\u001b[0m: Invalid \\escape: line 5 column 28 (char 261)"
]
}
],
"source": [
"agent.run()"
"agent.run([\"write a weather report for SF today\"])"
]
},
{