Skip to content

~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.

fix: Detect mocked LLM classes to skip fallback logic in tests

LearningCircuit04aa3f54f084
diff --git a/src/local_deep_research/config/llm_config.py b/src/local_deep_research/config/llm_config.py
index 962f2d2826..743357edd3 100644
--- a/src/local_deep_research/config/llm_config.py
+++ b/src/local_deep_research/config/llm_config.py
@@ -308,8 +308,17 @@ def get_llm(
# Check if we're in testing mode and should use fallback (but only when no API keys are configured)
# Skip fallback check if we're in test mode with mocks
- if os.environ.get("LDR_USE_FALLBACK_LLM", "") and not os.environ.get(
- "LDR_TESTING_WITH_MOCKS", ""
+ # Also skip if ChatOpenAI or ChatAnthropic are mocked (detected by checking if they're MagicMock)
+ from unittest.mock import MagicMock
+
+ is_mocked = isinstance(ChatOpenAI, MagicMock) or isinstance(
+ ChatAnthropic, MagicMock
+ )
+
+ if (
+ os.environ.get("LDR_USE_FALLBACK_LLM", "")
+ and not os.environ.get("LDR_TESTING_WITH_MOCKS", "")
+ and not is_mocked
):
# Only use fallback if the provider has no valid configuration
provider_has_config = False