|
|
@ -173,6 +173,7 @@ class ConversationalRetrievalChain(BaseConversationalRetrievalChain):
|
|
|
|
retriever: BaseRetriever,
|
|
|
|
retriever: BaseRetriever,
|
|
|
|
condense_question_prompt: BasePromptTemplate = CONDENSE_QUESTION_PROMPT,
|
|
|
|
condense_question_prompt: BasePromptTemplate = CONDENSE_QUESTION_PROMPT,
|
|
|
|
chain_type: str = "stuff",
|
|
|
|
chain_type: str = "stuff",
|
|
|
|
|
|
|
|
verbose: bool = False,
|
|
|
|
combine_docs_chain_kwargs: Optional[Dict] = None,
|
|
|
|
combine_docs_chain_kwargs: Optional[Dict] = None,
|
|
|
|
**kwargs: Any,
|
|
|
|
**kwargs: Any,
|
|
|
|
) -> BaseConversationalRetrievalChain:
|
|
|
|
) -> BaseConversationalRetrievalChain:
|
|
|
@ -181,9 +182,12 @@ class ConversationalRetrievalChain(BaseConversationalRetrievalChain):
|
|
|
|
doc_chain = load_qa_chain(
|
|
|
|
doc_chain = load_qa_chain(
|
|
|
|
llm,
|
|
|
|
llm,
|
|
|
|
chain_type=chain_type,
|
|
|
|
chain_type=chain_type,
|
|
|
|
|
|
|
|
verbose=verbose,
|
|
|
|
**combine_docs_chain_kwargs,
|
|
|
|
**combine_docs_chain_kwargs,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
condense_question_chain = LLMChain(llm=llm, prompt=condense_question_prompt)
|
|
|
|
condense_question_chain = LLMChain(
|
|
|
|
|
|
|
|
llm=llm, prompt=condense_question_prompt, verbose=verbose
|
|
|
|
|
|
|
|
)
|
|
|
|
return cls(
|
|
|
|
return cls(
|
|
|
|
retriever=retriever,
|
|
|
|
retriever=retriever,
|
|
|
|
combine_docs_chain=doc_chain,
|
|
|
|
combine_docs_chain=doc_chain,
|
|
|
|