RAG_Chatbot / config.py
nikhildsst's picture
Update config.py
939cea3 verified
Raw
History Blame Contribute Delete
1.19 kB
# config.py
import os
from dotenv import load_dotenv
# Load environment variables from .env file
load_dotenv()
class Config:
# MySQL Configuration
MYSQL_HOST = os.getenv('MYSQL_HOST', '127.0.0.1')
MYSQL_USER = os.getenv('MYSQL_USER', 'root')
MYSQL_PASSWORD = os.getenv('MYSQL_PASSWORD', 'nikhil') # Default password, better to set in .env
MYSQL_DB = os.getenv('MYSQL_DB', 'ragchatbot')
# Application Configuration
CHUNK_SIZE = int(os.getenv('CHUNK_SIZE', '300'))
TOP_K_RESULTS = int(os.getenv('TOP_K_RESULTS', '5'))
# Model Configuration
EMBEDDING_MODEL = os.getenv('EMBEDDING_MODEL', 'sentence-transformers/all-MiniLM-L6-v2')
# Upload Configuration
UPLOAD_FOLDER = os.getenv('UPLOAD_FOLDER', 'uploads')
MAX_CONTENT_LENGTH = int(os.getenv('MAX_CONTENT_LENGTH', '16777216')) # 16MB
ALLOWED_EXTENSIONS = {'txt', 'pdf', 'docx'}
# Server Configuration
SERVER_HOST = os.getenv('SERVER_HOST', '0.0.0.0')
SERVER_PORT = int(os.getenv('SERVER_PORT', '7860'))
# Database Configuration
DB_POOL_SIZE = int(os.getenv('DB_POOL_SIZE', '5'))
DB_POOL_TIMEOUT = int(os.getenv('DB_POOL_TIMEOUT', '30'))