Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
from langchain.chains import RetrievalQA
|
2 |
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
|
3 |
from langchain.callbacks.manager import CallbackManager
|
4 |
-
from langchain_community.llms import Ollama
|
5 |
-
from langchain_community.embeddings.ollama import OllamaEmbeddings
|
6 |
from langchain_community.vectorstores import Chroma
|
7 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
8 |
from langchain_community.document_loaders import PyPDFLoader
|
@@ -88,10 +88,8 @@ if uploaded_file is not None:
|
|
88 |
all_splits = text_splitter.split_documents(data)
|
89 |
|
90 |
# Create and persist the vector store
|
91 |
-
st.session_state.vectorstore = Chroma.from_documents(
|
92 |
-
|
93 |
-
embedding=OllamaEmbeddings(model="mistral")
|
94 |
-
)
|
95 |
st.session_state.vectorstore.persist()
|
96 |
|
97 |
st.session_state.retriever = st.session_state.vectorstore.as_retriever()
|
|
|
1 |
from langchain.chains import RetrievalQA
|
2 |
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
|
3 |
from langchain.callbacks.manager import CallbackManager
|
4 |
+
#from langchain_community.llms import Ollama
|
5 |
+
#from langchain_community.embeddings.ollama import OllamaEmbeddings
|
6 |
from langchain_community.vectorstores import Chroma
|
7 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
8 |
from langchain_community.document_loaders import PyPDFLoader
|
|
|
88 |
all_splits = text_splitter.split_documents(data)
|
89 |
|
90 |
# Create and persist the vector store
|
91 |
+
#st.session_state.vectorstore = Chroma.from_documents(documents=all_splits,embedding=OllamaEmbeddings(model="mistral"))
|
92 |
+
st.session_state.vectorstore = Chroma.from_documents(documents=all_splits,embedding=embeddings)
|
|
|
|
|
93 |
st.session_state.vectorstore.persist()
|
94 |
|
95 |
st.session_state.retriever = st.session_state.vectorstore.as_retriever()
|