ShadowTEM commited on
Commit
89fe4c9
·
verified ·
1 Parent(s): 47a1c20

Upgrading chunks from 700 to 1200

Browse files
Files changed (1) hide show
  1. app/vectorstore.py +5 -5
app/vectorstore.py CHANGED
@@ -29,7 +29,7 @@ class vectorstore:
29
  self.index_path = path
30
  self.vectorstore = self.load_vectorstore(self.index_path)
31
 
32
- def chunk_text(self,text, chunk_size=700):
33
  """
34
  Split text into chunks of approximately 'chunk_size' words.
35
 
@@ -47,7 +47,7 @@ class vectorstore:
47
  chunks.append(chunk)
48
  return chunks
49
 
50
- def create_vectorstore_from_pdf(self,pdf_path, chunk_size=700, embedder_model="all-MiniLM-L6-v2"):
51
  """
52
  Extract text from a PDF using pypdf, chunk the text, compute embeddings,
53
  and create a FAISS index.
@@ -78,7 +78,7 @@ class vectorstore:
78
  index_path = self.save_vectorstore_with_timestamp_and_without(vectorstore, embedder_model)
79
  return index_path
80
 
81
- def create_vectorstore_from_website(self, url, chunk_size=700, embedder_model="all-MiniLM-L6-v2"):
82
  """
83
  Fetch text from a website, chunk the text, compute embeddings,
84
  and create a FAISS index.
@@ -109,7 +109,7 @@ class vectorstore:
109
  index_path = self.save_vectorstore_with_timestamp_and_without(vectorstore, embedder_model)
110
  return index_path
111
 
112
- def add_to_vectorstore_web(self, url, index_file_path, chunk_size=700):
113
  """
114
  Fetch text from a website, chunk the text, compute embeddings using the existing embedder,
115
  and add them to the existing FAISS vectorstore.
@@ -141,7 +141,7 @@ class vectorstore:
141
  return updated_index_path
142
 
143
 
144
- def add_to_vectorstore_from_pdf(self, pdf_path, chunk_size=700):
145
  """
146
  Extract text from a PDF using PyPDF2, chunk the text, compute embeddings using the existing embedder,
147
  and add them to the existing FAISS vectorstore.
 
29
  self.index_path = path
30
  self.vectorstore = self.load_vectorstore(self.index_path)
31
 
32
+ def chunk_text(self,text, chunk_size=1200):
33
  """
34
  Split text into chunks of approximately 'chunk_size' words.
35
 
 
47
  chunks.append(chunk)
48
  return chunks
49
 
50
+ def create_vectorstore_from_pdf(self,pdf_path, chunk_size=1200, embedder_model="all-MiniLM-L6-v2"):
51
  """
52
  Extract text from a PDF using pypdf, chunk the text, compute embeddings,
53
  and create a FAISS index.
 
78
  index_path = self.save_vectorstore_with_timestamp_and_without(vectorstore, embedder_model)
79
  return index_path
80
 
81
+ def create_vectorstore_from_website(self, url, chunk_size=1200, embedder_model="all-MiniLM-L6-v2"):
82
  """
83
  Fetch text from a website, chunk the text, compute embeddings,
84
  and create a FAISS index.
 
109
  index_path = self.save_vectorstore_with_timestamp_and_without(vectorstore, embedder_model)
110
  return index_path
111
 
112
+ def add_to_vectorstore_web(self, url, index_file_path, chunk_size=1200):
113
  """
114
  Fetch text from a website, chunk the text, compute embeddings using the existing embedder,
115
  and add them to the existing FAISS vectorstore.
 
141
  return updated_index_path
142
 
143
 
144
+ def add_to_vectorstore_from_pdf(self, pdf_path, chunk_size=1200):
145
  """
146
  Extract text from a PDF using PyPDF2, chunk the text, compute embeddings using the existing embedder,
147
  and add them to the existing FAISS vectorstore.