Update app.py
Browse files
app.py
CHANGED
@@ -128,8 +128,8 @@ def initialize_llmchain(temperature, max_tokens, top_k, vector_db, progress=gr.P
|
|
128 |
"load_in_8bit": True})
|
129 |
|
130 |
progress(0.75, desc="Defining buffer memory...")
|
131 |
-
|
132 |
-
memory = ConversationBufferWindowMemory(memory_key = '
|
133 |
retriever=vector_db.as_retriever()
|
134 |
progress(0.8, desc="Defining retrieval chain...")
|
135 |
qa_chain = ConversationalRetrievalChain.from_llm(llm,retriever=retriever,chain_type="stuff",
|
@@ -184,8 +184,8 @@ def format_chat_history(message, chat_history):
|
|
184 |
return formatted_chat_history
|
185 |
|
186 |
|
187 |
-
def conversation(qa_chain, message,
|
188 |
-
formatted_chat_history = format_chat_history(message,
|
189 |
#print("formatted_chat_history",formatted_chat_history)
|
190 |
|
191 |
# Generate response using QA chain
|
|
|
128 |
"load_in_8bit": True})
|
129 |
|
130 |
progress(0.75, desc="Defining buffer memory...")
|
131 |
+
memory = ConversationBufferMemory(memory_key="chat_history",output_key='answer',return_messages=True)
|
132 |
+
#memory = ConversationBufferWindowMemory(memory_key = 'history', k=3)
|
133 |
retriever=vector_db.as_retriever()
|
134 |
progress(0.8, desc="Defining retrieval chain...")
|
135 |
qa_chain = ConversationalRetrievalChain.from_llm(llm,retriever=retriever,chain_type="stuff",
|
|
|
184 |
return formatted_chat_history
|
185 |
|
186 |
|
187 |
+
def conversation(qa_chain, message, history):
|
188 |
+
formatted_chat_history = format_chat_history(message, history)
|
189 |
#print("formatted_chat_history",formatted_chat_history)
|
190 |
|
191 |
# Generate response using QA chain
|