pbrenotvinciguerra commited on
Commit
6ba4f57
·
1 Parent(s): 23b172b
Files changed (2) hide show
  1. main.py +2 -3
  2. requirements.txt +1 -0
main.py CHANGED
@@ -20,11 +20,10 @@ service_context = ServiceContext.from_defaults(llm=llm, embed_model=embed_model)
20
  if "index" in os.listdir():
21
  storage_context = StorageContext.from_defaults(persist_dir=Path("./index"))
22
  else:
23
- UnstructuredReader = download_loader('UnstructuredReader')
24
- dir_reader = SimpleDirectoryReader(Path('./docs/'), file_extractor={".pdf": UnstructuredReader()})
25
  documents = dir_reader.load_data()
26
  index = VectorStoreIndex.from_documents(documents, service_context=service_context)
27
- index.storage_context.persist(Path('index'))
28
  storage_context = StorageContext.from_defaults(persist_dir=Path("./index"))
29
 
30
  # Load the vector stores that were created earlier.
 
20
  if "index" in os.listdir():
21
  storage_context = StorageContext.from_defaults(persist_dir=Path("./index"))
22
  else:
23
+ dir_reader = SimpleDirectoryReader(Path('./docs'))
 
24
  documents = dir_reader.load_data()
25
  index = VectorStoreIndex.from_documents(documents, service_context=service_context)
26
+ index.storage_context.persist(Path('./index'))
27
  storage_context = StorageContext.from_defaults(persist_dir=Path("./index"))
28
 
29
  # Load the vector stores that were created earlier.
requirements.txt CHANGED
@@ -7,3 +7,4 @@ optimum[exporters]
7
  uvicorn
8
  llama-index
9
  voyageai
 
 
7
  uvicorn
8
  llama-index
9
  voyageai
10
+ langchain