Irfan Ahmad
Irfan Ahmad
Here is how I achieved memory with a custom prompt template for ConversationalRetrievalChain. ``` ### build memory memory = ConversationBufferMemory( memory_key="chat_history", max_len=50, return_messages=True, ) prompt_template = ''' You are a...
Memory can be passed to RetrievalQA chain like any other chain. ```chat_model = ChatOpenAI() memory = ConversationBufferMemory( memory_key="chat_history", max_len=50, return_messages=True, ) chain_type_kwargs = {'prompt': PROMPT} chain = RetrievalQA.from_chain_type( llm=chat_model, chain_type="stuff",...
I implemented the chat history with RetrievalQAWithSourcechain, following the below approach. ``` prompt_template = ''' You are a Bioinformatics expert with immense knowledge and experience in the field. Answer my...
@damithsenanayake, I have not used the updated langchain API yet, but the get_chat_history was a built-in method. And @eliujl is right about memory.