From 9165dbcacad4e1daf76bfc7829abe4d80f812f26 Mon Sep 17 00:00:00 2001 From: Timmy Date: Thu, 19 Mar 2026 15:43:52 -0400 Subject: [PATCH] refactor: remove dead airllm provider from cascade router (#459) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove airllm health-check branch, provider config entry, and tests. AirLLM backend in backends.py is untouched — it works independently. The cascade router never had a _call_airllm dispatch method, so this code path was unreachable dead code. -52 lines removed. --- config/providers.yaml | 13 --------- src/infrastructure/router/cascade.py | 11 +------- tests/infrastructure/test_router_cascade.py | 30 +-------------------- 3 files changed, 2 insertions(+), 52 deletions(-) diff --git a/config/providers.yaml b/config/providers.yaml index 0e60c3e9..11d5eebe 100644 --- a/config/providers.yaml +++ b/config/providers.yaml @@ -54,19 +54,6 @@ 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) - name: openai-backup diff --git a/src/infrastructure/router/cascade.py b/src/infrastructure/router/cascade.py index 83a4f4a8..74ee8d33 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 d482d7a6..cab475fa 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."""