from src.core.config import settings
from src.services import knowledge_extractor_service


def test_extract_model_uses_configured_ollama_tool_model(monkeypatch):
    """KB extractor must use a configured model that exists on GCP Ollama."""
    monkeypatch.setattr(settings, "OLLAMA_TOOL_MODEL", "hermes3:latest")

    assert knowledge_extractor_service._get_extract_model() == "hermes3:latest"


def test_extract_model_falls_back_to_hermes_when_config_empty(monkeypatch):
    """Empty runtime config should not fall back to the removed llama3.2 model."""
    monkeypatch.setattr(settings, "OLLAMA_TOOL_MODEL", "")

    assert knowledge_extractor_service._get_extract_model() == "hermes3:latest"
