Files
CIAgent/apps/api/app/analysis/llm/factory.py
T
saksham 1a4c80958f Initial commit: CI Agent competitive-intelligence monitoring app
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).
2026-08-05 10:48:20 -04:00

32 lines
1.0 KiB
Python

"""Resolves `LLM_PROVIDER` to a concrete provider instance. Never imported
directly by prompt task modules or services - always go through
`get_llm_provider()` so swapping providers stays a one-line config change.
"""
from __future__ import annotations
from app.analysis.llm.base import LLMProvider
from app.analysis.llm.mock import MockLLMProvider
from app.core.config import Settings, get_settings
def get_llm_provider(settings: Settings | None = None) -> LLMProvider:
settings = settings or get_settings()
if settings.llm_provider == "anthropic":
from app.analysis.llm.anthropic_provider import AnthropicLLMProvider
return AnthropicLLMProvider(settings)
if settings.llm_provider == "ollama":
from app.analysis.llm.ollama_provider import OllamaLLMProvider
return OllamaLLMProvider(settings)
if settings.llm_provider == "gemini":
from app.analysis.llm.gemini_provider import GeminiLLMProvider
return GeminiLLMProvider(settings)
return MockLLMProvider()