FastAPI + Celery + Next.js + Postgres/Redis app with company monitoring, source collection, LLM-based change analysis, enrichment, and account security (Turnstile, escalating lockout, email verification).
22 lines
772 B
Python
22 lines
772 B
Python
"""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()
|