From f3fc86de07940b784466623c3c896138fd055900 Mon Sep 17 00:00:00 2001 From: kimi Date: Thu, 19 Mar 2026 15:46:32 -0400 Subject: [PATCH] fix: remove dead airllm provider type from cascade router MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the airllm provider block from providers.yaml, the airllm availability check from cascade.py, and associated tests. Renumber remaining provider priorities (OpenAI → 2, Anthropic → 3). Fixes #459 Co-Authored-By: Claude Opus 4.6 --- config/providers.yaml | 22 +++------------ src/infrastructure/router/cascade.py | 11 +------- tests/infrastructure/test_router_cascade.py | 30 +-------------------- 3 files changed, 6 insertions(+), 57 deletions(-) diff --git a/config/providers.yaml b/config/providers.yaml index 0e60c3e..70f4bec 100644 --- a/config/providers.yaml +++ b/config/providers.yaml @@ -54,25 +54,11 @@ providers: context_window: 2048 capabilities: [text, vision, streaming] - # Secondary: Local AirLLM (if installed) - - name: airllm-local - type: airllm - enabled: false # Enable if pip install airllm - priority: 2 - models: - - name: 70b - default: true - capabilities: [text, tools, json, streaming] - - name: 8b - capabilities: [text, tools, json, streaming] - - name: 405b - capabilities: [text, tools, json, streaming] - - # Tertiary: OpenAI (if API key available) + # Secondary: OpenAI (if API key available) - name: openai-backup type: openai enabled: false # Enable by setting OPENAI_API_KEY - priority: 3 + priority: 2 api_key: "${OPENAI_API_KEY}" # Loaded from environment base_url: null # Use default OpenAI endpoint models: @@ -84,11 +70,11 @@ providers: context_window: 128000 capabilities: [text, vision, tools, json, streaming] - # Quaternary: Anthropic (if API key available) + # Tertiary: Anthropic (if API key available) - name: anthropic-backup type: anthropic enabled: false # Enable by setting ANTHROPIC_API_KEY - priority: 4 + priority: 3 api_key: "${ANTHROPIC_API_KEY}" models: - name: claude-3-haiku-20240307 diff --git a/src/infrastructure/router/cascade.py b/src/infrastructure/router/cascade.py index 83a4f4a..74ee8d3 100644 --- a/src/infrastructure/router/cascade.py +++ b/src/infrastructure/router/cascade.py @@ -100,7 +100,7 @@ class Provider: """LLM provider configuration and state.""" name: str - type: str # ollama, openai, anthropic, airllm + type: str # ollama, openai, anthropic enabled: bool priority: int url: str | None = None @@ -308,15 +308,6 @@ class CascadeRouter: logger.debug("Ollama provider check error: %s", exc) return False - elif provider.type == "airllm": - # Check if airllm is installed - try: - import importlib.util - - return importlib.util.find_spec("airllm") is not None - except (ImportError, ModuleNotFoundError): - return False - elif provider.type in ("openai", "anthropic", "grok"): # Check if API key is set return provider.api_key is not None and provider.api_key != "" diff --git a/tests/infrastructure/test_router_cascade.py b/tests/infrastructure/test_router_cascade.py index d482d7a..cab475f 100644 --- a/tests/infrastructure/test_router_cascade.py +++ b/tests/infrastructure/test_router_cascade.py @@ -2,7 +2,7 @@ import time from pathlib import Path -from unittest.mock import AsyncMock, MagicMock, patch +from unittest.mock import AsyncMock, patch import pytest import yaml @@ -489,34 +489,6 @@ class TestProviderAvailabilityCheck: assert router._check_provider_available(provider) is False - def test_check_airllm_installed(self): - """Test AirLLM when installed.""" - router = CascadeRouter(config_path=Path("/nonexistent")) - - provider = Provider( - name="airllm", - type="airllm", - enabled=True, - priority=1, - ) - - with patch("importlib.util.find_spec", return_value=MagicMock()): - assert router._check_provider_available(provider) is True - - def test_check_airllm_not_installed(self): - """Test AirLLM when not installed.""" - router = CascadeRouter(config_path=Path("/nonexistent")) - - provider = Provider( - name="airllm", - type="airllm", - enabled=True, - priority=1, - ) - - with patch("importlib.util.find_spec", return_value=None): - assert router._check_provider_available(provider) is False - class TestCascadeRouterReload: """Test hot-reload of providers.yaml."""