~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
fix: warn when safe_close() receives resource without close() (#2795)
LearningCircuitf8b4b1bcb07a
diff --git a/src/local_deep_research/utilities/resource_utils.py b/src/local_deep_research/utilities/resource_utils.pyindex 09439b77dd..73d3abe4c4 100644--- a/src/local_deep_research/utilities/resource_utils.py+++ b/src/local_deep_research/utilities/resource_utils.py@@ -3,11 +3,33 @@from loguru import logger-def safe_close(resource, name: str = "resource"):- """Close a resource, logging a warning on failure. Never raises."""+def safe_close(+ resource,+ name: str = "resource",+ *,+ allow_none: bool = False,+ closing_optional: bool = False,+):+ """Close a resource, logging a warning on failure. Never raises.++ Args:+ resource: The resource to close.+ name: Human-readable label for log messages.+ allow_none: If True, silently skip None resources. If False (default),+ log a warning — the caller likely failed to initialize it.+ closing_optional: If True, silently skip resources without a close()+ method. If False (default), log a warning — the caller likely+ passed the wrong object.+ """if resource is None:+ if not allow_none:+ logger.warning(f"Resource {name!r} is None — nothing to close")returnif not hasattr(resource, "close"):+ if not closing_optional:+ logger.warning(+ f"Resource {name!r} ({type(resource).__name__}) has no close() method"+ )returntry:resource.close()