""" Configuration management for LLM Agent Service Follows SOLID principles: Single Responsibility """ from pydantic_settings import BaseSettings, SettingsConfigDict from typing import Optional class Settings(BaseSettings): """Application settings using Pydantic BaseSettings""" model_config = SettingsConfigDict( env_file=".env", env_file_encoding="utf-8", case_sensitive=False, extra="ignore" ) # Service configuration service_name: str = "llm-agent" environment: str = "development" debug: bool = False # API Configuration api_host: str = "0.0.0.0" api_port: int = 8003 # LLM Provider Configuration llm_provider: str = "ollama" # ollama, claude, openai # Ollama Configuration (Local GPU) ollama_base_url: str = "http://localhost:11434" llm_model: str = "llama3:8b" # llama3:8b, mistral:7b, etc. # Anthropic/Claude Configuration (Cloud fallback) anthropic_api_key: Optional[str] = None claude_model: str = "claude-3-5-sonnet-20241022" # LLM Generation Settings max_tokens: int = 2048 temperature: float = 0.7 # Service URLs backend_url: str = "http://localhost:8000" data_service_url: str = "http://localhost:8001" ml_engine_url: str = "http://localhost:8002" # Database Configuration database_url: str database_pool_size: int = 10 database_max_overflow: int = 20 # Redis Configuration redis_url: str = "redis://localhost:6379/0" redis_cache_ttl: int = 3600 # Vector DB Configuration (ChromaDB) chroma_persist_directory: str = "./chroma_db" chroma_collection_name: str = "trading_knowledge" # Logging Configuration log_level: str = "INFO" log_format: str = "json" # RAG Configuration enable_rag: bool = True embedding_model: str = "text-embedding-3-small" max_context_documents: int = 5 # MT4/MetaAPI Configuration metaapi_token: Optional[str] = None metaapi_account_id: Optional[str] = None # Auto-Trading Configuration auto_trade_check_interval: int = 5 # minutes auto_trade_min_confidence: float = 0.7 auto_trade_max_risk_percent: float = 1.0 auto_trade_paper_mode: bool = True # Global settings instance settings = Settings()