You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
933 B
Python

# backend/app/multimodal/factory.py — get_stt()/get_vision() (env 주입 + auto 폴백)
from ..config import get_settings
from .stt import HeuristicSTT, OllamaWhisperSTT, STTProvider
from .vision import HeuristicVision, OllamaVisionVision, VisionProvider
def get_stt(force: str | None = None) -> STTProvider:
mode = force or get_settings().stt_provider # auto|ollama|heuristic
if mode == "heuristic":
return HeuristicSTT()
if mode == "ollama":
return OllamaWhisperSTT()
p = OllamaWhisperSTT() # auto
return p if p.health().get("reachable") else HeuristicSTT()
def get_vision(force: str | None = None) -> VisionProvider:
mode = force or get_settings().vision_provider
if mode == "heuristic":
return HeuristicVision()
if mode == "ollama":
return OllamaVisionVision()
p = OllamaVisionVision()
return p if p.health().get("reachable") else HeuristicVision()