| 58 | |
| 59 | |
| 60 | class CRChain(BaseQaChain): |
| 61 | def __init__( |
| 62 | self, |
| 63 | chain_type: str, |
| 64 | retriever, |
| 65 | llm, |
| 66 | ) -> None: |
| 67 | super().__init__(chain_type, retriever, llm) |
| 68 | |
| 69 | @property |
| 70 | def create_qa_chain(self): |
| 71 | # TODO: cannot use conversation qa chain |
| 72 | from langchain.chains import ConversationalRetrievalChain |
| 73 | from langchain.memory import ConversationBufferMemory |
| 74 | |
| 75 | memory = ConversationBufferMemory( |
| 76 | memory_key='chat_history', |
| 77 | return_messages=True |
| 78 | ) |
| 79 | qa_chain = ConversationalRetrievalChain.from_llm( |
| 80 | llm=self.llm, |
| 81 | chain_type=self.chain_type, |
| 82 | retriever=self.retriever, |
| 83 | memory=memory |
| 84 | ) |
| 85 | return qa_chain |
| 86 | |
| 87 | |
| 88 | class DocGPT: |
nothing calls this directly
no outgoing calls
no test coverage detected