"""Resolves NINJAPEAR_API_KEY to a concrete enrichment provider instance. Never imported directly by enrichment_service - always go through `get_enrichment_provider()` so a future second vendor stays a one-line config change, matching app/search/factory.py's shape.""" from __future__ import annotations from app.core.config import Settings, get_settings from app.enrichment.base import EnrichmentProvider from app.enrichment.mock import MockEnrichmentProvider def get_enrichment_provider(settings: Settings | None = None) -> EnrichmentProvider: settings = settings or get_settings() if settings.ninjapear_api_key: from app.enrichment.ninjapear import NinjaPearProvider return NinjaPearProvider(settings) return MockEnrichmentProvider()