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.

refactor: rename PubMed settings to clarify LLM context usage

LearningCircuit65ee5f696355
diff --git a/src/local_deep_research/defaults/default_settings.json b/src/local_deep_research/defaults/default_settings.json
index a9b4009877..5649744471 100644
--- a/src/local_deep_research/defaults/default_settings.json
+++ b/src/local_deep_research/defaults/default_settings.json
@@ -533,11 +533,26 @@
"min_value": null,
"name": "Citation Format",
"options": [
- {"value": "number_hyperlinks", "label": "Numbers with hyperlinks [1]"},
- {"value": "domain_hyperlinks", "label": "Domain names with hyperlinks [arxiv.org]"},
- {"value": "domain_id_hyperlinks", "label": "Domain with smart numbering [arxiv.org] or [arxiv.org-1]"},
- {"value": "domain_id_always_hyperlinks", "label": "Domain with consistent numbering [arxiv.org-1]"},
- {"value": "no_hyperlinks", "label": "Numbers without hyperlinks [1]"}
+ {
+ "value": "number_hyperlinks",
+ "label": "Numbers with hyperlinks [1]"
+ },
+ {
+ "value": "domain_hyperlinks",
+ "label": "Domain names with hyperlinks [arxiv.org]"
+ },
+ {
+ "value": "domain_id_hyperlinks",
+ "label": "Domain with smart numbering [arxiv.org] or [arxiv.org-1]"
+ },
+ {
+ "value": "domain_id_always_hyperlinks",
+ "label": "Domain with consistent numbering [arxiv.org-1]"
+ },
+ {
+ "value": "no_hyperlinks",
+ "label": "Numbers without hyperlinks [1]"
+ }
],
"step": null,
"type": "REPORT",
@@ -553,14 +568,28 @@
"min_value": null,
"name": "Export Formats",
"options": [
- {"value": "markdown", "label": "Markdown (.md)"},
- {"value": "latex", "label": "LaTeX (.tex)"},
- {"value": "quarto", "label": "Quarto (.qmd)"}
+ {
+ "value": "markdown",
+ "label": "Markdown (.md)"
+ },
+ {
+ "value": "latex",
+ "label": "LaTeX (.tex)"
+ },
+ {
+ "value": "quarto",
+ "label": "Quarto (.qmd)"
+ }
],
"step": null,
"type": "REPORT",
"ui_element": "multiselect",
- "value": ["markdown", "latex", "quarto", "ris"],
+ "value": [
+ "markdown",
+ "latex",
+ "quarto",
+ "ris"
+ ],
"visible": true
},
"report.enable_file_backup": {
@@ -668,7 +697,10 @@
"max_value": null,
"min_value": null,
"name": "Search Strategy",
- "options": ["source-based", "focused-iteration"],
+ "options": [
+ "source-based",
+ "focused-iteration"
+ ],
"step": null,
"type": "SEARCH",
"ui_element": "select",
@@ -2825,146 +2857,6 @@
"value": true,
"visible": true
},
- "search.engine.web.pubmed.default_params.show_publication_type": {
- "category": "pubmed",
- "description": "Show publication type (e.g., Clinical Trial, Meta-Analysis) in snippets",
- "editable": true,
- "max_value": null,
- "min_value": null,
- "name": "Show Publication Type",
- "options": null,
- "step": null,
- "type": "SEARCH",
- "ui_element": "checkbox",
- "value": true,
- "visible": true
- },
- "search.engine.web.pubmed.default_params.show_journal": {
- "category": "pubmed",
- "description": "Show journal name in snippets",
- "editable": true,
- "max_value": null,
- "min_value": null,
- "name": "Show Journal",
- "options": null,
- "step": null,
- "type": "SEARCH",
- "ui_element": "checkbox",
- "value": true,
- "visible": true
- },
- "search.engine.web.pubmed.default_params.show_year": {
- "category": "pubmed",
- "description": "Show publication year in snippets",
- "editable": true,
- "max_value": null,
- "min_value": null,
- "name": "Show Year",
- "options": null,
- "step": null,
- "type": "SEARCH",
- "ui_element": "checkbox",
- "value": true,
- "visible": true
- },
- "search.engine.web.pubmed.default_params.show_authors": {
- "category": "pubmed",
- "description": "Show author names in snippets",
- "editable": true,
- "max_value": null,
- "min_value": null,
- "name": "Show Authors",
- "options": null,
- "step": null,
- "type": "SEARCH",
- "ui_element": "checkbox",
- "value": false,
- "visible": true
- },
- "search.engine.web.pubmed.default_params.show_full_date": {
- "category": "pubmed",
- "description": "Show full publication date instead of just year",
- "editable": true,
- "max_value": null,
- "min_value": null,
- "name": "Show Full Date",
- "options": null,
- "step": null,
- "type": "SEARCH",
- "ui_element": "checkbox",
- "value": false,
- "visible": true
- },
- "search.engine.web.pubmed.default_params.show_mesh_terms": {
- "category": "pubmed",
- "description": "Show MeSH terms (medical subject headings) for classification",
- "editable": true,
- "max_value": null,
- "min_value": null,
- "name": "Show MeSH Terms",
- "options": null,
- "step": null,
- "type": "SEARCH",
- "ui_element": "checkbox",
- "value": true,
- "visible": true
- },
- "search.engine.web.pubmed.default_params.show_keywords": {
- "category": "pubmed",
- "description": "Show article keywords",
- "editable": true,
- "max_value": null,
- "min_value": null,
- "name": "Show Keywords",
- "options": null,
- "step": null,
- "type": "SEARCH",
- "ui_element": "checkbox",
- "value": true,
- "visible": true
- },
- "search.engine.web.pubmed.default_params.show_doi": {
- "category": "pubmed",
- "description": "Show DOI (Digital Object Identifier)",
- "editable": true,
- "max_value": null,
- "min_value": null,
- "name": "Show DOI",
- "options": null,
- "step": null,
- "type": "SEARCH",
- "ui_element": "checkbox",
- "value": false,
- "visible": true
- },
- "search.engine.web.pubmed.default_params.show_pmid": {
- "category": "pubmed",
- "description": "Show PubMed ID",
- "editable": true,
- "max_value": null,
- "min_value": null,
- "name": "Show PMID",
- "options": null,
- "step": null,
- "type": "SEARCH",
- "ui_element": "checkbox",
- "value": false,
- "visible": true
- },
- "search.engine.web.pubmed.default_params.show_pmc_availability": {
- "category": "pubmed",
- "description": "Show if free full text is available in PMC",
- "editable": true,
- "max_value": null,
- "min_value": null,
- "name": "Show PMC Availability",
- "options": null,
- "step": null,
- "type": "SEARCH",
- "ui_element": "checkbox",
- "value": false,
- "visible": true
- },
"search.engine.web.pubmed.default_params.max_mesh_terms": {
"category": "pubmed",
"description": "Maximum number of MeSH terms to show (0 = all)",
@@ -2993,34 +2885,6 @@
"value": 3,
"visible": true
},
- "search.engine.web.pubmed.default_params.show_citation": {
- "category": "pubmed",
- "description": "Show volume, issue, and pages for proper citation",
- "editable": true,
- "max_value": null,
- "min_value": null,
- "name": "Show Citation Details",
- "options": null,
- "step": null,
- "type": "SEARCH",
- "ui_element": "checkbox",
- "value": false,
- "visible": true
- },
- "search.engine.web.pubmed.default_params.show_language": {
- "category": "pubmed",
- "description": "Show language if not English",
- "editable": true,
- "max_value": null,
- "min_value": null,
- "name": "Show Language",
- "options": null,
- "step": null,
- "type": "SEARCH",
- "ui_element": "checkbox",
- "value": false,
- "visible": true
- },
"search.engine.web.pubmed.module_path": {
"category": "pubmed",
"description": "Setting for pubmed.module_path",
@@ -4458,7 +4322,10 @@
"max_value": null,
"min_value": null,
"name": "Search Depth",
- "options": ["basic", "advanced"],
+ "options": [
+ "basic",
+ "advanced"
+ ],
"step": null,
"type": "SEARCH",
"ui_element": "select",
@@ -5179,5 +5046,173 @@
"ui_element": "number",
"value": 5,
"visible": true
+ },
+ "search.engine.web.pubmed.default_params.include_publication_type_in_context": {
+ "category": "pubmed",
+ "description": "Include publication type (e.g., Clinical Trial, Meta-Analysis) in context for analysis",
+ "editable": true,
+ "max_value": null,
+ "min_value": null,
+ "name": "Include Publication Type in Context",
+ "options": null,
+ "step": null,
+ "type": "SEARCH",
+ "ui_element": "checkbox",
+ "value": true,
+ "visible": true
+ },
+ "search.engine.web.pubmed.default_params.include_journal_in_context": {
+ "category": "pubmed",
+ "description": "Include journal name in context for analysis",
+ "editable": true,
+ "max_value": null,
+ "min_value": null,
+ "name": "Include Journal in Context",
+ "options": null,
+ "step": null,
+ "type": "SEARCH",
+ "ui_element": "checkbox",
+ "value": true,
+ "visible": true
+ },
+ "search.engine.web.pubmed.default_params.include_year_in_context": {
+ "category": "pubmed",
+ "description": "Include publication year in context for analysis",
+ "editable": true,
+ "max_value": null,
+ "min_value": null,
+ "name": "Include Year in Context",
+ "options": null,
+ "step": null,
+ "type": "SEARCH",
+ "ui_element": "checkbox",
+ "value": true,
+ "visible": true
+ },
+ "search.engine.web.pubmed.default_params.include_authors_in_context": {
+ "category": "pubmed",
+ "description": "Include author names in context for analysis",
+ "editable": true,
+ "max_value": null,
+ "min_value": null,
+ "name": "Include Authors in Context",
+ "options": null,
+ "step": null,
+ "type": "SEARCH",
+ "ui_element": "checkbox",
+ "value": false,
+ "visible": true
+ },
+ "search.engine.web.pubmed.default_params.include_full_date_in_context": {
+ "category": "pubmed",
+ "description": "Include full publication date in context for analysis",
+ "editable": true,
+ "max_value": null,
+ "min_value": null,
+ "name": "Include Full Date in Context",
+ "options": null,
+ "step": null,
+ "type": "SEARCH",
+ "ui_element": "checkbox",
+ "value": false,
+ "visible": true
+ },
+ "search.engine.web.pubmed.default_params.include_mesh_terms_in_context": {
+ "category": "pubmed",
+ "description": "Include MeSH terms (medical subject headings) in context for analysis",
+ "editable": true,
+ "max_value": null,
+ "min_value": null,
+ "name": "Include MeSH Terms in Context",
+ "options": null,
+ "step": null,
+ "type": "SEARCH",
+ "ui_element": "checkbox",
+ "value": true,
+ "visible": true
+ },
+ "search.engine.web.pubmed.default_params.include_keywords_in_context": {
+ "category": "pubmed",
+ "description": "Include article keywords in context for analysis",
+ "editable": true,
+ "max_value": null,
+ "min_value": null,
+ "name": "Include Keywords in Context",
+ "options": null,
+ "step": null,
+ "type": "SEARCH",
+ "ui_element": "checkbox",
+ "value": true,
+ "visible": true
+ },
+ "search.engine.web.pubmed.default_params.include_doi_in_context": {
+ "category": "pubmed",
+ "description": "Include DOI (Digital Object Identifier) in context for analysis",
+ "editable": true,
+ "max_value": null,
+ "min_value": null,
+ "name": "Include DOI in Context",
+ "options": null,
+ "step": null,
+ "type": "SEARCH",
+ "ui_element": "checkbox",
+ "value": false,
+ "visible": true
+ },
+ "search.engine.web.pubmed.default_params.include_pmid_in_context": {
+ "category": "pubmed",
+ "description": "Include PubMed ID in context for analysis",
+ "editable": true,
+ "max_value": null,
+ "min_value": null,
+ "name": "Include PMID in Context",
+ "options": null,
+ "step": null,
+ "type": "SEARCH",
+ "ui_element": "checkbox",
+ "value": false,
+ "visible": true
+ },
+ "search.engine.web.pubmed.default_params.include_pmc_availability_in_context": {
+ "category": "pubmed",
+ "description": "Include PMC free full text availability in context for analysis",
+ "editable": true,
+ "max_value": null,
+ "min_value": null,
+ "name": "Include PMC Availability in Context",
+ "options": null,
+ "step": null,
+ "type": "SEARCH",
+ "ui_element": "checkbox",
+ "value": false,
+ "visible": true
+ },
+ "search.engine.web.pubmed.default_params.include_citation_in_context": {
+ "category": "pubmed",
+ "description": "Include volume, issue, and pages in context for analysis",
+ "editable": true,
+ "max_value": null,
+ "min_value": null,
+ "name": "Include Citation Details in Context",
+ "options": null,
+ "step": null,
+ "type": "SEARCH",
+ "ui_element": "checkbox",
+ "value": false,
+ "visible": true
+ },
+ "search.engine.web.pubmed.default_params.include_language_in_context": {
+ "category": "pubmed",
+ "description": "Include language indicator in context for analysis",
+ "editable": true,
+ "max_value": null,
+ "min_value": null,
+ "name": "Include Language in Context",
+ "options": null,
+ "step": null,
+ "type": "SEARCH",
+ "ui_element": "checkbox",
+ "value": false,
+ "visible": true
}
}
diff --git a/src/local_deep_research/web_search_engines/engines/search_engine_pubmed.py b/src/local_deep_research/web_search_engines/engines/search_engine_pubmed.py
index 0d411eaf21..56126a3b55 100644
--- a/src/local_deep_research/web_search_engines/engines/search_engine_pubmed.py
+++ b/src/local_deep_research/web_search_engines/engines/search_engine_pubmed.py
@@ -28,20 +28,20 @@ class PubMedSearchEngine(BaseSearchEngine):
llm: Optional[BaseLLM] = None,
max_filtered_results: Optional[int] = None,
optimize_queries: bool = True,
- show_publication_type: bool = True,
- show_journal: bool = True,
- show_year: bool = True,
- show_authors: bool = False,
- show_full_date: bool = False,
- show_mesh_terms: bool = True,
- show_keywords: bool = True,
- show_doi: bool = False,
- show_pmid: bool = False,
- show_pmc_availability: bool = False,
+ include_publication_type_in_context: bool = True,
+ include_journal_in_context: bool = True,
+ include_year_in_context: bool = True,
+ include_authors_in_context: bool = False,
+ include_full_date_in_context: bool = False,
+ include_mesh_terms_in_context: bool = True,
+ include_keywords_in_context: bool = True,
+ include_doi_in_context: bool = False,
+ include_pmid_in_context: bool = False,
+ include_pmc_availability_in_context: bool = False,
max_mesh_terms: int = 3,
max_keywords: int = 3,
- show_citation: bool = False,
- show_language: bool = False,
+ include_citation_in_context: bool = False,
+ include_language_in_context: bool = False,
):
"""
Initialize the PubMed search engine.
@@ -70,20 +70,24 @@ class PubMedSearchEngine(BaseSearchEngine):
self.get_full_text = get_full_text
self.full_text_limit = full_text_limit
self.optimize_queries = optimize_queries
- self.show_publication_type = show_publication_type
- self.show_journal = show_journal
- self.show_year = show_year
- self.show_authors = show_authors
- self.show_full_date = show_full_date
- self.show_mesh_terms = show_mesh_terms
- self.show_keywords = show_keywords
- self.show_doi = show_doi
- self.show_pmid = show_pmid
- self.show_pmc_availability = show_pmc_availability
+ self.include_publication_type_in_context = (
+ include_publication_type_in_context
+ )
+ self.include_journal_in_context = include_journal_in_context
+ self.include_year_in_context = include_year_in_context
+ self.include_authors_in_context = include_authors_in_context
+ self.include_full_date_in_context = include_full_date_in_context
+ self.include_mesh_terms_in_context = include_mesh_terms_in_context
+ self.include_keywords_in_context = include_keywords_in_context
+ self.include_doi_in_context = include_doi_in_context
+ self.include_pmid_in_context = include_pmid_in_context
+ self.include_pmc_availability_in_context = (
+ include_pmc_availability_in_context
+ )
self.max_mesh_terms = max_mesh_terms
self.max_keywords = max_keywords
- self.show_citation = show_citation
- self.show_language = show_language
+ self.include_citation_in_context = include_citation_in_context
+ self.include_language_in_context = include_language_in_context
# Base API URLs
self.base_url = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils"
@@ -1300,12 +1304,14 @@ The default assumption should be that medical and scientific queries want RECENT
# Check for publication type from esummary (earlier than detailed metadata)
pub_type_prefix = ""
- if self.show_publication_type and summary.get("pubtype"):
+ if self.include_publication_type_in_context and summary.get(
+ "pubtype"
+ ):
# Use first publication type from esummary
pub_type_prefix = f"[{summary['pubtype'][0]}] "
# Add authors if enabled
- if self.show_authors and summary.get("authors"):
+ if self.include_authors_in_context and summary.get("authors"):
authors_text = ", ".join(summary.get("authors", []))
if len(authors_text) > 100:
# Truncate long author lists
@@ -1313,18 +1319,21 @@ The default assumption should be that medical and scientific queries want RECENT
snippet_parts.append(authors_text)
# Add journal if enabled
- if self.show_journal and summary.get("journal"):
+ if self.include_journal_in_context and summary.get("journal"):
snippet_parts.append(summary["journal"])
# Add date (full or year only)
if summary.get("pubdate"):
- if self.show_full_date:
+ if self.include_full_date_in_context:
snippet_parts.append(summary["pubdate"])
- elif self.show_year and len(summary["pubdate"]) >= 4:
+ elif (
+ self.include_year_in_context
+ and len(summary["pubdate"]) >= 4
+ ):
snippet_parts.append(summary["pubdate"][:4])
# Add citation details if enabled
- if self.show_citation:
+ if self.include_citation_in_context:
citation_parts = []
if summary.get("volume"):
citation_parts.append(f"Vol {summary['volume']}")
@@ -1338,7 +1347,7 @@ The default assumption should be that medical and scientific queries want RECENT
# Join snippet parts or provide default
if snippet_parts:
# Use different separators based on what's included
- if self.show_authors:
+ if self.include_authors_in_context:
snippet = ". ".join(
snippet_parts
) # Authors need period separator
@@ -1353,16 +1362,16 @@ The default assumption should be that medical and scientific queries want RECENT
snippet = pub_type_prefix + snippet
# Add language indicator if not English
- if self.show_language and summary.get("lang"):
+ if self.include_language_in_context and summary.get("lang"):
langs = summary["lang"]
if langs and langs[0] != "eng" and langs[0]:
snippet = f"{snippet} [{langs[0].upper()}]"
# Add identifiers if enabled
identifier_parts = []
- if self.show_pmid and summary.get("id"):
+ if self.include_pmid_in_context and summary.get("id"):
identifier_parts.append(f"PMID: {summary['id']}")
- if self.show_doi and summary.get("doi"):
+ if self.include_doi_in_context and summary.get("doi"):
identifier_parts.append(f"DOI: {summary['doi']}")
if identifier_parts:
@@ -1486,7 +1495,7 @@ The default assumption should be that medical and scientific queries want RECENT
# Add first publication type to snippet if enabled
if (
- self.show_publication_type
+ self.include_publication_type_in_context
and metadata["publication_types"]
):
# Just take the first publication type as is
@@ -1501,7 +1510,10 @@ The default assumption should be that medical and scientific queries want RECENT
result["mesh_terms"] = metadata["mesh_terms"]
# Add MeSH terms to snippet if enabled
- if self.show_mesh_terms and metadata["mesh_terms"]:
+ if (
+ self.include_mesh_terms_in_context
+ and metadata["mesh_terms"]
+ ):
mesh_to_show = (
metadata["mesh_terms"][: self.max_mesh_terms]
if self.max_mesh_terms > 0
@@ -1518,7 +1530,10 @@ The default assumption should be that medical and scientific queries want RECENT
result["keywords"] = metadata["keywords"]
# Add keywords to snippet if enabled
- if self.show_keywords and metadata["keywords"]:
+ if (
+ self.include_keywords_in_context
+ and metadata["keywords"]
+ ):
keywords_to_show = (
metadata["keywords"][: self.max_keywords]
if self.max_keywords > 0
@@ -1556,7 +1571,7 @@ The default assumption should be that medical and scientific queries want RECENT
# Add PMC availability to snippet if enabled
if (
- self.show_pmc_availability
+ self.include_pmc_availability_in_context
and metadata["has_free_full_text"]
and "snippet" in result
):