paultltc commited on
Commit
9d843a3
·
1 Parent(s): 017336c
Files changed (1) hide show
  1. tool.py +4 -1
tool.py CHANGED
@@ -215,7 +215,7 @@ class VisualRAGTool(Tool):
215
 
216
  return contexts
217
 
218
- def _process_file(self, file: str, contextualize: bool = True, api_key: str = None, window: int = 10) -> List[Page]:
219
  """Converts a file to images and extracts metadata."""
220
  title = file.split("/")[-1]
221
  images = convert_from_path(file, thread_count=4)
@@ -257,6 +257,9 @@ class VisualRAGTool(Tool):
257
  return embds
258
 
259
  def index(self, files: List[str], contextualize: bool = True, api_key: str = None, overwrite_db: bool = False) -> int:
 
 
 
260
  print("Converting files...")
261
  # Convert files to images and extract metadata
262
  pgs = self.preprocess(files, contextualize=contextualize, api_key=api_key or self.api_key)
 
215
 
216
  return contexts
217
 
218
+ def _preprocess_file(self, file: str, contextualize: bool = True, api_key: str = None, window: int = 10) -> List[Page]:
219
  """Converts a file to images and extracts metadata."""
220
  title = file.split("/")[-1]
221
  images = convert_from_path(file, thread_count=4)
 
257
  return embds
258
 
259
  def index(self, files: List[str], contextualize: bool = True, api_key: str = None, overwrite_db: bool = False) -> int:
260
+ if not self.is_initialized:
261
+ self.setup()
262
+
263
  print("Converting files...")
264
  # Convert files to images and extract metadata
265
  pgs = self.preprocess(files, contextualize=contextualize, api_key=api_key or self.api_key)