~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
"""Regression test for issue #4546.
``OpenAICompatibleProvider.create_llm`` / ``_create_llm_instance`` resolve the
context window from ``cls.provider_key``. Previously they used
``getattr(cls, "provider_key", "")`` which silently yielded ``""`` for a
subclass missing ``provider_key`` — falling through into the cloud
context-window branch instead of failing. A subclass that forgets to declare
``provider_key`` must now fail loudly (``AttributeError``) at construction.
"""
from unittest.mock import patch
import pytest
from local_deep_research.llm.providers.openai_base import (
OpenAICompatibleProvider,
)
MODULE = "local_deep_research.llm.providers.openai_base"
SETTINGS_MODULE = "local_deep_research.config.thread_settings"
class _ProviderWithoutKey(OpenAICompatibleProvider):
"""A misconfigured provider that omits the required provider_key."""
provider_name = "no_provider_key"
# Keyless so construction reaches context-window resolution rather than
# raising earlier for a missing API key.
api_key_setting = None
default_base_url = "http://localhost:1234/v1"
default_model = "test-model"
@patch(f"{MODULE}.ChatOpenAI")
@patch(f"{SETTINGS_MODULE}.get_setting_from_snapshot", return_value=None)
def test_create_llm_without_provider_key_raises(mock_get_setting, mock_chat):
"""create_llm fails loud when provider_key is missing (issue #4546)."""
with pytest.raises(AttributeError):
_ProviderWithoutKey.create_llm(
model_name="test-model", settings_snapshot={}
)
@patch(f"{MODULE}.ChatOpenAI")
@patch(f"{SETTINGS_MODULE}.get_setting_from_snapshot", return_value=None)
def test_create_llm_instance_without_provider_key_raises(
mock_get_setting, mock_chat
):
"""_create_llm_instance fails loud when provider_key is missing."""
with pytest.raises(AttributeError):
_ProviderWithoutKey._create_llm_instance(
model_name="test-model", settings_snapshot={}
)