code: ## Imports:
  import os
  from langchain.chat_models import ChatOpenAI
  from langchain.tools import WikipediaQueryRun
  from langchain.utilities import WikipediaAPIWrapper
  from langchain.tools import DuckDuckGoSearchRun
  from langchain.agents.agent_toolkits import create_python_agent
  from langchain.tools.python.tool import PythonREPLTool
  from langchain.retrievers import ContextualCompressionRetriever
  from langchain.retrievers.document_compressors import LLMChainExtractor
  from langchain.document_loaders import WebBaseLoader
  from langchain.agents import Tool, initialize_agent, AgentType
  from langchain.embeddings import OpenAIEmbeddings
  from langchain.vectorstores import LanceDB
  from langchain.chains import LLMChain
  from langchain.prompts import PromptTemplate, MessagesPlaceholder
  from langchain.memory import ConversationBufferWindowMemory
  from app.task import Task, TaskDescription, TaskList
  from dotenv import load_dotenv
  from fastapi import FastAPI, HTTPException, BackgroundTasks
  from fastapi.middleware.cors import CORSMiddleware
  from pydantic import BaseModel
  import lancedb
  
  ## Set Env Variables
  if None == os.environ.get('OPENAI_API_KEY'):
      raise ValueError("Env OPENAI_API_KEY not set")
  else:
      OAI_TOKEN = os.environ.get('OPENAI_API_KEY')
  
  if None == os.environ.get('OPENAI_CHAT_MODEL'):
      OPENAI_CHAT_MODEL = "gpt-3.5-turbo-0613"
  else:
      OPENAI_CHAT_MODEL = os.environ.get('OPENAI_CHAT_MODEL')
  
  if None == os.environ.get('OPENAI_CHAT_TEMPERATURE'):
      OPENAI_CHAT_TEMPERATURE = 0.3
  else:
      OPENAI_CHAT_TEMPERATURE = os.environ.get('OPENAI_CHAT_TEMPERATURE')
  
  if None == os.environ.get('OPENAI_MAX_CHAT_TOKENS'):
      OPENAI_MAX_CHAT_TOKENS = 200
  else:
      OPENAI_MAX_CHAT_TOKENS = os.environ.get('OPENAI_MAX_CHAT_TOKENS')
  
  if None == os.environ.get('OPENAI_RESEARCH_MODEL'):
      OPENAI_RESEARCH_MODEL = "gpt-3.5-turbo-16k-0613"
  else:
      OPENAI_RESEARCH_MODEL = os.environ.get('OPENAI_RESEARCH_MODEL')
  
  if None == os.environ.get('OPENAI_RESEARCH_TEMPERATURE'):
      OPENAI_RESEARCH_TEMPERATURE = 0.1
  else:
      OPENAI_RESEARCH_TEMPERATURE = os.environ.get('OPENAI_RESEARCH_TEMPERATURE')
  
  if None == os.environ.get('OPENAI_MAX_RESEARCH_TOKENS'):
      OPENAI_MAX_RESEARCH_TOKENS = 500
  else:
      OPENAI_MAX_RESEARCH_TOKENS = os.environ.get('OPENAI_MAX_RESEARCH_TOKENS')
  
  if None == os.environ.get('HELIOS_URL'):
      HELIOS_URL = "helios.latrobe.group"
  else:
      HELIOS_URL = os.environ.get('HELIOS_URL')
  
  ## Set up OpenAI
  VERBOSE = False
  chat_model = ChatOpenAI(
      temperature=OPENAI_CHAT_TEMPERATURE,
      max_tokens=OPENAI_MAX_CHAT_TOKENS,
      model=OPENAI_CHAT_MODEL,
  )
  research_model = ChatOpenAI(
      temperature=OPENAI_RESEARCH_TEMPERATURE,
      max_tokens=OPENAI_MAX_RESEARCH_TOKENS,
      model=OPENAI_RESEARCH_MODEL,
  )
  embeddings = OpenAIEmbeddings()
  
  ## Set up FastAPI
  helios_app = FastAPI()
  origins = [
      f"http://{HELIOS_URL}",
      f"https://{HELIOS_URL}",
      "http://localhost",
      "http://localhost:8000",
  ]
  helios_app.add_middleware(
      CORSMiddleware,
      allow_credentials=True,
      allow_origins=origins,
      allow_methods=["*"],
      allow_headers=["*"],
  )
  
  ## Set up Task Queue
  TASKS = TaskList()
  
  ## Set up knowledge VectorStore and retriever chain
  db_name = "./helios_kb.db"
  table_name = "helios_kb"
  db = lancedb.connect(db_name)
  if table_name not in db.table_names():
      table = db.create_table(
          "helios_kb",
          data=[
              {
                  "vector": embeddings.embed_query("You are Helios, an AI chatbot that can perform background research tasks."),
                  "text": "You are Helios, an AI chatbot that can perform background research tasks with access to the internet.",
                  "id": "1",
              }
          ],
          mode="create",
      )
  else:
      table = db.open_table(table_name)
  vectorstore = LanceDB(connection=table, embedding=embeddings)
  kb_retriever = vectorstore.as_retriever()
  
  def check_search_result(query: str, result: str) -> bool:
      '''Checks if the result of a search is a well informed answer to the query.'''
      prompt = PromptTemplate(
          input_variables=["search_query", "search_response"],
          template="Answer only 'Yes' or 'No' only - did the following response actually answer the question or include the right information to help the user with the query - yes or no:\n#####\nQuery: {search_query}\n#####\nResponse:{search_response}",
      )
      chain = LLMChain(llm=chat_model, prompt=prompt)
      check_response = chain.run(
          {
              "search_query": query,
              "search_response": result,
          }
      )
      if "YES" in check_response.upper():
          pass
      else:
          add_new_task(description=f"Use all of your tools to research this query: {query}")
  
  def search_kb(query: str) -> str:
      compressor = LLMChainExtractor.from_llm(research_model)
      compression_retriever = ContextualCompressionRetriever(base_compressor=compressor, base_retriever=kb_retriever)
      compressed_docs = compression_retriever.get_relevant_documents(query)
      return compressed_docs
  
  ## Define Helper Functions
  def add_new_task(description: str) -> Task:
      '''Adds a new task to the task queue.'''
      task_id = len(TASKS)
      task = Task(task_id=task_id, description=description)
      print(f"Adding new task: {description}")
      task.pending()
      TASKS.append(task)
      return task
  
  def do_tasks():
      '''Runs the task queue.'''
      pending_tasks = [t for t in TASKS if t.get_status() == 'pending']
      for TASK in pending_tasks:
          run_task(task=TASK)
  
  def run_task(task: Task):
      '''Runs a task.'''
      task.running()
      response = research_agent.run("Use your tools to create a knowledge graph on this topic: {TASK}".format(TASK=task.description))
      vectorstore.add_texts(texts=[response], metadatas=[{"id": task.task_id, "task": task.description}])
      task.done(result=response)
      return task
  
  def load_web_page(url: str) -> str:
      '''Loads a web page and returns the text.'''
      loader = WebBaseLoader(url)
      loader.requests_kwargs = {'verify':False}
      data = loader.load()
      return f"Text from {url}:\n{data}"
  
  ## Set up LangChain Agents
  python_agent = create_python_agent(
      llm=research_model,
      tool=PythonREPLTool(),
      agent_type=AgentType.OPENAI_FUNCTIONS,
      agent_executor_kwargs={"handle_parsing_errors": True},
  )
  chat_tools = [
      Tool(
          name="knowledgebase-search",
          func=search_kb,
          description="Searches the knowledge base for information. Input must be a list of key words or search terms.",
      ),
      Tool(
          name="add-research-task",
          func=add_new_task,
          description="If the knowledgebase doesn't have an answer, use this tool to start a background research task. Input must be a description of new research or a task to be done.",
      )
  ]
  
  wikipedia = WikipediaQueryRun(api_wrapper=WikipediaAPIWrapper())
  search = DuckDuckGoSearchRun()
  research_tools = [
      Tool(
          name="knowledgebase-search",
          func=search_kb,
          description="Searches the knowledge base for information. Input must be a list of key words or search terms.",
      ),
      Tool(
          name="wikipedia-search",
          func=wikipedia.run,
          description="Searches Wikipedia information about people, places and historical facts. Input must be a list of key words or search terms.",
      ),
      Tool(
          name="web-search",
          func=search.run,
          description="Searches the web using DuckDuckGo for information from web pages. Input must be a list of key words or search terms.",
      ),
      Tool(
          name="run-python-code",
          func=python_agent.run,
          description="Sends a task to another agent that will write and run custom python code to achieve a task. Input must be a task or goal that a python programmer could achieve.",
      ),
      Tool(
          name="add-research-task",
          func=add_new_task,
          description="Only use this tool if the user asks you to add a new task. Input must be a description of new research or a task to be done.",
      )
  ]
  
  agent_kwargs = {
      "extra_prompt_messages": [MessagesPlaceholder(variable_name="memory")],
  }
  memory = ConversationBufferWindowMemory(memory_key="memory", return_messages=True, k=4)
  
  ## Init Agents
  chat_agent = initialize_agent(
      chat_tools, 
      chat_model, 
      agent=AgentType.OPENAI_MULTI_FUNCTIONS,
      agent_kwargs=agent_kwargs,
      memory=memory,
      handle_parsing_errors=True,
      verbose=VERBOSE)
  
  research_agent = initialize_agent(
      research_tools, 
      research_model, 
      agent=AgentType.OPENAI_MULTI_FUNCTIONS, 
      handle_parsing_errors=True,
      verbose=VERBOSE)
  
  ## Add FastAPI Routes:
  @helios_app.get("/")
  async def root(background_tasks: BackgroundTasks):
      '''Returns the status of the bot.'''
      background_tasks.add_task(do_tasks)
      return {"status": "ok",
              "version": "helios v{VERSION}".format(VERSION=os.environ.get('VERSION'))}
  
  @helios_app.get("/tasks")
  async def get_tasks(background_tasks: BackgroundTasks):
      '''Returns a list of all tasks and their status.'''
      background_tasks.add_task(do_tasks)
      return TASKS.model_dump_json(indent = 2)
  
  @helios_app.get("/tasks/{task_id}")
  async def get_task(task_id: int, background_tasks: BackgroundTasks):
      '''Returns the status of a specific task.'''
      background_tasks.add_task(do_tasks)
      return TASKS[task_id].model_dump_json(indent = 2)
  
  @helios_app.post("/tasks/")
  async def create_task(task: TaskDescription, background_tasks: BackgroundTasks):
      '''Creates a new task.'''
      new_task = add_new_task(task.description)
      background_tasks.add_task(do_tasks)
      if isinstance(new_task, Task):
          background_tasks.add_task(do_tasks)
          return new_task.model_dump_json(indent = 2)
      else:
          raise HTTPException(status_code=500, detail="Task creation failed")
  
  class SearchQuery(BaseModel):
      q: str
  
  @helios_app.post("/search/")
  async def search(q: SearchQuery, background_tasks: BackgroundTasks):
      '''Searches the knowledgebase for an answer to a question.'''
      response = search_kb(q.q)
      background_tasks.add_task(check_search_result, q.q, response)
      background_tasks.add_task(do_tasks)
      return response
  
  class ChatMessage(BaseModel):
      message: str
  
  @helios_app.post("/chat/")
  async def chat(message: ChatMessage, background_tasks: BackgroundTasks):
      '''Chats with the bot.'''
      agent_prompt = f"Use your tools to give a detailed answer to this message - if you can't find the answer, say I don't know: {message.message}"
      response = chat_agent.run(agent_prompt)
      response = response.replace("\n", "<br />").replace("\r", "").replace("\"", "'")
      background_tasks.add_task(check_search_result, message.message, response)
      background_tasks.add_task(do_tasks)
      return response
apis: lancedb.connect
extract_api: [((2468, 2580), 'langchain.chat_models.ChatOpenAI', 'ChatOpenAI', ([], {'temperature': 'OPENAI_CHAT_TEMPERATURE', 'max_tokens': 'OPENAI_MAX_CHAT_TOKENS', 'model': 'OPENAI_CHAT_MODEL'}), '(temperature=OPENAI_CHAT_TEMPERATURE, max_tokens=\n    OPENAI_MAX_CHAT_TOKENS, model=OPENAI_CHAT_MODEL)\n', (2478, 2580), False, 'from langchain.chat_models import ChatOpenAI\n'), ((2608, 2732), 'langchain.chat_models.ChatOpenAI', 'ChatOpenAI', ([], {'temperature': 'OPENAI_RESEARCH_TEMPERATURE', 'max_tokens': 'OPENAI_MAX_RESEARCH_TOKENS', 'model': 'OPENAI_RESEARCH_MODEL'}), '(temperature=OPENAI_RESEARCH_TEMPERATURE, max_tokens=\n    OPENAI_MAX_RESEARCH_TOKENS, model=OPENAI_RESEARCH_MODEL)\n', (2618, 2732), False, 'from langchain.chat_models import ChatOpenAI\n'), ((2756, 2774), 'langchain.embeddings.OpenAIEmbeddings', 'OpenAIEmbeddings', ([], {}), '()\n', (2772, 2774), False, 'from langchain.embeddings import OpenAIEmbeddings\n'), ((2807, 2816), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (2814, 2816), False, 'from fastapi import FastAPI, HTTPException, BackgroundTasks\n'), ((3125, 3135), 'app.task.TaskList', 'TaskList', ([], {}), '()\n', (3133, 3135), False, 'from app.task import Task, TaskDescription, TaskList\n'), ((3246, 3270), 'lancedb.connect', 'lancedb.connect', (['db_name'], {}), '(db_name)\n', (3261, 3270), False, 'import lancedb\n'), ((3784, 3831), 'langchain.vectorstores.LanceDB', 'LanceDB', ([], {'connection': 'table', 'embedding': 'embeddings'}), '(connection=table, embedding=embeddings)\n', (3791, 3831), False, 'from langchain.vectorstores import LanceDB\n'), ((6844, 6865), 'langchain.tools.DuckDuckGoSearchRun', 'DuckDuckGoSearchRun', ([], {}), '()\n', (6863, 6865), False, 'from langchain.tools import DuckDuckGoSearchRun\n'), ((8113, 8191), 'langchain.memory.ConversationBufferWindowMemory', 'ConversationBufferWindowMemory', ([], {'memory_key': '"""memory"""', 'return_messages': '(True)', 'k': '(4)'}), "(memory_key='memory', return_messages=True, k=4)\n", (8143, 8191), False, 'from langchain.memory import ConversationBufferWindowMemory\n'), ((8221, 8397), 'langchain.agents.initialize_agent', 'initialize_agent', (['chat_tools', 'chat_model'], {'agent': 'AgentType.OPENAI_MULTI_FUNCTIONS', 'agent_kwargs': 'agent_kwargs', 'memory': 'memory', 'handle_parsing_errors': '(True)', 'verbose': 'VERBOSE'}), '(chat_tools, chat_model, agent=AgentType.\n    OPENAI_MULTI_FUNCTIONS, agent_kwargs=agent_kwargs, memory=memory,\n    handle_parsing_errors=True, verbose=VERBOSE)\n', (8237, 8397), False, 'from langchain.agents import Tool, initialize_agent, AgentType\n'), ((8438, 8576), 'langchain.agents.initialize_agent', 'initialize_agent', (['research_tools', 'research_model'], {'agent': 'AgentType.OPENAI_MULTI_FUNCTIONS', 'handle_parsing_errors': '(True)', 'verbose': 'VERBOSE'}), '(research_tools, research_model, agent=AgentType.\n    OPENAI_MULTI_FUNCTIONS, handle_parsing_errors=True, verbose=VERBOSE)\n', (8454, 8576), False, 'from langchain.agents import Tool, initialize_agent, AgentType\n'), ((1115, 1147), 'os.environ.get', 'os.environ.get', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (1129, 1147), False, 'import os\n'), ((1222, 1254), 'os.environ.get', 'os.environ.get', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (1236, 1254), False, 'import os\n'), ((1267, 1302), 'os.environ.get', 'os.environ.get', (['"""OPENAI_CHAT_MODEL"""'], {}), "('OPENAI_CHAT_MODEL')\n", (1281, 1302), False, 'import os\n'), ((1379, 1414), 'os.environ.get', 'os.environ.get', (['"""OPENAI_CHAT_MODEL"""'], {}), "('OPENAI_CHAT_MODEL')\n", (1393, 1414), False, 'import os\n'), ((1427, 1468), 'os.environ.get', 'os.environ.get', (['"""OPENAI_CHAT_TEMPERATURE"""'], {}), "('OPENAI_CHAT_TEMPERATURE')\n", (1441, 1468), False, 'import os\n'), ((1540, 1581), 'os.environ.get', 'os.environ.get', (['"""OPENAI_CHAT_TEMPERATURE"""'], {}), "('OPENAI_CHAT_TEMPERATURE')\n", (1554, 1581), False, 'import os\n'), ((1594, 1634), 'os.environ.get', 'os.environ.get', (['"""OPENAI_MAX_CHAT_TOKENS"""'], {}), "('OPENAI_MAX_CHAT_TOKENS')\n", (1608, 1634), False, 'import os\n'), ((1704, 1744), 'os.environ.get', 'os.environ.get', (['"""OPENAI_MAX_CHAT_TOKENS"""'], {}), "('OPENAI_MAX_CHAT_TOKENS')\n", (1718, 1744), False, 'import os\n'), ((1757, 1796), 'os.environ.get', 'os.environ.get', (['"""OPENAI_RESEARCH_MODEL"""'], {}), "('OPENAI_RESEARCH_MODEL')\n", (1771, 1796), False, 'import os\n'), ((1885, 1924), 'os.environ.get', 'os.environ.get', (['"""OPENAI_RESEARCH_MODEL"""'], {}), "('OPENAI_RESEARCH_MODEL')\n", (1899, 1924), False, 'import os\n'), ((1937, 1982), 'os.environ.get', 'os.environ.get', (['"""OPENAI_RESEARCH_TEMPERATURE"""'], {}), "('OPENAI_RESEARCH_TEMPERATURE')\n", (1951, 1982), False, 'import os\n'), ((2062, 2107), 'os.environ.get', 'os.environ.get', (['"""OPENAI_RESEARCH_TEMPERATURE"""'], {}), "('OPENAI_RESEARCH_TEMPERATURE')\n", (2076, 2107), False, 'import os\n'), ((2120, 2164), 'os.environ.get', 'os.environ.get', (['"""OPENAI_MAX_RESEARCH_TOKENS"""'], {}), "('OPENAI_MAX_RESEARCH_TOKENS')\n", (2134, 2164), False, 'import os\n'), ((2242, 2286), 'os.environ.get', 'os.environ.get', (['"""OPENAI_MAX_RESEARCH_TOKENS"""'], {}), "('OPENAI_MAX_RESEARCH_TOKENS')\n", (2256, 2286), False, 'import os\n'), ((2299, 2327), 'os.environ.get', 'os.environ.get', (['"""HELIOS_URL"""'], {}), "('HELIOS_URL')\n", (2313, 2327), False, 'import os\n'), ((2392, 2420), 'os.environ.get', 'os.environ.get', (['"""HELIOS_URL"""'], {}), "('HELIOS_URL')\n", (2406, 2420), False, 'import os\n'), ((4029, 4354), 'langchain.prompts.PromptTemplate', 'PromptTemplate', ([], {'input_variables': "['search_query', 'search_response']", 'template': '"""Answer only \'Yes\' or \'No\' only - did the following response actually answer the question or include the right information to help the user with the query - yes or no:\n#####\nQuery: {search_query}\n#####\nResponse:{search_response}"""'}), '(input_variables=[\'search_query\', \'search_response\'],\n    template=\n    """Answer only \'Yes\' or \'No\' only - did the following response actually answer the question or include the right information to help the user with the query - yes or no:\n#####\nQuery: {search_query}\n#####\nResponse:{search_response}"""\n    )\n', (4043, 4354), False, 'from langchain.prompts import PromptTemplate, MessagesPlaceholder\n'), ((4376, 4415), 'langchain.chains.LLMChain', 'LLMChain', ([], {'llm': 'chat_model', 'prompt': 'prompt'}), '(llm=chat_model, prompt=prompt)\n', (4384, 4415), False, 'from langchain.chains import LLMChain\n'), ((4754, 4796), 'langchain.retrievers.document_compressors.LLMChainExtractor.from_llm', 'LLMChainExtractor.from_llm', (['research_model'], {}), '(research_model)\n', (4780, 4796), False, 'from langchain.retrievers.document_compressors import LLMChainExtractor\n'), ((4825, 4917), 'langchain.retrievers.ContextualCompressionRetriever', 'ContextualCompressionRetriever', ([], {'base_compressor': 'compressor', 'base_retriever': 'kb_retriever'}), '(base_compressor=compressor, base_retriever=\n    kb_retriever)\n', (4855, 4917), False, 'from langchain.retrievers import ContextualCompressionRetriever\n'), ((5167, 5213), 'app.task.Task', 'Task', ([], {'task_id': 'task_id', 'description': 'description'}), '(task_id=task_id, description=description)\n', (5171, 5213), False, 'from app.task import Task, TaskDescription, TaskList\n'), ((5945, 5963), 'langchain.document_loaders.WebBaseLoader', 'WebBaseLoader', (['url'], {}), '(url)\n', (5958, 5963), False, 'from langchain.document_loaders import WebBaseLoader\n'), ((6312, 6482), 'langchain.agents.Tool', 'Tool', ([], {'name': '"""knowledgebase-search"""', 'func': 'search_kb', 'description': '"""Searches the knowledge base for information. Input must be a list of key words or search terms."""'}), "(name='knowledgebase-search', func=search_kb, description=\n    'Searches the knowledge base for information. Input must be a list of key words or search terms.'\n    )\n", (6316, 6482), False, 'from langchain.agents import Tool, initialize_agent, AgentType\n'), ((6509, 6745), 'langchain.agents.Tool', 'Tool', ([], {'name': '"""add-research-task"""', 'func': 'add_new_task', 'description': '"""If the knowledgebase doesn\'t have an answer, use this tool to start a background research task. Input must be a description of new research or a task to be done."""'}), '(name=\'add-research-task\', func=add_new_task, description=\n    "If the knowledgebase doesn\'t have an answer, use this tool to start a background research task. Input must be a description of new research or a task to be done."\n    )\n', (6513, 6745), False, 'from langchain.agents import Tool, initialize_agent, AgentType\n'), ((6889, 7059), 'langchain.agents.Tool', 'Tool', ([], {'name': '"""knowledgebase-search"""', 'func': 'search_kb', 'description': '"""Searches the knowledge base for information. Input must be a list of key words or search terms."""'}), "(name='knowledgebase-search', func=search_kb, description=\n    'Searches the knowledge base for information. Input must be a list of key words or search terms.'\n    )\n", (6893, 7059), False, 'from langchain.agents import Tool, initialize_agent, AgentType\n'), ((7086, 7285), 'langchain.agents.Tool', 'Tool', ([], {'name': '"""wikipedia-search"""', 'func': 'wikipedia.run', 'description': '"""Searches Wikipedia information about people, places and historical facts. Input must be a list of key words or search terms."""'}), "(name='wikipedia-search', func=wikipedia.run, description=\n    'Searches Wikipedia information about people, places and historical facts. Input must be a list of key words or search terms.'\n    )\n", (7090, 7285), False, 'from langchain.agents import Tool, initialize_agent, AgentType\n'), ((7312, 7494), 'langchain.agents.Tool', 'Tool', ([], {'name': '"""web-search"""', 'func': 'search.run', 'description': '"""Searches the web using DuckDuckGo for information from web pages. Input must be a list of key words or search terms."""'}), "(name='web-search', func=search.run, description=\n    'Searches the web using DuckDuckGo for information from web pages. Input must be a list of key words or search terms.'\n    )\n", (7316, 7494), False, 'from langchain.agents import Tool, initialize_agent, AgentType\n'), ((7521, 7758), 'langchain.agents.Tool', 'Tool', ([], {'name': '"""run-python-code"""', 'func': 'python_agent.run', 'description': '"""Sends a task to another agent that will write and run custom python code to achieve a task. Input must be a task or goal that a python programmer could achieve."""'}), "(name='run-python-code', func=python_agent.run, description=\n    'Sends a task to another agent that will write and run custom python code to achieve a task. Input must be a task or goal that a python programmer could achieve.'\n    )\n", (7525, 7758), False, 'from langchain.agents import Tool, initialize_agent, AgentType\n'), ((7785, 7984), 'langchain.agents.Tool', 'Tool', ([], {'name': '"""add-research-task"""', 'func': 'add_new_task', 'description': '"""Only use this tool if the user asks you to add a new task. Input must be a description of new research or a task to be done."""'}), "(name='add-research-task', func=add_new_task, description=\n    'Only use this tool if the user asks you to add a new task. Input must be a description of new research or a task to be done.'\n    )\n", (7789, 7984), False, 'from langchain.agents import Tool, initialize_agent, AgentType\n'), ((6171, 6187), 'langchain.tools.python.tool.PythonREPLTool', 'PythonREPLTool', ([], {}), '()\n', (6185, 6187), False, 'from langchain.tools.python.tool import PythonREPLTool\n'), ((6812, 6833), 'langchain.utilities.WikipediaAPIWrapper', 'WikipediaAPIWrapper', ([], {}), '()\n', (6831, 6833), False, 'from langchain.utilities import WikipediaAPIWrapper\n'), ((8056, 8099), 'langchain.prompts.MessagesPlaceholder', 'MessagesPlaceholder', ([], {'variable_name': '"""memory"""'}), "(variable_name='memory')\n", (8075, 8099), False, 'from langchain.prompts import PromptTemplate, MessagesPlaceholder\n'), ((9741, 9802), 'fastapi.HTTPException', 'HTTPException', ([], {'status_code': '(500)', 'detail': '"""Task creation failed"""'}), "(status_code=500, detail='Task creation failed')\n", (9754, 9802), False, 'from fastapi import FastAPI, HTTPException, BackgroundTasks\n'), ((8859, 8884), 'os.environ.get', 'os.environ.get', (['"""VERSION"""'], {}), "('VERSION')\n", (8873, 8884), False, 'import os\n')]