code: get_ipython().run_line_magic('pip', 'install llama-index-llms-openai')
  
  
  import os
  from getpass import getpass
  
  if os.getenv("OPENAI_API_KEY") is None:
      os.environ["OPENAI_API_KEY"] = getpass(
          "Paste your OpenAI key from:"
          " https://platform.openai.com/account/api-keys\n"
      )
  assert os.getenv("OPENAI_API_KEY", "").startswith(
      "sk-"
  ), "This doesn't look like a valid OpenAI API key"
  print("OpenAI API key configured")
  
  
  import os
  from getpass import getpass
  
  if os.getenv("HONEYHIVE_API_KEY") is None:
      os.environ["HONEYHIVE_API_KEY"] = getpass(
          "Paste your HoneyHive key from:"
          " https://app.honeyhive.ai/settings/account\n"
      )
  print("HoneyHive API key configured")
  
  
  
  get_ipython().system('pip install llama-index')
  
  
  from llama_index.core.callbacks import CallbackManager
  from llama_index.core.callbacks import LlamaDebugHandler
  from llama_index.core import (
      VectorStoreIndex,
      SimpleDirectoryReader,
      SimpleKeywordTableIndex,
      StorageContext,
  )
  from llama_index.core import ComposableGraph
  from llama_index.llms.openai import OpenAI
  from honeyhive.utils.llamaindex_tracer import HoneyHiveLlamaIndexTracer
  
  
  
  from llama_index.core import Settings
  
  Settings.llm = OpenAI(model="gpt-4", temperature=0)
  
  
  
  
  import llama_index.core
  from llama_index.core import set_global_handler
  
  set_global_handler(
      "honeyhive",
      project="My LlamaIndex Project",
      name="My LlamaIndex Pipeline",
      api_key=os.environ["HONEYHIVE_API_KEY"],
  )
  hh_tracer = llama_index.core.global_handler
  
  
  
  llama_debug = LlamaDebugHandler(print_trace_on_end=True)
  
  hh_tracer = HoneyHiveLlamaIndexTracer(
      project="My LlamaIndex Project",
      name="My LlamaIndex Pipeline",
      api_key=os.environ["HONEYHIVE_API_KEY"],
  )
  
  callback_manager = CallbackManager([llama_debug, hh_tracer])
  
  Settings.callback_manager = callback_manager
  
  
  
  
  get_ipython().system("mkdir -p 'data/paul_graham/'")
  get_ipython().system("wget 'https://raw.githubusercontent.com/run-llama/llama_index/main/docs/examples/data/paul_graham/paul_graham_essay.txt' -O 'data/paul_graham/paul_graham_essay.txt'")
  
  
  docs = SimpleDirectoryReader("./data/paul_graham/").load_data()
  
  
  index = VectorStoreIndex.from_documents(docs)
  
  
  
  query_engine = index.as_query_engine()
  response = query_engine.query("What did the author do growing up?")
  print(response, sep="\n")
apis: llama_index.core.callbacks.LlamaDebugHandler llama_index.core.callbacks.CallbackManager llama_index.core.set_global_handler llama_index.core.VectorStoreIndex.from_documents llama_index.core.SimpleDirectoryReader llama_index.llms.openai.OpenAI
extract_api: [((1229, 1265), 'llama_index.llms.openai.OpenAI', 'OpenAI', ([], {'model': '"""gpt-4"""', 'temperature': '(0)'}), "(model='gpt-4', temperature=0)\n", (1235, 1265), False, 'from llama_index.llms.openai import OpenAI\n'), ((1343, 1484), 'llama_index.core.set_global_handler', 'set_global_handler', (['"""honeyhive"""'], {'project': '"""My LlamaIndex Project"""', 'name': '"""My LlamaIndex Pipeline"""', 'api_key': "os.environ['HONEYHIVE_API_KEY']"}), "('honeyhive', project='My LlamaIndex Project', name=\n    'My LlamaIndex Pipeline', api_key=os.environ['HONEYHIVE_API_KEY'])\n", (1361, 1484), False, 'from llama_index.core import set_global_handler\n'), ((1560, 1602), 'llama_index.core.callbacks.LlamaDebugHandler', 'LlamaDebugHandler', ([], {'print_trace_on_end': '(True)'}), '(print_trace_on_end=True)\n', (1577, 1602), False, 'from llama_index.core.callbacks import LlamaDebugHandler\n'), ((1616, 1751), 'honeyhive.utils.llamaindex_tracer.HoneyHiveLlamaIndexTracer', 'HoneyHiveLlamaIndexTracer', ([], {'project': '"""My LlamaIndex Project"""', 'name': '"""My LlamaIndex Pipeline"""', 'api_key': "os.environ['HONEYHIVE_API_KEY']"}), "(project='My LlamaIndex Project', name=\n    'My LlamaIndex Pipeline', api_key=os.environ['HONEYHIVE_API_KEY'])\n", (1641, 1751), False, 'from honeyhive.utils.llamaindex_tracer import HoneyHiveLlamaIndexTracer\n'), ((1782, 1823), 'llama_index.core.callbacks.CallbackManager', 'CallbackManager', (['[llama_debug, hh_tracer]'], {}), '([llama_debug, hh_tracer])\n', (1797, 1823), False, 'from llama_index.core.callbacks import CallbackManager\n'), ((2192, 2229), 'llama_index.core.VectorStoreIndex.from_documents', 'VectorStoreIndex.from_documents', (['docs'], {}), '(docs)\n', (2223, 2229), False, 'from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, SimpleKeywordTableIndex, StorageContext\n'), ((115, 142), 'os.getenv', 'os.getenv', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (124, 142), False, 'import os\n'), ((187, 282), 'getpass.getpass', 'getpass', (['"""Paste your OpenAI key from: https://platform.openai.com/account/api-keys\n"""'], {}), "(\n    'Paste your OpenAI key from: https://platform.openai.com/account/api-keys\\n'\n    )\n", (194, 282), False, 'from getpass import getpass\n'), ((489, 519), 'os.getenv', 'os.getenv', (['"""HONEYHIVE_API_KEY"""'], {}), "('HONEYHIVE_API_KEY')\n", (498, 519), False, 'import os\n'), ((567, 662), 'getpass.getpass', 'getpass', (['"""Paste your HoneyHive key from: https://app.honeyhive.ai/settings/account\n"""'], {}), "(\n    'Paste your HoneyHive key from: https://app.honeyhive.ai/settings/account\\n'\n    )\n", (574, 662), False, 'from getpass import getpass\n'), ((305, 336), 'os.getenv', 'os.getenv', (['"""OPENAI_API_KEY"""', '""""""'], {}), "('OPENAI_API_KEY', '')\n", (314, 336), False, 'import os\n'), ((2125, 2169), 'llama_index.core.SimpleDirectoryReader', 'SimpleDirectoryReader', (['"""./data/paul_graham/"""'], {}), "('./data/paul_graham/')\n", (2146, 2169), False, 'from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, SimpleKeywordTableIndex, StorageContext\n')]