Add initial implementation of Deal Intel project
This commit introduces the foundational structure for the Deal Intel project, including: - Environment configuration file (.env.example) for managing secrets and API keys. - Scripts for building a ChromaDB vector store (build_vector_store.py) and training machine learning models (train_rf.py, train_ensemble.py). - Health check functionality (health_check.py) to ensure system readiness. - A launcher script (launcher.py) for executing various commands, including UI launch and health checks. - Logging utilities (logging_utils.py) for consistent logging across the application. - A README file providing an overview and setup instructions for the project. These additions establish a comprehensive framework for an agentic deal-hunting AI system, integrating various components for data processing, model training, and user interaction.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Shared logging utilities for Deal Intel.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
from typing import Optional
|
||||
|
||||
DEFAULT_FORMAT = "[%(asctime)s] [%(name)s] [%(levelname)s] %(message)s"
|
||||
DEFAULT_DATEFMT = "%Y-%m-%d %H:%M:%S %z"
|
||||
|
||||
def init_logger(name: str, level: Optional[str] = None) -> logging.Logger:
|
||||
"""
|
||||
Initialize and return a logger with consistent formatting.
|
||||
Level can be overridden via env DEAL_INTEL_LOG_LEVEL.
|
||||
"""
|
||||
logger = logging.getLogger(name)
|
||||
if logger.handlers:
|
||||
return logger # avoid duplicate handlers
|
||||
|
||||
env_level = os.getenv("DEAL_INTEL_LOG_LEVEL", "INFO")
|
||||
level = level or env_level
|
||||
level_map = {
|
||||
"CRITICAL": logging.CRITICAL,
|
||||
"ERROR": logging.ERROR,
|
||||
"WARNING": logging.WARNING,
|
||||
"INFO": logging.INFO,
|
||||
"DEBUG": logging.DEBUG,
|
||||
}
|
||||
logger.setLevel(level_map.get(level.upper(), logging.INFO))
|
||||
|
||||
handler = logging.StreamHandler()
|
||||
handler.setFormatter(logging.Formatter(DEFAULT_FORMAT, datefmt=DEFAULT_DATEFMT))
|
||||
logger.addHandler(handler)
|
||||
return logger
|
||||
Reference in New Issue
Block a user