Spaces:
Sleeping
Sleeping
import os | |
from utils.prepare_vectordb import PrepareVectorDB | |
from utils.load_config import LoadConfig | |
CONFIG = LoadConfig() | |
def upload_data_manually() -> None: | |
""" | |
Uploads data manually to the VectorDB. | |
This function initializes a PrepareVectorDB instance with configuration parameters | |
and chunk_overlap. It then checks if the VectorDB already exists in the specified | |
persist_directory. If not, it calls the prepare_and_save_vectordb method to | |
create and save the VectorDB. If the VectorDB already exists, a message is printed | |
indicating its presence. | |
Returns: | |
None | |
""" | |
prepare_vectordb_instance = PrepareVectorDB( | |
data_directory=CONFIG.data_directory, | |
persist_directory=CONFIG.persist_directory, | |
chunk_size=CONFIG.chunk_size, | |
chunk_overlap=CONFIG.chunk_overlap, | |
) | |
if not len(os.listdir(CONFIG.persist_directory)) != 0: | |
prepare_vectordb_instance.prepare_and_save_vectordb() | |
else: | |
print(f"VectorDB already exists in {CONFIG.persist_directory}") | |
return None | |
if __name__ == "__main__": | |
upload_data_manually() | |