File size: 1,500 Bytes
aefac4f
 
 
9659593
aefac4f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9659593
aefac4f
 
 
 
 
 
 
 
 
 
 
9659593
aefac4f
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""
Tests for Task 7: Model Selection Centralization
"""

import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).parent.parent))

from src.llm_config import LLMConfig


def test_get_synthesizer_returns_not_none():
    """get_synthesizer should return a model (may need API key — skip if unavailable)"""
    config = LLMConfig(lazy=True)
    try:
        model = config.get_synthesizer()
        assert model is not None
    except (ValueError, ImportError):
        # API keys may not be configured in CI
        import pytest

        pytest.skip("LLM provider not configured, skipping")


def test_get_synthesizer_with_model_name():
    """get_synthesizer with custom model should not raise (validates dispatch)"""
    config = LLMConfig(lazy=True)
    try:
        model = config.get_synthesizer(model_name="llama-3.3-70b-versatile")
        assert model is not None
    except (ValueError, ImportError):
        import pytest

        pytest.skip("LLM provider not configured, skipping")


def test_llm_config_has_synthesizer_property():
    """LLMConfig should expose synthesizer_8b via property"""
    assert hasattr(LLMConfig, "synthesizer_8b")


def test_llm_config_has_all_properties():
    """Verify all expected model properties exist"""
    expected = ["planner", "analyzer", "explainer", "synthesizer_7b", "synthesizer_8b", "director", "embedding_model"]
    for prop_name in expected:
        assert hasattr(LLMConfig, prop_name), f"Missing property: {prop_name}"