MCPcopy Create free account
hub / github.com/CL-lau/SQL-GPT / CRChain

Class CRChain

gpt/docGPT.py:60–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58
59
60class 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
88class DocGPT:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected