Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -29,6 +29,17 @@ def method_get_text_chunks(text):
|
|
29 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=100)
|
30 |
doc_splits = text_splitter.split_documents(text)
|
31 |
return doc_splits
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
def get_context_retriever_chain(vector_store,question):
|
34 |
# Initialize the retriever
|
|
|
29 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=100)
|
30 |
doc_splits = text_splitter.split_documents(text)
|
31 |
return doc_splits
|
32 |
+
|
33 |
+
def method_get_vectorstore(document_chunks):
|
34 |
+
#convert text chunks into embeddings and store in vector database
|
35 |
+
|
36 |
+
# create the open-source embedding function
|
37 |
+
#embeddings = NomicEmbeddings(model="nomic-embed-text-v1.5")
|
38 |
+
embeddings = HuggingFaceEmbeddings()
|
39 |
+
|
40 |
+
# create a vectorstore from the chunks
|
41 |
+
vector_store = Chroma.from_documents(document_chunks, embeddings)
|
42 |
+
return vector_store
|
43 |
|
44 |
def get_context_retriever_chain(vector_store,question):
|
45 |
# Initialize the retriever
|