code: import streamlit as st
  import llama_index
  from llama_index import StorageContext, load_index_from_storage
  from llama_index.query_engine import RetrieverQueryEngine
  from llama_index.storage.docstore import SimpleDocumentStore
  from llama_index.vector_stores import SimpleVectorStore
  from llama_index.storage.index_store import SimpleIndexStore
  from llama_index import KeywordTableIndex
  from llama_index.indices.keyword_table import SimpleKeywordTableIndex
  from llama_index import ResponseSynthesizer
  from llama_index.indices.postprocessor import SimilarityPostprocessor
  from llama_index.retrievers import VectorIndexRetriever
  from llama_index.retrievers import ListIndexRetriever
  from llama_index.retrievers import TreeRootRetriever
  from llama_index.indices.keyword_table.retrievers import KeywordTableGPTRetriever
  from llama_index.indices.keyword_table import GPTSimpleKeywordTableIndex
  from llama_index.indices.keyword_table.retrievers import KeywordTableRAKERetriever
  from llama_index.indices.keyword_table.retrievers import KeywordTableSimpleRetriever
  from llama_index import Prompt
  from llama_index import LLMPredictor
  from langchain.chat_models import ChatOpenAI
  from llama_index import ServiceContext
  
  
  def main():
  
      st.title("Llama Index App")
  
      # Select indexes
      index_names = ["vector_store", "table", "tree", "list"]
      index_choices = st.multiselect("Select indexes", index_names)
  
      # Load indexes from storage contexts
      indices = []
      for index_name in index_choices:
          storage_context = StorageContext.from_defaults(
              docstore=SimpleDocumentStore.from_persist_dir(persist_dir=index_name),
              vector_store=SimpleVectorStore.from_persist_dir(persist_dir=index_name),
              index_store=SimpleIndexStore.from_persist_dir(persist_dir=index_name),
          )
          index = load_index_from_storage(storage_context)
          indices.append(index)
  
      # Prompt user for query
      query = st.text_input("Enter your query")
  
      # Query the indexes
      response = None
      for index in indices:
          TEMPLATE_STR = (
          "We have provided context information below. \n"
          "---------------------\n"
          "{context_str}"
          "\n---------------------\n"
          "Given this information, please answer the question: {query_str}\n"
          )
          QA_TEMPLATE = Prompt(TEMPLATE_STR)
          llm_predictor = LLMPredictor(llm=ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo", streaming=True))
          service_context = ServiceContext.from_defaults(llm_predictor=llm_predictor, chunk_size=1024)
          query_engine = index.as_query_engine(
          service_context=service_context,
          text_qa_template=QA_TEMPLATE,
          similarity_top_k=3,
          streaming=True,
          )
          response = query_engine.query(query)
          st.subheader(f"Results from {index.__class__.__name__}")
  
      # Display the response
          if response:
              # formatted_sources = response.get_formatted_sources()
              
              st.text(response)
              print(response)
  
  
  if __name__ == "__main__":
      main()
  
  
  ###### working ########
apis: llama_index.storage.docstore.SimpleDocumentStore.from_persist_dir llama_index.ServiceContext.from_defaults llama_index.storage.index_store.SimpleIndexStore.from_persist_dir llama_index.Prompt llama_index.load_index_from_storage llama_index.vector_stores.SimpleVectorStore.from_persist_dir
extract_api: [((1225, 1252), 'streamlit.title', 'st.title', (['"""Llama Index App"""'], {}), "('Llama Index App')\n", (1233, 1252), True, 'import streamlit as st\n'), ((1355, 1400), 'streamlit.multiselect', 'st.multiselect', (['"""Select indexes"""', 'index_names'], {}), "('Select indexes', index_names)\n", (1369, 1400), True, 'import streamlit as st\n'), ((1942, 1975), 'streamlit.text_input', 'st.text_input', (['"""Enter your query"""'], {}), "('Enter your query')\n", (1955, 1975), True, 'import streamlit as st\n'), ((1830, 1870), 'llama_index.load_index_from_storage', 'load_index_from_storage', (['storage_context'], {}), '(storage_context)\n', (1853, 1870), False, 'from llama_index import StorageContext, load_index_from_storage\n'), ((2331, 2351), 'llama_index.Prompt', 'Prompt', (['TEMPLATE_STR'], {}), '(TEMPLATE_STR)\n', (2337, 2351), False, 'from llama_index import Prompt\n'), ((2490, 2564), 'llama_index.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'llm_predictor': 'llm_predictor', 'chunk_size': '(1024)'}), '(llm_predictor=llm_predictor, chunk_size=1024)\n', (2518, 2564), False, 'from llama_index import ServiceContext\n'), ((2805, 2861), 'streamlit.subheader', 'st.subheader', (['f"""Results from {index.__class__.__name__}"""'], {}), "(f'Results from {index.__class__.__name__}')\n", (2817, 2861), True, 'import streamlit as st\n'), ((3003, 3020), 'streamlit.text', 'st.text', (['response'], {}), '(response)\n', (3010, 3020), True, 'import streamlit as st\n'), ((1574, 1634), 'llama_index.storage.docstore.SimpleDocumentStore.from_persist_dir', 'SimpleDocumentStore.from_persist_dir', ([], {'persist_dir': 'index_name'}), '(persist_dir=index_name)\n', (1610, 1634), False, 'from llama_index.storage.docstore import SimpleDocumentStore\n'), ((1661, 1719), 'llama_index.vector_stores.SimpleVectorStore.from_persist_dir', 'SimpleVectorStore.from_persist_dir', ([], {'persist_dir': 'index_name'}), '(persist_dir=index_name)\n', (1695, 1719), False, 'from llama_index.vector_stores import SimpleVectorStore\n'), ((1745, 1802), 'llama_index.storage.index_store.SimpleIndexStore.from_persist_dir', 'SimpleIndexStore.from_persist_dir', ([], {'persist_dir': 'index_name'}), '(persist_dir=index_name)\n', (1778, 1802), False, 'from llama_index.storage.index_store import SimpleIndexStore\n'), ((2393, 2462), 'langchain.chat_models.ChatOpenAI', 'ChatOpenAI', ([], {'temperature': '(0)', 'model_name': '"""gpt-3.5-turbo"""', 'streaming': '(True)'}), "(temperature=0, model_name='gpt-3.5-turbo', streaming=True)\n", (2403, 2462), False, 'from langchain.chat_models import ChatOpenAI\n')]