code: import streamlit as st
  import logging, sys, os
  import openai
  from dotenv import load_dotenv
  from llama_index.agent import OpenAIAgent
  from llama_index.llms import OpenAI
  from llama_hub.tools.zapier.base import ZapierToolSpec
  
  #loads dotenv lib to retrieve API keys from .env file
  load_dotenv()
  openai.api_key = os.getenv("OPENAI_API_KEY")
  
  # enable INFO level logging
  logging.basicConfig(stream=sys.stdout, level=logging.INFO)
  logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
  
  # add a title for our UI
  st.title("GitHub Archive Analysis")
  
  # add a text area for user to enter SQL query
  sql_query = st.text_area("Enter your SQL query here")
  if sql_query:
  
      # establish connection to Snowflake
      conn = st.experimental_connection('snowpark')
  
      # run query based on the SQL entered 
      df = conn.query(sql_query)
  
      # write query result on UI
      st.write(df)
      
      # add a line chart to display the result visually
      st.line_chart(df, x="REPO_NAME", y="SUM_STARS")
  
      # get the most-starred repo
      top_repo = df.iloc[0, :]
      
      # construct zapier_spec by passing in Zapier API key
      zapier_spec = ZapierToolSpec(api_key=os.getenv("ZAPIER_API_KEY"))
  
      # initialize llm
      llm = OpenAI(model="gpt-3.5-turbo-0613")
  
      # initialize OpenAI agent by passing in zapier_spec and the llm
      agent = OpenAIAgent.from_tools(zapier_spec.to_tool_list(), verbose=True, llm=llm)
  
      # add instructions
      agent.chat(f"Send me an email on the details of {top_repo['REPO_NAME']}.")
      agent.chat(f"Add a task to my CoSchedule calendar to check out {top_repo['REPO_NAME']} with due date August 3rd 2023.")
  
apis: llama_index.llms.OpenAI
extract_api: [((280, 293), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (291, 293), False, 'from dotenv import load_dotenv\n'), ((311, 338), 'os.getenv', 'os.getenv', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (320, 338), False, 'import logging, sys, os\n'), ((368, 426), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.INFO'}), '(stream=sys.stdout, level=logging.INFO)\n', (387, 426), False, 'import logging, sys, os\n'), ((526, 561), 'streamlit.title', 'st.title', (['"""GitHub Archive Analysis"""'], {}), "('GitHub Archive Analysis')\n", (534, 561), True, 'import streamlit as st\n'), ((621, 662), 'streamlit.text_area', 'st.text_area', (['"""Enter your SQL query here"""'], {}), "('Enter your SQL query here')\n", (633, 662), True, 'import streamlit as st\n'), ((458, 498), 'logging.StreamHandler', 'logging.StreamHandler', ([], {'stream': 'sys.stdout'}), '(stream=sys.stdout)\n', (479, 498), False, 'import logging, sys, os\n'), ((729, 767), 'streamlit.experimental_connection', 'st.experimental_connection', (['"""snowpark"""'], {}), "('snowpark')\n", (755, 767), True, 'import streamlit as st\n'), ((878, 890), 'streamlit.write', 'st.write', (['df'], {}), '(df)\n', (886, 890), True, 'import streamlit as st\n'), ((954, 1001), 'streamlit.line_chart', 'st.line_chart', (['df'], {'x': '"""REPO_NAME"""', 'y': '"""SUM_STARS"""'}), "(df, x='REPO_NAME', y='SUM_STARS')\n", (967, 1001), True, 'import streamlit as st\n'), ((1228, 1262), 'llama_index.llms.OpenAI', 'OpenAI', ([], {'model': '"""gpt-3.5-turbo-0613"""'}), "(model='gpt-3.5-turbo-0613')\n", (1234, 1262), False, 'from llama_index.llms import OpenAI\n'), ((427, 446), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (444, 446), False, 'import logging, sys, os\n'), ((1167, 1194), 'os.getenv', 'os.getenv', (['"""ZAPIER_API_KEY"""'], {}), "('ZAPIER_API_KEY')\n", (1176, 1194), False, 'import logging, sys, os\n')]