from __future__ import annotations from functools import lru_cache from app.core.config import Settings, get_settings @lru_cache() def get_settings_cached() -> Settings: return get_settings() # Placeholder for future DI wiring. Tests patch classes directly, so we keep # a minimal API here to avoid import-time side effects. def get_llm_client(): settings = get_settings_cached() from app.services.llm_client import LLMClient return LLMClient(settings) def get_llm_client_dp(): settings = get_settings_cached() from app.services.llm_client_dp import LLMClientDP return LLMClientDP(settings) def get_rag_service(): # Import lazily to avoid circular imports in tests from app.services.rag import RAGService llm = get_llm_client() return RAGService(llm_client=llm) def get_prompt_service(): from app.services.prompt_service import PromptService settings = get_settings_cached() return PromptService(db_path=settings.prompts_db_path) def get_history_service(): from app.services.history_service import HistoryService settings = get_settings_cached() return HistoryService(db_path=settings.history_db_path)