~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
refactor: use centralized URL normalization in llm_config.py
LearningCircuit6c8ac409429b
diff --git a/src/local_deep_research/config/llm_config.py b/src/local_deep_research/config/llm_config.pyindex ca5befd046..0f21a341e1 100644--- a/src/local_deep_research/config/llm_config.py+++ b/src/local_deep_research/config/llm_config.py@@ -1,6 +1,5 @@import loggingimport os-from urllib.parse import urlparse # urlunparse removed if not used elsewherefrom langchain_anthropic import ChatAnthropicfrom langchain_community.llms import VLLM@@ -10,6 +9,7 @@ from langchain_openai import ChatOpenAIfrom ..utilities.db_utils import get_db_settingfrom ..utilities.search_utilities import remove_think_tags+from ..utilities.url_utils import normalize_ollama_url# Setup logginglogger = logging.getLogger(__name__)@@ -143,26 +143,7 @@ def get_llm(model_name=None, temperature=None, provider=None, openai_endpoint_urtry:# Use the configurable Ollama base URLraw_base_url = get_db_setting("llm.ollama.url", "http://localhost:11434")- parsed_url = urlparse(raw_base_url)- if parsed_url.scheme and not parsed_url.netloc and parsed_url.path:- # Corrects "scheme:hostname" to "scheme://hostname"- scheme_to_use = parsed_url.scheme if parsed_url.scheme in ("http", "https") else "https"- base_url = f"{scheme_to_use}://{parsed_url.path}"- elif not parsed_url.scheme:- # Handles "hostname" or "//hostname"- temp_host_path = raw_base_url- if raw_base_url.startswith("//"):- temp_host_path = raw_base_url[2:]-- is_localhost = temp_host_path.startswith("localhost") or temp_host_path.startswith("127.0.0.1")-- if is_localhost:- base_url = "http://" + temp_host_path- else:- base_url = "https://" + temp_host_path- else:- # Assumed to be well-formed (e.g., "http://hostname", "https://hostname") or other scheme.- base_url = raw_base_url+ base_url = normalize_ollama_url(raw_base_url)# Check if Ollama is available before trying to use itif not is_ollama_available():@@ -393,26 +374,7 @@ def is_ollama_available():import requestsraw_base_url = get_db_setting("llm.ollama.url", "http://localhost:11434")- parsed_url = urlparse(raw_base_url)- if parsed_url.scheme and not parsed_url.netloc and parsed_url.path:- # Corrects "scheme:hostname" to "scheme://hostname"- scheme_to_use = parsed_url.scheme if parsed_url.scheme in ("http", "https") else "https"- base_url = f"{scheme_to_use}://{parsed_url.path}"- elif not parsed_url.scheme:- # Handles "hostname" or "//hostname"- temp_host_path = raw_base_url- if raw_base_url.startswith("//"):- temp_host_path = raw_base_url[2:]-- is_localhost = temp_host_path.startswith("localhost") or temp_host_path.startswith("127.0.0.1")-- if is_localhost:- base_url = "http://" + temp_host_path- else:- base_url = "https://" + temp_host_path- else:- # Assumed to be well-formed (e.g., "http://hostname", "https://hostname") or other scheme.- base_url = raw_base_url+ base_url = normalize_ollama_url(raw_base_url)logger.info(f"Checking Ollama availability at {base_url}/api/tags")try: