code: from llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext
  from llama_index.embeddings import resolve_embed_model
  
  # Don't Import "from openai import OpenAI". It will panic
  from llama_index.llms import OpenAI
  
  # load data
  documents = SimpleDirectoryReader("data").load_data()
  
  # bge-m3 embedding model
  embed_model = resolve_embed_model("local:BAAI/bge-small-en-v1.5")
  
  # set LM Studio
  llm = OpenAI(api_base="http://localhost:1234/v1", api_key="not-needed")
  
  # Index the data
  service_context = ServiceContext.from_defaults(
      embed_model=embed_model, llm=llm,
  )
  index = VectorStoreIndex.from_documents(
      documents, service_context=service_context
  )
  
  # query
  query_engine = index.as_query_engine()
  response = query_engine.query("What did the author do growing up?")
  print(response)
apis: llama_index.VectorStoreIndex.from_documents llama_index.ServiceContext.from_defaults llama_index.embeddings.resolve_embed_model llama_index.SimpleDirectoryReader llama_index.llms.OpenAI
extract_api: [((337, 388), 'llama_index.embeddings.resolve_embed_model', 'resolve_embed_model', (['"""local:BAAI/bge-small-en-v1.5"""'], {}), "('local:BAAI/bge-small-en-v1.5')\n", (356, 388), False, 'from llama_index.embeddings import resolve_embed_model\n'), ((412, 477), 'llama_index.llms.OpenAI', 'OpenAI', ([], {'api_base': '"""http://localhost:1234/v1"""', 'api_key': '"""not-needed"""'}), "(api_base='http://localhost:1234/v1', api_key='not-needed')\n", (418, 477), False, 'from llama_index.llms import OpenAI\n'), ((514, 576), 'llama_index.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'embed_model': 'embed_model', 'llm': 'llm'}), '(embed_model=embed_model, llm=llm)\n', (542, 576), False, 'from llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext\n'), ((592, 667), 'llama_index.VectorStoreIndex.from_documents', 'VectorStoreIndex.from_documents', (['documents'], {'service_context': 'service_context'}), '(documents, service_context=service_context)\n', (623, 667), False, 'from llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext\n'), ((255, 284), 'llama_index.SimpleDirectoryReader', 'SimpleDirectoryReader', (['"""data"""'], {}), "('data')\n", (276, 284), False, 'from llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext\n')]