code: import lancedb
  from langchain.prompts import PromptTemplate
  from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
  from langchain_community.llms import GPT4All
  from langchain.chains import ConversationalRetrievalChain, LLMChain
  from langchain_community.vectorstores import LanceDB
  from langchain_community.embeddings import GPT4AllEmbeddings
  
  db = lancedb.connect("./lancedb")
  
  table = db.open_table("Peter_Griffin")
  
  vectorStore = LanceDB(table, GPT4AllEmbeddings())
  
  localPath = ("./models/wizardlm-13b-v1.2.q4_0.gguf")
  
  template = """
  Answer the question in detail using the context provided.
  Context: {context}
  ---
  Chat history: {chat_history}
  ---
  Question: {question}
  """
  
  
  prompt = PromptTemplate(
      template = template,
      input_variables=["context, question", "chat_history"]
  )
  
  callbacks = [StreamingStdOutCallbackHandler()]
  
  llm = GPT4All(
      model=localPath,
      callbacks=callbacks,
      verbose = True
  )
  
  qa = ConversationalRetrievalChain.from_llm(
      llm,
      vectorStore.as_retriever(
          search_type='similarity',
          search_kwargs={
              "k": 4
          }
      ),
      combine_docs_chain_kwargs={"prompt": prompt}
  )
  
  chat_history = []
  print("=======================")
  print("Type 'exit' to stop,")
  while True:
      query = input("please enter your question: ")
      if query.lower() == 'exit':
          break
      result = qa.invoke({"question": query, "chat_history": chat_history})
      print("\n")
apis: lancedb.connect
extract_api: [((373, 401), 'lancedb.connect', 'lancedb.connect', (['"""./lancedb"""'], {}), "('./lancedb')\n", (388, 401), False, 'import lancedb\n'), ((713, 805), 'langchain.prompts.PromptTemplate', 'PromptTemplate', ([], {'template': 'template', 'input_variables': "['context, question', 'chat_history']"}), "(template=template, input_variables=['context, question',\n    'chat_history'])\n", (727, 805), False, 'from langchain.prompts import PromptTemplate\n'), ((869, 928), 'langchain_community.llms.GPT4All', 'GPT4All', ([], {'model': 'localPath', 'callbacks': 'callbacks', 'verbose': '(True)'}), '(model=localPath, callbacks=callbacks, verbose=True)\n', (876, 928), False, 'from langchain_community.llms import GPT4All\n'), ((472, 491), 'langchain_community.embeddings.GPT4AllEmbeddings', 'GPT4AllEmbeddings', ([], {}), '()\n', (489, 491), False, 'from langchain_community.embeddings import GPT4AllEmbeddings\n'), ((828, 860), 'langchain.callbacks.streaming_stdout.StreamingStdOutCallbackHandler', 'StreamingStdOutCallbackHandler', ([], {}), '()\n', (858, 860), False, 'from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler\n')]