code: import llama_index.core
  
  
  llama_index.core.set_global_handler("simple")
  
  
  from llama_index.core import SimpleDirectoryReader
  
  from llama_index.core.node_parser import SimpleFileNodeParser
  
  from llama_index.core import VectorStoreIndex
  
  #Loading
  documents = SimpleDirectoryReader("dataset/txt").load_data()
  print(documents[0])
  
  #parser = SimpleFileNodeParser()
  #nodes = parser.get_nodes_from_documents(documents)
  #print(nodes[0])
  
  #Index
  index = VectorStoreIndex.from_documents(documents)
  print(index)
  
  #Querying
  query_engine = index.as_query_engine()
  print(query_engine)
  
  response = query_engine.query("What is AIGC?")
  print(response)
  
  
  #Agent
  from llama_index.core.indices.query.query_transform.base import StepDecomposeQueryTransform
  from llama_index.core.query_engine import MultiStepQueryEngine
  from llama_index.core.query_engine import SubQuestionQueryEngine
  
  DEFAULT_STEP_DECOMPOSE_QUERY_TRANSFORM_TMPL = (
      "The original question is as follows: {query_str}\n"
      "We have an opportunity to answer some, or all of the question from a "
      "knowledge source. "
      "Context information for the knowledge source is provided below, as "
      "well as previous reasoning steps.\n"
      "Given the context and previous reasoning, return a question that can "
      "be answered from "
      "the context. This question can be the same as the original question, "
      "or this question can represent a subcomponent of the overall question."
      "It should not be irrelevant to the original question.\n"
      "If we cannot extract more information from the context, provide 'None' "
      "as the answer. "
      "Some examples are given below: "
      "\n\n"
      "Question: How many Grand Slam titles does the winner of the 2020 Australian "
      "Open have?\n"
      "Knowledge source context: Provides names of the winners of the 2020 "
      "Australian Open\n"
      "Previous reasoning: None\n"
      "Next question: Who was the winner of the 2020 Australian Open? "
      "\n\n"
      "Question: Who was the winner of the 2020 Australian Open?\n"
      "Knowledge source context: Provides names of the winners of the 2020 "
      "Australian Open\n"
      "Previous reasoning: None.\n"
      "New question: Who was the winner of the 2020 Australian Open? "
      "\n\n"
      "Question: How many Grand Slam titles does the winner of the 2020 Australian "
      "Open have?\n"
      "Knowledge source context: Provides information about the winners of the 2020 "
      "Australian Open\n"
      "Previous reasoning:\n"
      "- Who was the winner of the 2020 Australian Open? \n"
      "- The winner of the 2020 Australian Open was Novak Djokovic.\n"
      "New question: None"
      "\n\n"
      "Question: How many Grand Slam titles does the winner of the 2020 Australian "
      "Open have?\n"
      "Knowledge source context: Provides information about the winners of the 2020 "
      "Australian Open - includes biographical information for each winner\n"
      "Previous reasoning:\n"
      "- Who was the winner of the 2020 Australian Open? \n"
      "- The winner of the 2020 Australian Open was Novak Djokovic.\n"
      "New question: How many Grand Slam titles does Novak Djokovic have? "
      "\n\n"
      "Question: {query_str}\n"
      "Knowledge source context: {context_str}\n"
      "Previous reasoning: {prev_reasoning}\n"
      "New question: "
  )
  
  print(DEFAULT_STEP_DECOMPOSE_QUERY_TRANSFORM_TMPL)
apis: llama_index.core.VectorStoreIndex.from_documents llama_index.core.SimpleDirectoryReader
extract_api: [((445, 487), 'llama_index.core.VectorStoreIndex.from_documents', 'VectorStoreIndex.from_documents', (['documents'], {}), '(documents)\n', (476, 487), False, 'from llama_index.core import VectorStoreIndex\n'), ((257, 293), 'llama_index.core.SimpleDirectoryReader', 'SimpleDirectoryReader', (['"""dataset/txt"""'], {}), "('dataset/txt')\n", (278, 293), False, 'from llama_index.core import SimpleDirectoryReader\n')]