Spaces:
Sleeping
Sleeping
Update document_chat.py
Browse files- document_chat.py +2 -6
document_chat.py
CHANGED
@@ -42,15 +42,11 @@ def process_query_with_memory(query, chat_memory):
|
|
42 |
# Initialize LLM
|
43 |
llm = HuggingFaceHub(repo_id=LLM_MODEL, model_kwargs={"max_new_tokens": 500})
|
44 |
|
45 |
-
# Load QA Chain
|
46 |
-
qa_chain = load_qa_chain(llm, chain_type="stuff")
|
47 |
-
|
48 |
# Create Conversational Retrieval Chain correctly
|
49 |
conversation_chain = ConversationalRetrievalChain.from_llm(
|
50 |
llm=llm,
|
51 |
retriever=retriever,
|
52 |
-
memory=chat_memory
|
53 |
-
combine_docs_chain=qa_chain
|
54 |
)
|
55 |
|
56 |
-
return conversation_chain.run({"question": query, "chat_history": chat_memory.memory if chat_memory else []})
|
|
|
42 |
# Initialize LLM
|
43 |
llm = HuggingFaceHub(repo_id=LLM_MODEL, model_kwargs={"max_new_tokens": 500})
|
44 |
|
|
|
|
|
|
|
45 |
# Create Conversational Retrieval Chain correctly
|
46 |
conversation_chain = ConversationalRetrievalChain.from_llm(
|
47 |
llm=llm,
|
48 |
retriever=retriever,
|
49 |
+
memory=chat_memory
|
|
|
50 |
)
|
51 |
|
52 |
+
return conversation_chain.run({"question": query, "chat_history": chat_memory.memory if chat_memory else []})
|