fix: wrong ConversationBufferMemory parameters
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import spacy
|
|
6 |
from langchain.chains import RetrievalQA, ConversationalRetrievalChain
|
7 |
from langchain.memory import ConversationBufferMemory
|
8 |
from langchain.text_splitter import SpacyTextSplitter
|
|
|
9 |
from langchain_community.document_loaders import PyPDFLoader
|
10 |
from langchain_community.embeddings import HuggingFaceInferenceAPIEmbeddings
|
11 |
from langchain_community.vectorstores import Chroma
|
@@ -93,7 +94,9 @@ class RAGDemo(object):
|
|
93 |
|
94 |
def _chat_qa(self, message, chat_history):
|
95 |
memory = ConversationBufferMemory(
|
96 |
-
chat_memory=
|
|
|
|
|
97 |
memory_key="chat_history",
|
98 |
return_messages=True,
|
99 |
)
|
|
|
6 |
from langchain.chains import RetrievalQA, ConversationalRetrievalChain
|
7 |
from langchain.memory import ConversationBufferMemory
|
8 |
from langchain.text_splitter import SpacyTextSplitter
|
9 |
+
from langchain_community.chat_message_histories import ChatMessageHistory
|
10 |
from langchain_community.document_loaders import PyPDFLoader
|
11 |
from langchain_community.embeddings import HuggingFaceInferenceAPIEmbeddings
|
12 |
from langchain_community.vectorstores import Chroma
|
|
|
94 |
|
95 |
def _chat_qa(self, message, chat_history):
|
96 |
memory = ConversationBufferMemory(
|
97 |
+
chat_memory=ChatMessageHistory(
|
98 |
+
messages=convert_chat_history_to_messages(chat_history)
|
99 |
+
),
|
100 |
memory_key="chat_history",
|
101 |
return_messages=True,
|
102 |
)
|