Update app.py
Browse files
app.py
CHANGED
|
@@ -32,9 +32,7 @@ vectorstore = Chroma(embedding_function=embedding_model, persist_directory="chro
|
|
| 32 |
|
| 33 |
# Create a conversational chain with retrieval capabilities
|
| 34 |
memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)
|
| 35 |
-
qa_chain = ConversationalRetrievalChain.from_llm(llm,
|
| 36 |
-
retriever=vectorstore.as_retriever(), memory=memory)
|
| 37 |
-
|
| 38 |
|
| 39 |
def upload_docs(docs):
|
| 40 |
# Load and process the uploaded PDF documents
|
|
@@ -45,8 +43,7 @@ def upload_docs(docs):
|
|
| 45 |
|
| 46 |
# Split documents into manageable chunks
|
| 47 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
|
| 48 |
-
texts = text_splitter.split_documents(loaded_docs)
|
| 49 |
-
|
| 50 |
|
| 51 |
# Add documents to the vector store and persist them
|
| 52 |
vectorstore.add_documents(texts)
|
|
|
|
| 32 |
|
| 33 |
# Create a conversational chain with retrieval capabilities
|
| 34 |
memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)
|
| 35 |
+
qa_chain = ConversationalRetrievalChain.from_llm(llm, retriever=vectorstore.as_retriever(), memory=memory)
|
|
|
|
|
|
|
| 36 |
|
| 37 |
def upload_docs(docs):
|
| 38 |
# Load and process the uploaded PDF documents
|
|
|
|
| 43 |
|
| 44 |
# Split documents into manageable chunks
|
| 45 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
|
| 46 |
+
texts = text_splitter.split_documents(loaded_docs)
|
|
|
|
| 47 |
|
| 48 |
# Add documents to the vector store and persist them
|
| 49 |
vectorstore.add_documents(texts)
|