mirror of
https://github.com/usestrix/strix.git
synced 2026-08-16 09:26:39 +02:00
91 lines
2.8 KiB
Python
91 lines
2.8 KiB
Python
"""Tests for LLM model recommendation helpers."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from strix.config.models import (
|
|
RECOMMENDED_MODEL_NAMES,
|
|
is_recommended_or_frontier_model,
|
|
request_timeout_extra_args,
|
|
)
|
|
|
|
|
|
@pytest.mark.parametrize("model_name", RECOMMENDED_MODEL_NAMES)
|
|
def test_recommended_models_are_accepted(model_name: str) -> None:
|
|
assert is_recommended_or_frontier_model(model_name)
|
|
|
|
|
|
def test_request_timeout_extra_args_positive() -> None:
|
|
args = request_timeout_extra_args(300)
|
|
assert args is not None
|
|
timeout = args["timeout"]
|
|
# read (inactivity) carries the configured value; connect is capped so a dead
|
|
# endpoint fails fast rather than waiting the full read window.
|
|
assert timeout.read == 300.0
|
|
assert timeout.connect == 30.0
|
|
|
|
short = request_timeout_extra_args(10)
|
|
assert short is not None
|
|
assert short["timeout"].read == 10.0
|
|
assert short["timeout"].connect == 10.0
|
|
|
|
|
|
@pytest.mark.parametrize("value", [None, 0, -1])
|
|
def test_request_timeout_extra_args_disabled(value: float | None) -> None:
|
|
assert request_timeout_extra_args(value) is None
|
|
|
|
|
|
def test_recommended_models_are_matched_case_insensitively() -> None:
|
|
assert is_recommended_or_frontier_model("Vertex_AI/Gemini-3-Pro-Preview")
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"model_name",
|
|
[
|
|
"gpt-5.5",
|
|
"litellm/openai/gpt-5.4-pro",
|
|
"azure_ai/gpt-5.5-pro",
|
|
"bedrock_mantle/openai.gpt-5.5",
|
|
"anthropic/claude-opus-4-8",
|
|
"anthropic.claude-opus-4-8",
|
|
"anthropic/claude-opus-4-7",
|
|
"anthropic/claude-fable-5",
|
|
"anthropic/claude-sonnet-5",
|
|
"vertex_ai/claude-sonnet-5@default",
|
|
"vertex_ai/claude-sonnet-4-6@default",
|
|
"any-llm/anthropic/claude-sonnet-4-6",
|
|
"vertex_ai/gemini-3.1-pro-preview",
|
|
"openrouter/google/gemini-3.1-pro-preview",
|
|
"deepseek/deepseek-v4-pro",
|
|
"deepseek/deepseek-r1-0528",
|
|
"deepseek/deepseek-reasoner",
|
|
"dashscope/qwen3-max-2026-01-23",
|
|
"qwen3.7-max",
|
|
"moonshot/kimi-k2.6",
|
|
"kimi-k2.7-code",
|
|
],
|
|
)
|
|
def test_frontier_model_families_are_accepted(model_name: str) -> None:
|
|
assert is_recommended_or_frontier_model(model_name)
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"model_name",
|
|
[
|
|
"",
|
|
"openai/gpt-4.1",
|
|
"anthropic/claude-3-5-sonnet-latest",
|
|
"ollama/llama3.1",
|
|
"deepseek/deepseek-chat",
|
|
"custom-ollama/gpt-5-mini-local",
|
|
"custom-provider/claude-opus-4-local",
|
|
"xai/grok-4.5",
|
|
"openrouter/x-ai/grok-4",
|
|
"mistral/mistral-medium-3-5",
|
|
"mistral/magistral-medium-latest",
|
|
],
|
|
)
|
|
def test_non_frontier_models_are_rejected(model_name: str) -> None:
|
|
assert not is_recommended_or_frontier_model(model_name)
|