code: import os
  import streamlit as st
  from dotenv import load_dotenv
  from llama_index import GPTVectorStoreIndex, LLMPredictor, PromptHelper, ServiceContext
  from langchain.llms.openai import OpenAI
  from biorxiv_manager import BioRxivManager 
  
  load_dotenv()
  openai_api_key = os.getenv("OPENAI_API_KEY")
  
  st.title("Ask BioRxiv")
  query = st.text_input("What would you like to ask? (source: BioRxiv files)", "")
  
  @st.cache_data
  def fetch_and_parse():
      # instantiating BioRxivManager runtime and fetch the parsed nodes
      manager = BioRxivManager()
      return manager.fetch_and_parse(interval="2023-07-01/2023-07-30")
  
  embedded_documents = fetch_and_parse()
  
  if st.button("Submit"):
      if not query.strip():
          st.error(f"Please provide the search query.")
      else:
          try:
              llm_predictor = LLMPredictor(llm=OpenAI(temperature=0, model_name="gpt-4-32k", openai_api_key=openai_api_key))
              max_input_size = 32767
              num_output = 400
              chunk_overlap_ratio = 0.2  # Adjust this value according to your need.
  
              prompt_helper = PromptHelper(max_input_size, num_output, chunk_overlap_ratio)
  
              service_context = ServiceContext.from_defaults(llm_predictor=llm_predictor, prompt_helper=prompt_helper)
              index = GPTVectorStoreIndex.from_documents(embedded_documents, service_context=service_context)
              
              response = index.query(query)
              st.success(response)
          except Exception as e:
              st.error(f"An error occurred: {e}")
  
apis: llama_index.PromptHelper llama_index.GPTVectorStoreIndex.from_documents llama_index.ServiceContext.from_defaults
extract_api: [((238, 251), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (249, 251), False, 'from dotenv import load_dotenv\n'), ((269, 296), 'os.getenv', 'os.getenv', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (278, 296), False, 'import os\n'), ((298, 321), 'streamlit.title', 'st.title', (['"""Ask BioRxiv"""'], {}), "('Ask BioRxiv')\n", (306, 321), True, 'import streamlit as st\n'), ((330, 402), 'streamlit.text_input', 'st.text_input', (['"""What would you like to ask? (source: BioRxiv files)"""', '""""""'], {}), "('What would you like to ask? (source: BioRxiv files)', '')\n", (343, 402), True, 'import streamlit as st\n'), ((656, 675), 'streamlit.button', 'st.button', (['"""Submit"""'], {}), "('Submit')\n", (665, 675), True, 'import streamlit as st\n'), ((526, 542), 'biorxiv_manager.BioRxivManager', 'BioRxivManager', ([], {}), '()\n', (540, 542), False, 'from biorxiv_manager import BioRxivManager\n'), ((711, 756), 'streamlit.error', 'st.error', (['f"""Please provide the search query."""'], {}), "(f'Please provide the search query.')\n", (719, 756), True, 'import streamlit as st\n'), ((1079, 1140), 'llama_index.PromptHelper', 'PromptHelper', (['max_input_size', 'num_output', 'chunk_overlap_ratio'], {}), '(max_input_size, num_output, chunk_overlap_ratio)\n', (1091, 1140), False, 'from llama_index import GPTVectorStoreIndex, LLMPredictor, PromptHelper, ServiceContext\n'), ((1172, 1263), 'llama_index.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'llm_predictor': 'llm_predictor', 'prompt_helper': 'prompt_helper'}), '(llm_predictor=llm_predictor, prompt_helper=\n    prompt_helper)\n', (1200, 1263), False, 'from llama_index import GPTVectorStoreIndex, LLMPredictor, PromptHelper, ServiceContext\n'), ((1279, 1371), 'llama_index.GPTVectorStoreIndex.from_documents', 'GPTVectorStoreIndex.from_documents', (['embedded_documents'], {'service_context': 'service_context'}), '(embedded_documents, service_context=\n    service_context)\n', (1313, 1371), False, 'from llama_index import GPTVectorStoreIndex, LLMPredictor, PromptHelper, ServiceContext\n'), ((1434, 1454), 'streamlit.success', 'st.success', (['response'], {}), '(response)\n', (1444, 1454), True, 'import streamlit as st\n'), ((1498, 1533), 'streamlit.error', 'st.error', (['f"""An error occurred: {e}"""'], {}), "(f'An error occurred: {e}')\n", (1506, 1533), True, 'import streamlit as st\n'), ((825, 901), 'langchain.llms.openai.OpenAI', 'OpenAI', ([], {'temperature': '(0)', 'model_name': '"""gpt-4-32k"""', 'openai_api_key': 'openai_api_key'}), "(temperature=0, model_name='gpt-4-32k', openai_api_key=openai_api_key)\n", (831, 901), False, 'from langchain.llms.openai import OpenAI\n')]