DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
fix: consolidate web search results up to the configured max_results
Mohammad Hijjawief3742daf263
diff --git a/deeptutor/services/search/__init__.py b/deeptutor/services/search/__init__.pyindex 22744cc13..56dfca348 100644--- a/deeptutor/services/search/__init__.py+++ b/deeptutor/services/search/__init__.py@@ -243,6 +243,7 @@ def web_search(use_llm=use_llm,custom_template=consolidation_custom_template,llm_config=llm_config,+ max_results=provider_kwargs["max_results"],)response = consolidator.consolidate(response)diff --git a/tests/services/search/test_web_search_runtime.py b/tests/services/search/test_web_search_runtime.pyindex a0d47a603..1bed0621d 100644--- a/tests/services/search/test_web_search_runtime.py+++ b/tests/services/search/test_web_search_runtime.py@@ -419,6 +419,40 @@ def test_web_search_filters_provider_results_before_consolidation(monkeypatch) -)+def test_web_search_consolidates_every_result_the_user_asked_for(monkeypatch) -> None:+ class _ManyResultsProvider(_FakeProvider):+ def search(self, query: str, **kwargs):+ return WebSearchResponse(+ query=query,+ answer="",+ provider=self.name,+ citations=[],+ search_results=[+ SearchResult(title=f"Result {i}", url=f"https://site{i}.example/", snippet="s")+ for i in range(1, kwargs["max_results"] + 1)+ ],+ )++ _patch_runtime(+ monkeypatch,+ ResolvedSearchConfig(+ provider="brave",+ requested_provider="brave",+ api_key="brave-key",+ max_results=8,+ ),+ )+ monkeypatch.setattr(+ "deeptutor.services.search.get_provider",+ lambda name, **kwargs: _ManyResultsProvider(name),+ )++ result = web_search("education")++ assert len(result["search_results"]) == 8+ assert "**[8] Result 8**" in result["answer"]++def test_web_search_filters_answer_provider_citations_with_renumbering(monkeypatch) -> None:class _AnswerProvider(_FakeProvider):def __init__(self, name: str):