class_docstr: Integration with the LlamaIndex data framework for LLM applications.
class_docstr_tok: ["Integration","with","the","LlamaIndex","data","framework","for","LLM","applications","."]
code: def create(
      self,
      target: str,
      df: Optional[pd.DataFrame] = None,
      args: Optional[Dict] = None,
  ) -> None:
      if "using" not in args:
          raise Exception(
              "LlamaIndex engine requires a USING clause! Refer to its documentation for more details."
          )
  
      if "index_class" not in args["using"]:
          args["using"]["index_class"] = self.default_index_class
      elif (
          args["using"]["index_class"] not in self.supported_index_class
      ):
          raise Exception(
              f"Invalid index class argument. Please use one of {self.supported_index_class}"
          )
  
      if "reader" not in args["using"]:
          args["using"]["reader"] = self.default_reader
      elif args["using"]["reader"] not in self.supported_reader:
          raise Exception(
              f"Invalid operation mode. Please use one of {self.supported_reader}"
          )
  
      # workaround to create llama model without input data
      if df is None or df.empty:
          df = pd.DataFrame([{"text": ""}])
  
      if args["using"]["reader"] == "DFReader":
          dstrs = df.apply(
              lambda x: ", ".join(
                  [
                      f"{col}: {str(entry)}"
                      for col, entry in zip(df.columns, x)
                  ]
              ),
              axis=1,
          )
          reader = list(map(lambda x: Document(text=x), dstrs.tolist()))
  
      elif args["using"]["reader"] == "SimpleWebPageReader":
          url = args["using"]["source_url_link"]
          config = Config()
          is_cloud = config.get("cloud", False)
          if is_cloud and is_private_url(url):
              raise Exception(f"URL is private: {url}")
  
          reader = SimpleWebPageReader(html_to_text=True).load_data(
              [url]
          )
  
      elif args["using"]["reader"] == "GithubRepositoryReader":
          engine_storage = self.engine_storage
  
          key = "GITHUB_TOKEN"
          github_token = get_api_key(
              key,
              "llama_index",
              args["using"],
              engine_storage,
              strict=False,
          )
          if github_token is None:
              github_token = get_api_key(
                  key.lower(),
                  "llama_index",
                  args["using"],
                  engine_storage,
                  strict=True,
              )
  
          github_client = GithubClient(github_token)
          owner = args["using"]["owner"]
          repo = args["using"]["repo"]
          filter_file_extensions = _get_filter_file_extensions(
              args["using"]
          )
          filter_directories = _get_filter_directories(args["using"])
  
          reader = GithubRepositoryReader(
              github_client,
              owner=owner,
              repo=repo,
              verbose=True,
              filter_file_extensions=filter_file_extensions,
              filter_directories=filter_directories,
          ).load_data(branch=args["using"].get("branch", "main"))
  
      elif args["using"]["reader"] == "YoutubeTranscriptReader":
          ytlinks = args["using"]["ytlinks"]
          for link in ytlinks:
              if not is_youtube_video(link):
                  raise Exception(f"Invalid youtube link: {link}")
          reader = YoutubeTranscriptReader().load_data(ytlinks)
  
      else:
          raise Exception(
              f"Invalid operation mode. Please use one of {self.supported_reader}."
          )
  
      self.model_storage.json_set("args", args)
      index = self._setup_index(reader)
      path = self.model_storage.folder_get("context")
      index.storage_context.persist(persist_dir=path)
      self.model_storage.folder_sync("context")
  
imports: import os
  from typing import Optional, Dict
  import openai
  import pandas
  import llama_index
  from langchain.llms import OpenAI
  from llama_index.readers.schema.base import Document
  from llama_index.readers import SimpleWebPageReader
  from llama_index.prompts import PromptTemplate
  from llama_index import ServiceContext, StorageContext, load_index_from_storage
  from llama_index import LLMPredictor, OpenAIEmbedding
  from llama_index.indices.vector_store.base import VectorStore
  from llama_hub.github_repo import GithubClient, GithubRepositoryReader
  from llama_hub.youtube_transcript import YoutubeTranscriptReader, is_youtube_video
  from mindsdb.integrations.libs.base import BaseMLEngine
  from mindsdb.utilities.config import Config
  from mindsdb.utilities.security import is_private_url
  from mindsdb.integrations.handlers.llama_index_handler import config
  from mindsdb.integrations.handlers.llama_index_handler.github_loader_helper import _get_github_token, _get_filter_file_extensions, _get_filter_directories
  from mindsdb.integrations.utilities.handler_utils import get_api_key
label_desc: Use image node_id 3 for calling the LlamaIndexHandler obj's underlying member method code with example usage: obj.create(target, df, args) without return types