class_docstr: Wrapper class for Chinese retrieval conversation system
class_docstr_tok: ["Wrapper","class","for","Chinese","retrieval","conversation","system"]
docstr: Setup retrieval qa chain for Chinese retrieval based QA
docstr_tok: ["Setup","retrieval","qa","chain","for","Chinese","retrieval","based","QA"]
code: def __init__(
      self, retriever: CustomRetriever, model_path: str, model_name: str
  ) -> None:
      """
      Setup retrieval qa chain for Chinese retrieval based QA
      """
      logger.info(
          f"model_name: {model_name}; model_path: {model_path}",
          verbose=True,
      )
      colossal_api = ColossalAPI.get_api(model_name, model_path)
      self.llm = ColossalLLM(n=1, api=colossal_api)
  
      # Define the retriever
      self.retriever = retriever
  
      # Define the chain to preprocess the input
      # Disambiguate the input. e.g. "What is the capital of that country?" -> "What is the capital of France?"
      # Prompt is summarization prompt
      self.llm_chain_disambiguate = LLMChain(
          llm=self.llm,
          prompt=PROMPT_DISAMBIGUATE_EN,
          llm_kwargs={
              "max_new_tokens": 30,
              "temperature": 0.6,
              "do_sample": True,
          },
      )
  
      self.retriever.set_rephrase_handler(self.disambiguity)
      # Define memory with summarization ability
      self.memory = ConversationBufferWithSummary(
          llm=self.llm,
          llm_kwargs={
              "max_new_tokens": 50,
              "temperature": 0.6,
              "do_sample": True,
          },
      )
      self.memory.initiate_document_retrieval_chain(
          self.llm,
          PROMPT_RETRIEVAL_QA_EN,
          self.retriever,
          chain_type_kwargs={
              "chat_history": "",
          },
      )
      self.retrieval_chain = RetrievalQA.from_chain_type(
          llm=self.llm,
          verbose=False,
          chain_type="stuff",
          retriever=self.retriever,
          chain_type_kwargs={
              "prompt": PROMPT_RETRIEVAL_QA_EN,
              "memory": self.memory,
          },
          llm_kwargs={
              "max_new_tokens": 50,
              "temperature": 0.75,
              "do_sample": True,
          },
      )
  
file_path: ColossalAI/applications/ColossalQA/colossalqa/retrieval_conversation_en.py
imports: from typing import Tuple
  from colossalqa.chain.retrieval_qa.base import RetrievalQA
  from colossalqa.local.llm import ColossalAPI, ColossalLLM
  from colossalqa.memory import ConversationBufferWithSummary
  from colossalqa.mylogging import get_logger
  from colossalqa.prompt.prompt import PROMPT_DISAMBIGUATE_EN, PROMPT_RETRIEVAL_QA_EN
  from colossalqa.retriever import CustomRetriever
  from langchain import LLMChain
label_desc: Use image node_id 1 to create a new EnglishRetrievalConversation object  with example: obj = EnglishRetrievalConversation(retriever, model_path, model_name)