MedicalChatbot_v2.0 / src /upload_data_manually.py
sxandie's picture
Upload 22 files
e899e0f verified
raw
history blame
1.39 kB
import os
#comment this if OPENAI EMbeddings are requireed
#from prepare_bgesmall_vectordb import PrepareVectorDB
from prepare_openAIEmbeddings_vectordb import PrepareVectorDB
from 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
such as data_directory, persist_directory, embedding_model_engine, chunk_size,
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,
embedding_model_engine=CONFIG.embedding_model_engine,
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()