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(research-functions): thread settings_snapshot through analyze_documents (#3759)

LearningCircuit1fba22dec03c
diff --git a/src/local_deep_research/api/research_functions.py b/src/local_deep_research/api/research_functions.py
index 78f50fa4df..9fe1e66edf 100644
--- a/src/local_deep_research/api/research_functions.py
+++ b/src/local_deep_research/api/research_functions.py
@@ -620,6 +620,7 @@ def analyze_documents(
temperature: float = 0.7,
force_reindex: bool = False,
output_file: str | None = None,
+ **kwargs: Any,
) -> dict[str, Any]:
"""
Search and analyze documents in a specific local collection.
@@ -631,12 +632,18 @@ def analyze_documents(
temperature: LLM temperature for summary generation
force_reindex: Whether to force reindexing the collection
output_file: Optional path to save analysis results to a file
+ **kwargs: Pass settings_snapshot (via create_settings_snapshot()) to
+ configure provider, API keys, embedding model, etc.
Returns:
Dictionary containing:
- 'summary': Summary of the findings
- 'documents': List of matching documents with content and metadata
"""
+ if "settings_snapshot" not in kwargs:
+ kwargs["settings_snapshot"] = create_settings_snapshot()
+ settings_snapshot = kwargs["settings_snapshot"]
+
logger.info(
f"Analyzing documents in collection '{collection_name}' for query: {query}"
)
@@ -645,10 +652,16 @@ def analyze_documents(
search = None
try:
# Get language model with custom temperature
- llm = get_llm(temperature=temperature)
+ llm = get_llm(
+ temperature=temperature, settings_snapshot=settings_snapshot
+ )
# Get search engine for the specified collection
- search = get_search(collection_name, llm_instance=llm)
+ search = get_search(
+ collection_name,
+ llm_instance=llm,
+ settings_snapshot=settings_snapshot,
+ )
if not search:
from ..utilities.resource_utils import safe_close
@@ -734,7 +747,7 @@ def analyze_documents(
content,
"api.allow_file_output",
context="API document analysis",
- settings_snapshot=None, # analyze_documents doesn't support programmatic mode yet
+ settings_snapshot=settings_snapshot,
)
analysis_result["file_path"] = output_file