code: def get_agent(list_filters,openai_key,pinecone_key):
  
      import logging
      import sys
      import os
      import pandas as pd
      import pinecone
      import openai
      from llama_index import VectorStoreIndex
      from llama_index.vector_stores import PineconeVectorStore
      from llama_index.query_engine import RetrieverQueryEngine
      from llama_index.chat_engine.condense_question import CondenseQuestionChatEngine
      from llama_index.agent import OpenAIAgent
      from llama_index.llms import OpenAI
      from llama_index.tools import BaseTool, FunctionTool
      from agent_utils import get_rebate,get_tax
      from llama_index.tools import QueryEngineTool, ToolMetadata
      from llama_index.llms import ChatMessage
      logging.basicConfig(stream=sys.stdout, level=logging.INFO)
      logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
      
      #Openai and Pinecone private key
      openai.api_key = openai_key
      api_key = pinecone_key
      
      #Instantiate pinecone vector store
      pinecone.init(api_key=api_key, environment="gcp-starter")
      pinecone_index = pinecone.Index("quickstart-index")
      vector_store = PineconeVectorStore(
          pinecone_index=pinecone_index
      )
  
      index = VectorStoreIndex.from_vector_store(vector_store)
      
      if not list_filters:
          list_filters = ['rates','claim']
  
      else:
          list_filters += ['rates','claim']
      #Define retriever
      retriever = index.as_retriever(
      vector_store_kwargs={"filter": {"category": {"$in":list_filters}}},streaming=True)
  
      # assemble query engine
      query_engine = RetrieverQueryEngine(retriever=retriever)
  
      #Get agent tools from agent_utils file and instantiate tools
      tax_tool = FunctionTool.from_defaults(fn=get_tax)
      relief_tool = FunctionTool.from_defaults(fn=get_rebate)
  
      
      #Create list of tool for agent
      tools = [
          QueryEngineTool(
              query_engine=query_engine,
              metadata=ToolMetadata(
                  name="tax_relief_retriever",
                  description=(
                      "Provides information on reliefs for a given item category and information on how to claim tax reliefs"
                      "Use a detailed plain text question as input to the tool."
                  ),
              ),
          ),
          tax_tool,relief_tool]
  
      #Define chat agent
      llm = OpenAI(model="gpt-3.5-turbo-0613")
      #Set a default chat history to handle cases where information is not provided
      str_cat = ','.join(list_filters)
      chat_history = [ChatMessage(role= 'user', content=f"Assume I earn an income of RM90,000. If I state my income chat, update it to the stated income. I want to buy an items in category {str_cat}")]
      system_prompt = "You are a tax advisory agent a you must only use information from the tool to answer queries. Other topics unrelated to personal income tax and does not use on of the tool should not be answered"
      agent = OpenAIAgent.from_tools(tools,system_prompt = system_prompt, chat_history = chat_history, verbose=True)
      # chat_engine = CondenseQuestionChatEngine.from_defaults(
      #     query_engine=query_engine,
      #     # condense_question_prompt=custom_prompt,
      #     # chat_history=custom_chat_history,
      #     verbose=True,
      # )
  
      return agent
  
apis: llama_index.tools.FunctionTool.from_defaults llama_index.vector_stores.PineconeVectorStore llama_index.tools.ToolMetadata llama_index.query_engine.RetrieverQueryEngine llama_index.VectorStoreIndex.from_vector_store llama_index.llms.OpenAI llama_index.llms.ChatMessage llama_index.agent.OpenAIAgent.from_tools
extract_api: [((721, 779), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.INFO'}), '(stream=sys.stdout, level=logging.INFO)\n', (740, 779), False, 'import logging\n'), ((1006, 1063), 'pinecone.init', 'pinecone.init', ([], {'api_key': 'api_key', 'environment': '"""gcp-starter"""'}), "(api_key=api_key, environment='gcp-starter')\n", (1019, 1063), False, 'import pinecone\n'), ((1085, 1119), 'pinecone.Index', 'pinecone.Index', (['"""quickstart-index"""'], {}), "('quickstart-index')\n", (1099, 1119), False, 'import pinecone\n'), ((1139, 1189), 'llama_index.vector_stores.PineconeVectorStore', 'PineconeVectorStore', ([], {'pinecone_index': 'pinecone_index'}), '(pinecone_index=pinecone_index)\n', (1158, 1189), False, 'from llama_index.vector_stores import PineconeVectorStore\n'), ((1217, 1265), 'llama_index.VectorStoreIndex.from_vector_store', 'VectorStoreIndex.from_vector_store', (['vector_store'], {}), '(vector_store)\n', (1251, 1265), False, 'from llama_index import VectorStoreIndex\n'), ((1583, 1624), 'llama_index.query_engine.RetrieverQueryEngine', 'RetrieverQueryEngine', ([], {'retriever': 'retriever'}), '(retriever=retriever)\n', (1603, 1624), False, 'from llama_index.query_engine import RetrieverQueryEngine\n'), ((1706, 1744), 'llama_index.tools.FunctionTool.from_defaults', 'FunctionTool.from_defaults', ([], {'fn': 'get_tax'}), '(fn=get_tax)\n', (1732, 1744), False, 'from llama_index.tools import BaseTool, FunctionTool\n'), ((1763, 1804), 'llama_index.tools.FunctionTool.from_defaults', 'FunctionTool.from_defaults', ([], {'fn': 'get_rebate'}), '(fn=get_rebate)\n', (1789, 1804), False, 'from llama_index.tools import BaseTool, FunctionTool\n'), ((2346, 2380), 'llama_index.llms.OpenAI', 'OpenAI', ([], {'model': '"""gpt-3.5-turbo-0613"""'}), "(model='gpt-3.5-turbo-0613')\n", (2352, 2380), False, 'from llama_index.llms import OpenAI\n'), ((2929, 3033), 'llama_index.agent.OpenAIAgent.from_tools', 'OpenAIAgent.from_tools', (['tools'], {'system_prompt': 'system_prompt', 'chat_history': 'chat_history', 'verbose': '(True)'}), '(tools, system_prompt=system_prompt, chat_history=\n    chat_history, verbose=True)\n', (2951, 3033), False, 'from llama_index.agent import OpenAIAgent\n'), ((815, 855), 'logging.StreamHandler', 'logging.StreamHandler', ([], {'stream': 'sys.stdout'}), '(stream=sys.stdout)\n', (836, 855), False, 'import logging\n'), ((2520, 2707), 'llama_index.llms.ChatMessage', 'ChatMessage', ([], {'role': '"""user"""', 'content': 'f"""Assume I earn an income of RM90,000. If I state my income chat, update it to the stated income. I want to buy an items in category {str_cat}"""'}), "(role='user', content=\n    f'Assume I earn an income of RM90,000. If I state my income chat, update it to the stated income. I want to buy an items in category {str_cat}'\n    )\n", (2531, 2707), False, 'from llama_index.llms import ChatMessage\n'), ((784, 803), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (801, 803), False, 'import logging\n'), ((1945, 2169), 'llama_index.tools.ToolMetadata', 'ToolMetadata', ([], {'name': '"""tax_relief_retriever"""', 'description': '"""Provides information on reliefs for a given item category and information on how to claim tax reliefsUse a detailed plain text question as input to the tool."""'}), "(name='tax_relief_retriever', description=\n    'Provides information on reliefs for a given item category and information on how to claim tax reliefsUse a detailed plain text question as input to the tool.'\n    )\n", (1957, 2169), False, 'from llama_index.tools import QueryEngineTool, ToolMetadata\n')]