File size: 1,078 Bytes
10b392a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# scripts/run_query_api.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__), '..')))

import uvicorn
from src.query_service.api import app # Import the FastAPI app instance
import logging

logger = logging.getLogger(__name__)

if __name__ == "__main__":
    # --- Financial Ministry Adaptation ---
    # Configure host and port appropriately for your deployment environment.
    # Do not use reload=True in production.
    # Consider using environment variables for host/port in production.
    # Implement process management (e.g., systemd, Docker entrypoint) for production.
    # ------------------------------------
    logger.info("Starting the RAG query API service.")
    try:
        uvicorn.run(app, host="0.0.0.0", port=8000) # Bind to 0.0.0.0 to be accessible externally
    except Exception as e:
        logger.critical(f"RAG query API service failed: {e}")
        sys.exit(1) # Exit with an error code