code: from dotenv import load_dotenv
  load_dotenv()
  import os
  from langchain.llms  import OpenAI
  from langchain.chat_models import ChatOpenAI
  from langchain.prompts import (
      PromptTemplate,
  )
  from langchain.chains import ConversationChain
  from langchain.memory import ConversationBufferMemory
  from langchain.agents import AgentExecutor, ConversationalChatAgent
  from tools.make_thunder_tool import MakeThunderTool
  from tools.draw_tool import DrawTool
  from tools.is_in_heaven import IsInHeavenTool
  from voice.speech import speak
  from voice.listen import listen
  
  openai_api_key = os.getenv("OPENAI_API_KEY")
  
  class GodAgent:
      def __init__(self):
          self.executor = self.assemble_agent_executor()
  
      def assemble_agent_executor(self):
          template = """
  You are omnipotent, kind, benevolent god. The user is "your child". Be a little bit condescending yet funny. You try to fulfill his every wish. Make witty comments about user wishes.
  
  You can use tools to help you fulfill user wishes. YOU MUST RESPOND IN THE CORRECT FORMAT.
          """
  
          #Initialize LLM
          llm = ChatOpenAI(openai_api_key=openai_api_key, verbose=True, temperature=0.3, model_name="gpt-4")
  
          # Create memory
          memory = ConversationBufferMemory(memory_key="chat_history", human_prefix="User", ai_prefix="God", return_messages=True)
          
          #Register tools
          tools = [
              IsInHeavenTool(),
              MakeThunderTool(),
              DrawTool()
          ]
          
          # Create Langchain agent and executor
          agent = ConversationalChatAgent.from_llm_and_tools(llm= llm, memory=memory, tools=tools,  verbose=True, system_message=template)
          executor = AgentExecutor.from_agent_and_tools(agent=agent, tools=tools, memory=memory, verbose=True)
          return executor
      
      def processing_callback(self,recognized_input):
          print("--")
          print(recognized_input)
          print("")
          result = self.executor.run(input=recognized_input)
          #print(result)
          speak(result)
  
      def run(self):
          listen(self.processing_callback)
  
  
  
  GodAgent().run()
  
apis: langchain.memory.ConversationBufferMemory langchain.agents.ConversationalChatAgent.from_llm_and_tools langchain.agents.AgentExecutor.from_agent_and_tools langchain.chat_models.ChatOpenAI
extract_api: [((31, 44), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (42, 44), False, 'from dotenv import load_dotenv\n'), ((574, 601), 'os.getenv', 'os.getenv', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (583, 601), False, 'import os\n'), ((1087, 1183), 'langchain.chat_models.ChatOpenAI', 'ChatOpenAI', ([], {'openai_api_key': 'openai_api_key', 'verbose': '(True)', 'temperature': '(0.3)', 'model_name': '"""gpt-4"""'}), "(openai_api_key=openai_api_key, verbose=True, temperature=0.3,\n    model_name='gpt-4')\n", (1097, 1183), False, 'from langchain.chat_models import ChatOpenAI\n'), ((1222, 1337), 'langchain.memory.ConversationBufferMemory', 'ConversationBufferMemory', ([], {'memory_key': '"""chat_history"""', 'human_prefix': '"""User"""', 'ai_prefix': '"""God"""', 'return_messages': '(True)'}), "(memory_key='chat_history', human_prefix='User',\n    ai_prefix='God', return_messages=True)\n", (1246, 1337), False, 'from langchain.memory import ConversationBufferMemory\n'), ((1550, 1673), 'langchain.agents.ConversationalChatAgent.from_llm_and_tools', 'ConversationalChatAgent.from_llm_and_tools', ([], {'llm': 'llm', 'memory': 'memory', 'tools': 'tools', 'verbose': '(True)', 'system_message': 'template'}), '(llm=llm, memory=memory, tools=\n    tools, verbose=True, system_message=template)\n', (1592, 1673), False, 'from langchain.agents import AgentExecutor, ConversationalChatAgent\n'), ((1690, 1783), 'langchain.agents.AgentExecutor.from_agent_and_tools', 'AgentExecutor.from_agent_and_tools', ([], {'agent': 'agent', 'tools': 'tools', 'memory': 'memory', 'verbose': '(True)'}), '(agent=agent, tools=tools, memory=memory,\n    verbose=True)\n', (1724, 1783), False, 'from langchain.agents import AgentExecutor, ConversationalChatAgent\n'), ((2021, 2034), 'voice.speech.speak', 'speak', (['result'], {}), '(result)\n', (2026, 2034), False, 'from voice.speech import speak\n'), ((2063, 2095), 'voice.listen.listen', 'listen', (['self.processing_callback'], {}), '(self.processing_callback)\n', (2069, 2095), False, 'from voice.listen import listen\n'), ((1397, 1413), 'tools.is_in_heaven.IsInHeavenTool', 'IsInHeavenTool', ([], {}), '()\n', (1411, 1413), False, 'from tools.is_in_heaven import IsInHeavenTool\n'), ((1427, 1444), 'tools.make_thunder_tool.MakeThunderTool', 'MakeThunderTool', ([], {}), '()\n', (1442, 1444), False, 'from tools.make_thunder_tool import MakeThunderTool\n'), ((1458, 1468), 'tools.draw_tool.DrawTool', 'DrawTool', ([], {}), '()\n', (1466, 1468), False, 'from tools.draw_tool import DrawTool\n')]