Please help me revise and cleanup this code. In addition the most important change is as it is assigning itself subtasks, I would like for the other LLMs to follow the same three of thought process to give inputs on each subtask prior to executing         <<code>>  
!pip install bs4

!pip install tree-of-thoughts

!pip install langchain

!pip install transformers[agents]

!pip install cohere

!pip install nest_asyncio

!pip install NAME_1

!pip install faiss-cpu faiss-gpu

!pip install duckduckgo_search

!pip install llama-cpp-python

!pip install tiktoken

!pip install playwright

!pip install cohere

!playwright install

!pip install google-search-results

!git clone https://github.com/NAME_1/chatgpt-retrieval-plugin.git

# Commented out NAME_2 to ensure Python compatibility.
# %cd /content/chatgpt-retrieval-plugin

!pip install poetry

!poetry env use python3.10

!poetry install

!pip install transformers > /dev/null

!pip install --upgrade transformers huggingface_hub > /dev/null

# Tools
from transformers import Agent
from langchain.experimental.autonomous_agents.autogpt.agent import AutoGPT
from langchain.chat_models import ChatOpenAI
from langchain.agents.agent_toolkits.pandas.base import create_pandas_dataframe_agent
from langchain.docstore.document import Document
import asyncio
import nest_asyncio
import os
from contextlib import contextmanager
from typing import Optional
from langchain.agents import tool
from langchain.tools.file_management.read import ReadFileTool
from langchain.tools.file_management.write import WriteFileTool
import pandas as pd
from tree_of_thoughts import OptimizedOpenAILanguageModel, TreeofThoughts
from dataclasses import dataclass
from typing import Dict

import requests
from huggingface_hub import HfFolder, hf_hub_download, list_spaces

from transformers.utils import logging
from transformers.tools.base import TASK_MAPPING, TOOL_CONFIG_FILE, Tool, load_tool, supports_remote
from transformers.tools.prompts import CHAT_MESSAGE_PROMPT, CHAT_PROMPT_TEMPLATE, RUN_PROMPT_TEMPLATE
from transformers.tools.python_interpreter import evaluate
from langchain.agents import initialize_agent
from langchain.agents import AgentType
from langchain.agents import load_tools
os.environ["NAME_1_API_KEY"] = "ysk-J9uXRPolaNY8JhWfx89ET3BlbkFJJ2hZVxBaX8RSJJyLf1c2"
# Instantiate an agent
agent = Agent()
nest_asyncio.apply()
model = OptimizedOpenAILanguageModel(api_key='ysk-J9uXRPolaNY8JhWfx89ET3BlbkFJJ2hZVxBaX8RSJJyLf1c2')
llm = ChatOpenAI(model_name="gpt-3.5-turbo", temperature=1.0, NAME_1_api_key='