api / scripts /run_ingestion.py
Chandima Prabhath
Refactor code structure for improved readability and maintainability
10b392a
# scripts/run_ingestion.py
import sys
import os
# Add the project root to the sys.path
# Assuming this script is in the project root or a 'scripts' subdir at root
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from src.ingestion_orchestrator.orchestrator import IngestionOrchestrator
from config.settings import DOCS_FOLDER # Use the configured docs folder
import logging
logger = logging.getLogger(__name__)
if __name__ == "__main__":
# --- Financial Ministry Adaptation ---
# Add argument parsing if needed (e.g., specify a different docs folder)
# Implement more sophisticated scheduling if needed (e.g., run daily, weekly)
# ------------------------------------
logger.info("Starting the RAG ingestion process.")
try:
orchestrator = IngestionOrchestrator()
orchestrator.run_ingestion_pipeline(docs_folder=DOCS_FOLDER) # Use configured folder
logger.info("RAG ingestion process finished.")
except Exception as e:
logger.critical(f"RAG ingestion process failed: {e}")
sys.exit(1) # Exit with an error code