Bank-Scrubber-v2 / src /config /config.py
Aryan Jain
update temp pdf path
00a41cc
from typing import Optional
# from pydantic import BaseSettings
from pydantic_settings import BaseSettings
import os
from dotenv import load_dotenv
# Load environment variables from .env file
load_dotenv()
class Settings(BaseSettings):
"""Configuration settings for the application."""
# API Keys - will be loaded from environment variables
groq_api_key: str = os.getenv("GROQ_API_KEY")
groq_base_url: str = os.getenv("GROQ_BASE_URL", "https://api.groq.com/openai/v1")
huggingface_api_key: str = os.getenv("HUGGINGFACE_API_KEY")
huggingface_provider: str = os.getenv("HUGGINGFACE_PROVIDER", "novita")
# Model configurations
llm_model: str = os.getenv("LLM_MODEL", "llama-3.1-8b-instant")
# OCR and processing settings
y_threshold: float = float(os.getenv("Y_THRESHOLD", "3.0"))
gap_threshold: int = int(os.getenv("GAP_THRESHOLD", "10"))
gap_threshold_ratio: float = float(os.getenv("GAP_THRESHOLD_RATIO", "0.1"))
# File processing settings
temp_file_name: str = os.getenv("TEMP_FILE_NAME", "/app/temp/temp.pdf")
dpi: int = int(os.getenv("DPI", "300"))
# spaCy model settings
spacy_model_name: str = os.getenv("SPACY_MODEL_NAME", "en_core_web_sm")
# Device settings
force_cpu: bool = os.getenv("FORCE_CPU", "false").lower() == "true"
class Config:
env_file = ".env"
env_file_encoding = "utf-8"
case_sensitive = False
# Global settings instance
settings = Settings()