code: import streamlit as st
  import os
  import sys
  import openai
  from streamlit_extras.switch_page_button import switch_page
  from llama_index import VectorStoreIndex, GithubRepositoryReader, ServiceContext, set_global_service_context
  from llama_index.llms import OpenAI
  from database.neo4j_connection import connect_to_db
  
  
  st.set_page_config(
      page_title="Authentication",
      page_icon="🔐",
  )
  
  st.write("# Welcome to AI GitHub Repo reader!")
  
  st.sidebar.success("Fill the details to get started 👉")
  
  st.write("## Enter the details below :")
  api_key = st.text_input("Enter your OpenAI API key (https://platform.openai.com/account/api-keys)", type="password")
  github_token = st.text_input("Enter your GitHub Token (https://github.com/settings/tokens)", type="password")
  repository_link = st.text_input("Enter the link of the repository by selecting a branch (e.g., https://github.com/openai/whisper/tree/main)", placeholder="https://github.com/owner/repository/tree/branch")
  st.session_state['repository_link'] = repository_link
  st.session_state['api_key'] = api_key
  st.session_state['github_token'] = github_token
  
  
  if not api_key or not github_token or not repository_link:
      st.sidebar.warning("⚠️ Please enter OpenAI API key, GitHub Token and GitHub Repository link.")
  else:
      if st.button("Submit", use_container_width=True):
  
          os.environ["OPENAI_API_KEY"] = api_key
          openai.api_key = os.environ["OPENAI_API_KEY"]
          os.environ["GITHUB_TOKEN"] = github_token
          llm = OpenAI(model="gpt-4", temperature=0.5, )
          # configure service context
          service_context = ServiceContext.from_defaults(llm=llm)
          set_global_service_context(service_context)
          st.markdown("✅ API Key, Token and Repository link submitted successfully!")
          with st.spinner("Loading documents from GitHub..."):
                  try:
                      url_parts = repository_link.split('/')
                      owner = url_parts[3]
                      repo = url_parts[4]
                      branch = url_parts[-1].split('/')[-1]
                      documents = GithubRepositoryReader(
                          github_token=os.environ["GITHUB_TOKEN"],
                          owner=owner,
                          repo=repo,
                          use_parser=False,
                          verbose=False,
                      ).load_data(branch=branch)
  
                      # Create the vector store index and query engine
                      connect_to_db(service_context, documents)
                      #index = VectorStoreIndex.from_documents(documents, service_context=service_context)
                      #index = VectorStoreIndex.from_documents(documents)
                      #query_engine = index.as_query_engine()
                      query_engine = index.as_query_engine(
                          include_text=True,
                          response_mode="tree_summarize",
                          embedding_mode="hybrid",
                          similarity_top_k=5,
                      )
                      st.session_state['documents'] = documents
                      st.session_state['query_engine'] = query_engine
                      
                      
                  except Exception as e:
                      st.error(f"An error occurred: {str(e)}")
                  st.success('Done!', icon="✅")
                  st.markdown("Click Next to see Repository Analysis")
                  switch_page("repository analysis")
apis: llama_index.set_global_service_context llama_index.llms.OpenAI llama_index.ServiceContext.from_defaults llama_index.GithubRepositoryReader
extract_api: [((317, 379), 'streamlit.set_page_config', 'st.set_page_config', ([], {'page_title': '"""Authentication"""', 'page_icon': '"""🔐"""'}), "(page_title='Authentication', page_icon='🔐')\n", (335, 379), True, 'import streamlit as st\n'), ((392, 439), 'streamlit.write', 'st.write', (['"""# Welcome to AI GitHub Repo reader!"""'], {}), "('# Welcome to AI GitHub Repo reader!')\n", (400, 439), True, 'import streamlit as st\n'), ((441, 496), 'streamlit.sidebar.success', 'st.sidebar.success', (['"""Fill the details to get started 👉"""'], {}), "('Fill the details to get started 👉')\n", (459, 496), True, 'import streamlit as st\n'), ((498, 538), 'streamlit.write', 'st.write', (['"""## Enter the details below :"""'], {}), "('## Enter the details below :')\n", (506, 538), True, 'import streamlit as st\n'), ((549, 664), 'streamlit.text_input', 'st.text_input', (['"""Enter your OpenAI API key (https://platform.openai.com/account/api-keys)"""'], {'type': '"""password"""'}), "(\n    'Enter your OpenAI API key (https://platform.openai.com/account/api-keys)',\n    type='password')\n", (562, 664), True, 'import streamlit as st\n'), ((671, 769), 'streamlit.text_input', 'st.text_input', (['"""Enter your GitHub Token (https://github.com/settings/tokens)"""'], {'type': '"""password"""'}), "('Enter your GitHub Token (https://github.com/settings/tokens)',\n    type='password')\n", (684, 769), True, 'import streamlit as st\n'), ((784, 980), 'streamlit.text_input', 'st.text_input', (['"""Enter the link of the repository by selecting a branch (e.g., https://github.com/openai/whisper/tree/main)"""'], {'placeholder': '"""https://github.com/owner/repository/tree/branch"""'}), "(\n    'Enter the link of the repository by selecting a branch (e.g., https://github.com/openai/whisper/tree/main)'\n    , placeholder='https://github.com/owner/repository/tree/branch')\n", (797, 980), True, 'import streamlit as st\n'), ((1176, 1275), 'streamlit.sidebar.warning', 'st.sidebar.warning', (['"""⚠️ Please enter OpenAI API key, GitHub Token and GitHub Repository link."""'], {}), "(\n    '⚠️ Please enter OpenAI API key, GitHub Token and GitHub Repository link.')\n", (1194, 1275), True, 'import streamlit as st\n'), ((1284, 1329), 'streamlit.button', 'st.button', (['"""Submit"""'], {'use_container_width': '(True)'}), "('Submit', use_container_width=True)\n", (1293, 1329), True, 'import streamlit as st\n'), ((1497, 1535), 'llama_index.llms.OpenAI', 'OpenAI', ([], {'model': '"""gpt-4"""', 'temperature': '(0.5)'}), "(model='gpt-4', temperature=0.5)\n", (1503, 1535), False, 'from llama_index.llms import OpenAI\n'), ((1600, 1637), 'llama_index.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'llm': 'llm'}), '(llm=llm)\n', (1628, 1637), False, 'from llama_index import VectorStoreIndex, GithubRepositoryReader, ServiceContext, set_global_service_context\n'), ((1646, 1689), 'llama_index.set_global_service_context', 'set_global_service_context', (['service_context'], {}), '(service_context)\n', (1672, 1689), False, 'from llama_index import VectorStoreIndex, GithubRepositoryReader, ServiceContext, set_global_service_context\n'), ((1698, 1773), 'streamlit.markdown', 'st.markdown', (['"""✅ API Key, Token and Repository link submitted successfully!"""'], {}), "('✅ API Key, Token and Repository link submitted successfully!')\n", (1709, 1773), True, 'import streamlit as st\n'), ((1787, 1833), 'streamlit.spinner', 'st.spinner', (['"""Loading documents from GitHub..."""'], {}), "('Loading documents from GitHub...')\n", (1797, 1833), True, 'import streamlit as st\n'), ((3304, 3333), 'streamlit.success', 'st.success', (['"""Done!"""'], {'icon': '"""✅"""'}), "('Done!', icon='✅')\n", (3314, 3333), True, 'import streamlit as st\n'), ((3350, 3402), 'streamlit.markdown', 'st.markdown', (['"""Click Next to see Repository Analysis"""'], {}), "('Click Next to see Repository Analysis')\n", (3361, 3402), True, 'import streamlit as st\n'), ((3419, 3453), 'streamlit_extras.switch_page_button.switch_page', 'switch_page', (['"""repository analysis"""'], {}), "('repository analysis')\n", (3430, 3453), False, 'from streamlit_extras.switch_page_button import switch_page\n'), ((2465, 2506), 'database.neo4j_connection.connect_to_db', 'connect_to_db', (['service_context', 'documents'], {}), '(service_context, documents)\n', (2478, 2506), False, 'from database.neo4j_connection import connect_to_db\n'), ((2086, 2210), 'llama_index.GithubRepositoryReader', 'GithubRepositoryReader', ([], {'github_token': "os.environ['GITHUB_TOKEN']", 'owner': 'owner', 'repo': 'repo', 'use_parser': '(False)', 'verbose': '(False)'}), "(github_token=os.environ['GITHUB_TOKEN'], owner=owner,\n    repo=repo, use_parser=False, verbose=False)\n", (2108, 2210), False, 'from llama_index import VectorStoreIndex, GithubRepositoryReader, ServiceContext, set_global_service_context\n')]