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: remove FakeListLLM fallback, log silent exceptions (#3194)

LearningCircuit546f434c40cd
diff --git a/src/local_deep_research/utilities/llm_utils.py b/src/local_deep_research/utilities/llm_utils.py
index aae11a0533..8cf9dec443 100644
--- a/src/local_deep_research/utilities/llm_utils.py
+++ b/src/local_deep_research/utilities/llm_utils.py
@@ -310,16 +310,6 @@ def get_model(
except (ImportError, Exception):
logger.exception("Failed to load any model")
- # Last resort: create a dummy model
- try:
- from langchain_community.llms.fake import FakeListLLM
-
- return FakeListLLM(
- responses=[
- "No language models are available. Please install Ollama or set up API keys."
- ]
- )
- except ImportError:
- raise ValueError(
- "No language models available and could not create dummy model"
- )
+ raise ValueError(
+ "No language models available. Please install Ollama or set up API keys."
+ )
diff --git a/src/local_deep_research/web/routes/history_routes.py b/src/local_deep_research/web/routes/history_routes.py
index ec88008ca9..80d7213a90 100644
--- a/src/local_deep_research/web/routes/history_routes.py
+++ b/src/local_deep_research/web/routes/history_routes.py
@@ -163,12 +163,18 @@ def get_research_status(research_id):
try:
result["log"] = json.loads(result.get("progress_log", "[]"))
except Exception:
+ logger.warning(
+ "Error parsing progress_log for research %s", research_id
+ )
result["log"] = []
else:
result["progress"] = 0
try:
result["log"] = json.loads(result.get("progress_log", "[]"))
except Exception:
+ logger.warning(
+ "Error parsing progress_log for research %s", research_id
+ )
result["log"] = []
return jsonify(result)
diff --git a/src/local_deep_research/web/routes/settings_routes.py b/src/local_deep_research/web/routes/settings_routes.py
index 103817a505..68671164b8 100644
--- a/src/local_deep_research/web/routes/settings_routes.py
+++ b/src/local_deep_research/web/routes/settings_routes.py
@@ -1408,7 +1408,10 @@ def api_get_available_models():
except Exception:
logger.exception("Error getting available models")
return jsonify(
- {"status": "error", "message": "Failed to save settings"}
+ {
+ "status": "error",
+ "message": "Failed to retrieve available models",
+ }
), 500
diff --git a/tests/utilities/test_llm_utils_coverage.py b/tests/utilities/test_llm_utils_coverage.py
index a0b4db5642..8657846827 100644
--- a/tests/utilities/test_llm_utils_coverage.py
+++ b/tests/utilities/test_llm_utils_coverage.py
@@ -5,7 +5,7 @@ Focuses on paths not exercised by existing test files:
- _close_base_llm: close() delegation, Ollama httpx client closing,
non-Ollama _client skip, missing _client attr, missing httpx client
- get_model: openai_endpoint without model required, unknown type where
- Ollama import fails and FakeListLLM is returned, all imports fail -> ValueError
+ Ollama import fails -> ValueError (FakeListLLM fallback removed)
- fetch_ollama_models: verifies safe_get (not requests.get) is used
"""
@@ -165,49 +165,27 @@ class TestGetModelOpenAIEndpointNoModelRequired:
# ---------------------------------------------------------------------------
-# get_model - unknown type, Ollama import fails -> FakeListLLM
+# get_model - unknown type, Ollama import fails -> raises ValueError
# ---------------------------------------------------------------------------
-class TestGetModelFallbackToFakeListLLM:
+class TestGetModelUnknownTypeRaisesValueError:
"""When model_type is unknown AND ChatOllama import fails,
- should fall back to FakeListLLM."""
+ should raise ValueError (FakeListLLM fallback was removed)."""
- def test_unknown_type_ollama_fails_returns_fake(self):
- mock_fake = Mock()
+ def test_unknown_type_ollama_fails_raises_value_error(self):
original_import = builtins.__import__
def custom_import(name, *args, **kwargs):
if name == "langchain_ollama":
raise ImportError("no langchain_ollama")
- if name == "langchain_community.llms.fake":
- mod = MagicMock()
- mod.FakeListLLM = mock_fake
- return mod
return original_import(name, *args, **kwargs)
with patch("builtins.__import__", side_effect=custom_import):
- get_model(model_name="test", model_type="some_weird_type")
- mock_fake.assert_called_once()
- call_kwargs = mock_fake.call_args
- assert (
- "responses" in call_kwargs.kwargs or len(call_kwargs.args) > 0
- )
-
- def test_all_imports_fail_raises_value_error(self):
- """When even FakeListLLM import fails, should raise ValueError."""
- original_import = builtins.__import__
-
- def custom_import(name, *args, **kwargs):
- if name == "langchain_ollama":
- raise ImportError("no langchain_ollama")
- if "langchain_community" in name:
- raise ImportError("no langchain_community")
- return original_import(name, *args, **kwargs)
-
- with patch("builtins.__import__", side_effect=custom_import):
- with pytest.raises((ValueError, ImportError)):
- get_model(model_name="test", model_type="nonexistent_type")
+ with pytest.raises(
+ ValueError, match="No language models available"
+ ):
+ get_model(model_name="test", model_type="some_weird_type")
# ---------------------------------------------------------------------------