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.

chore: delete unused FollowUpResponse dataclass (#4167)

LearningCircuit6f14123c4c43
diff --git a/src/local_deep_research/followup_research/__init__.py b/src/local_deep_research/followup_research/__init__.py
index 0e875318fe..3a9511e132 100644
--- a/src/local_deep_research/followup_research/__init__.py
+++ b/src/local_deep_research/followup_research/__init__.py
@@ -6,10 +6,9 @@ reusing previous findings and sources to provide contextual answers.
"""
from .service import FollowUpResearchService
-from .models import FollowUpRequest, FollowUpResponse
+from .models import FollowUpRequest
__all__ = [
"FollowUpResearchService",
"FollowUpRequest",
- "FollowUpResponse",
]
diff --git a/src/local_deep_research/followup_research/models.py b/src/local_deep_research/followup_research/models.py
index 0baa6b7e22..6b57b367fa 100644
--- a/src/local_deep_research/followup_research/models.py
+++ b/src/local_deep_research/followup_research/models.py
@@ -3,7 +3,7 @@ Data models for follow-up research functionality.
"""
from dataclasses import dataclass
-from typing import List, Dict, Any
+from typing import Dict, Any
@dataclass
@@ -25,28 +25,3 @@ class FollowUpRequest:
"max_iterations": self.max_iterations,
"questions_per_iteration": self.questions_per_iteration,
}
-
-
-@dataclass
-class FollowUpResponse:
- """Response model for follow-up research."""
-
- research_id: str
- question: str
- answer: str
- sources_used: List[Dict[str, str]]
- parent_context_used: bool
- reused_links_count: int
- new_links_count: int
-
- def to_dict(self) -> Dict[str, Any]:
- """Convert to dictionary for API response."""
- return {
- "research_id": self.research_id,
- "question": self.question,
- "answer": self.answer,
- "sources_used": self.sources_used,
- "parent_context_used": self.parent_context_used,
- "reused_links_count": self.reused_links_count,
- "new_links_count": self.new_links_count,
- }
diff --git a/tests/followup_research/conftest.py b/tests/followup_research/conftest.py
index 9334b48f95..0a30a65f27 100644
--- a/tests/followup_research/conftest.py
+++ b/tests/followup_research/conftest.py
@@ -78,26 +78,6 @@ def sample_followup_request():
)
-def sample_followup_response():
- """Create a sample FollowUpResponse."""
- from local_deep_research.followup_research.models import (
- FollowUpResponse,
- )
-
- return FollowUpResponse(
- research_id="test-followup-id",
- question="What are the implications?",
- answer="The implications are significant.",
- sources_used=[
- {"title": "Source 1", "url": "https://example.com/1"},
- ],
- parent_context_used=True,
- reused_links_count=2,
- new_links_count=3,
- )
-
-
@pytest.fixture
def mock_settings_manager():
"""Mock the SettingsManager."""
diff --git a/tests/followup_research/test_followup_edge_cases.py b/tests/followup_research/test_followup_edge_cases.py
index c00d19ad31..2a5bf12096 100644
--- a/tests/followup_research/test_followup_edge_cases.py
+++ b/tests/followup_research/test_followup_edge_cases.py
@@ -9,10 +9,7 @@ Covers gaps not addressed by existing test_models.py and test_service.py:
from unittest.mock import patch, MagicMock
-from local_deep_research.followup_research.models import (
- FollowUpRequest,
- FollowUpResponse,
-)
+from local_deep_research.followup_research.models import FollowUpRequest
from local_deep_research.followup_research.service import (
FollowUpResearchService,
)
@@ -57,61 +54,6 @@ class TestFollowUpRequestEdgeCases:
assert req.to_dict()["strategy"] == "custom-strat"
-class TestFollowUpResponseEdgeCases:
- """Edge cases for FollowUpResponse dataclass."""
-
- def test_to_dict_returns_all_seven_keys(self):
- """Verify to_dict returns exactly the expected keys."""
- resp = FollowUpResponse(
- research_id="r1",
- question="q1",
- answer="a1",
- sources_used=[],
- parent_context_used=False,
- reused_links_count=0,
- new_links_count=0,
- )
- expected_keys = {
- "research_id",
- "question",
- "answer",
- "sources_used",
- "parent_context_used",
- "reused_links_count",
- "new_links_count",
- }
- assert set(resp.to_dict().keys()) == expected_keys
-
- def test_sources_used_preserves_dict_structure(self):
- """Source dicts are passed through to_dict without modification."""
- sources = [{"url": "http://example.com", "title": "Ex"}]
- resp = FollowUpResponse(
- research_id="r1",
- question="q1",
- answer="a1",
- sources_used=sources,
- parent_context_used=True,
- reused_links_count=1,
- new_links_count=0,
- )
- assert resp.to_dict()["sources_used"] is sources
-
- def test_large_link_counts(self):
- """Large link counts are stored correctly."""
- resp = FollowUpResponse(
- research_id="r1",
- question="q1",
- answer="a1",
- sources_used=[],
- parent_context_used=True,
- reused_links_count=999999,
- new_links_count=888888,
- )
- d = resp.to_dict()
- assert d["reused_links_count"] == 999999
- assert d["new_links_count"] == 888888
-
-
class TestPerformFollowupEdgeCases:
"""Tests for FollowUpResearchService.perform_followup edge cases."""
diff --git a/tests/followup_research/test_models.py b/tests/followup_research/test_models.py
index 26b3f9e970..53a328ef2f 100644
--- a/tests/followup_research/test_models.py
+++ b/tests/followup_research/test_models.py
@@ -1,9 +1,6 @@
"""Tests for followup_research models."""
-from local_deep_research.followup_research.models import (
- FollowUpRequest,
- FollowUpResponse,
-)
+from local_deep_research.followup_research.models import FollowUpRequest
class TestFollowUpRequest:
@@ -78,104 +75,3 @@ class TestFollowUpRequest:
)
assert request.question == ""
-
-
-class TestFollowUpResponse:
- """Tests for FollowUpResponse dataclass."""
-
- def test_create_with_all_fields(self):
- """Create response with all fields."""
- sources = [
- {"title": "Source 1", "url": "https://example.com/1"},
- {"title": "Source 2", "url": "https://example.com/2"},
- ]
-
- response = FollowUpResponse(
- research_id="research-123",
- question="What was asked?",
- answer="This is the answer.",
- sources_used=sources,
- parent_context_used=True,
- reused_links_count=5,
- new_links_count=3,
- )
-
- assert response.research_id == "research-123"
- assert response.question == "What was asked?"
- assert response.answer == "This is the answer."
- assert len(response.sources_used) == 2
- assert response.parent_context_used is True
- assert response.reused_links_count == 5
- assert response.new_links_count == 3
-
- def test_to_dict(self):
- """to_dict returns dictionary with all fields."""
- sources = [{"title": "Source", "url": "https://example.com"}]
-
- response = FollowUpResponse(
- research_id="res-456",
- question="Test Q",
- answer="Test A",
- sources_used=sources,
- parent_context_used=False,
- reused_links_count=0,
- new_links_count=10,
- )
-
- result = response.to_dict()
-
- assert isinstance(result, dict)
- assert result["research_id"] == "res-456"
- assert result["question"] == "Test Q"
- assert result["answer"] == "Test A"
- assert result["sources_used"] == sources
- assert result["parent_context_used"] is False
- assert result["reused_links_count"] == 0
- assert result["new_links_count"] == 10
-
- def test_empty_sources(self):
- """Create response with empty sources list."""
- response = FollowUpResponse(
- research_id="res-empty",
- question="No sources",
- answer="Answer without sources",
- sources_used=[],
- parent_context_used=False,
- reused_links_count=0,
- new_links_count=0,
- )
-
- assert response.sources_used == []
- result = response.to_dict()
- assert result["sources_used"] == []
-
- def test_no_parent_context_used(self):
- """Create response without parent context usage."""
- response = FollowUpResponse(
- research_id="res-new",
- question="Fresh research",
- answer="New answer",
- sources_used=[],
- parent_context_used=False,
- reused_links_count=0,
- new_links_count=5,
- )
-
- assert response.parent_context_used is False
- assert response.reused_links_count == 0
-
- def test_all_reused_links(self):
- """Create response with all links reused from parent."""
- response = FollowUpResponse(
- research_id="res-reuse",
- question="Reuse question",
- answer="Reuse answer",
- sources_used=[{"title": "Reused", "url": "https://reused.com"}],
- parent_context_used=True,
- reused_links_count=10,
- new_links_count=0,
- )
-
- assert response.parent_context_used is True
- assert response.reused_links_count == 10
- assert response.new_links_count == 0
diff --git a/tests/followup_research/test_models_behavior.py b/tests/followup_research/test_models_behavior.py
index c37924f56c..ac76eeeec0 100644
--- a/tests/followup_research/test_models_behavior.py
+++ b/tests/followup_research/test_models_behavior.py
@@ -1,7 +1,7 @@
"""
Behavioral tests for followup_research models.
-Tests FollowUpRequest and FollowUpResponse dataclasses.
+Tests the FollowUpRequest dataclass.
"""
@@ -172,241 +172,6 @@ class TestFollowUpRequestToDict:
assert set(result.keys()) == expected_keys
-class TestFollowUpResponseInit:
- """Tests for FollowUpResponse initialization."""
-
- def test_requires_all_fields(self):
- """Requires all fields."""
- from local_deep_research.followup_research.models import (
- FollowUpResponse,
- )
-
- response = FollowUpResponse(
- research_id="res123",
- question="What about X?",
- answer="The answer is Y.",
- sources_used=[{"url": "https://example.com"}],
- parent_context_used=True,
- reused_links_count=3,
- new_links_count=2,
- )
- assert response.research_id == "res123"
- assert response.question == "What about X?"
- assert response.answer == "The answer is Y."
-
- def test_sources_used_is_list(self):
- """sources_used is a list."""
- from local_deep_research.followup_research.models import (
- FollowUpResponse,
- )
-
- response = FollowUpResponse(
- research_id="res123",
- question="Question",
- answer="Answer",
- sources_used=[{"url": "url1"}, {"url": "url2"}],
- parent_context_used=True,
- reused_links_count=1,
- new_links_count=1,
- )
- assert isinstance(response.sources_used, list)
- assert len(response.sources_used) == 2
-
- def test_parent_context_used_is_bool(self):
- """parent_context_used is boolean."""
- from local_deep_research.followup_research.models import (
- FollowUpResponse,
- )
-
- response = FollowUpResponse(
- research_id="res123",
- question="Question",
- answer="Answer",
- sources_used=[],
- parent_context_used=False,
- reused_links_count=0,
- new_links_count=0,
- )
- assert response.parent_context_used is False
-
- def test_link_counts_are_ints(self):
- """Link counts are integers."""
- from local_deep_research.followup_research.models import (
- FollowUpResponse,
- )
-
- response = FollowUpResponse(
- research_id="res123",
- question="Question",
- answer="Answer",
- sources_used=[],
- parent_context_used=True,
- reused_links_count=5,
- new_links_count=10,
- )
- assert response.reused_links_count == 5
- assert response.new_links_count == 10
-
-
-class TestFollowUpResponseToDict:
- """Tests for FollowUpResponse.to_dict method."""
-
- def test_returns_dict(self):
- """to_dict returns a dictionary."""
- from local_deep_research.followup_research.models import (
- FollowUpResponse,
- )
-
- response = FollowUpResponse(
- research_id="res123",
- question="Question",
- answer="Answer",
- sources_used=[],
- parent_context_used=True,
- reused_links_count=0,
- new_links_count=0,
- )
- result = response.to_dict()
- assert isinstance(result, dict)
-
- def test_includes_research_id(self):
- """Includes research_id in dict."""
- from local_deep_research.followup_research.models import (
- FollowUpResponse,
- )
-
- response = FollowUpResponse(
- research_id="res123",
- question="Question",
- answer="Answer",
- sources_used=[],
- parent_context_used=True,
- reused_links_count=0,
- new_links_count=0,
- )
- result = response.to_dict()
- assert result["research_id"] == "res123"
-
- def test_includes_question(self):
- """Includes question in dict."""
- from local_deep_research.followup_research.models import (
- FollowUpResponse,
- )
-
- response = FollowUpResponse(
- research_id="res123",
- question="What about X?",
- answer="Answer",
- sources_used=[],
- parent_context_used=True,
- reused_links_count=0,
- new_links_count=0,
- )
- result = response.to_dict()
- assert result["question"] == "What about X?"
-
- def test_includes_answer(self):
- """Includes answer in dict."""
- from local_deep_research.followup_research.models import (
- FollowUpResponse,
- )
-
- response = FollowUpResponse(
- research_id="res123",
- question="Question",
- answer="The detailed answer.",
- sources_used=[],
- parent_context_used=True,
- reused_links_count=0,
- new_links_count=0,
- )
- result = response.to_dict()
- assert result["answer"] == "The detailed answer."
-
- def test_includes_sources_used(self):
- """Includes sources_used in dict."""
- from local_deep_research.followup_research.models import (
- FollowUpResponse,
- )
-
- sources = [{"url": "url1", "title": "Source 1"}]
- response = FollowUpResponse(
- research_id="res123",
- question="Question",
- answer="Answer",
- sources_used=sources,
- parent_context_used=True,
- reused_links_count=1,
- new_links_count=0,
- )
- result = response.to_dict()
- assert result["sources_used"] == sources
-
- def test_includes_parent_context_used(self):
- """Includes parent_context_used in dict."""
- from local_deep_research.followup_research.models import (
- FollowUpResponse,
- )
-
- response = FollowUpResponse(
- research_id="res123",
- question="Question",
- answer="Answer",
- sources_used=[],
- parent_context_used=True,
- reused_links_count=0,
- new_links_count=0,
- )
- result = response.to_dict()
- assert result["parent_context_used"] is True
-
- def test_includes_link_counts(self):
- """Includes link counts in dict."""
- from local_deep_research.followup_research.models import (
- FollowUpResponse,
- )
-
- response = FollowUpResponse(
- research_id="res123",
- question="Question",
- answer="Answer",
- sources_used=[],
- parent_context_used=True,
- reused_links_count=5,
- new_links_count=10,
- )
- result = response.to_dict()
- assert result["reused_links_count"] == 5
- assert result["new_links_count"] == 10
-
- def test_dict_has_all_fields(self):
- """Dict has all expected fields."""
- from local_deep_research.followup_research.models import (
- FollowUpResponse,
- )
-
- response = FollowUpResponse(
- research_id="res123",
- question="Question",
- answer="Answer",
- sources_used=[],
- parent_context_used=True,
- reused_links_count=0,
- new_links_count=0,
- )
- result = response.to_dict()
- expected_keys = {
- "research_id",
- "question",
- "answer",
- "sources_used",
- "parent_context_used",
- "reused_links_count",
- "new_links_count",
- }
- assert set(result.keys()) == expected_keys
-
-
class TestFollowUpModelsDataclass:
"""Tests for dataclass behavior."""
@@ -418,16 +183,6 @@ class TestFollowUpModelsDataclass:
assert is_dataclass(FollowUpRequest)
- def test_response_is_dataclass(self):
- """FollowUpResponse is a dataclass."""
- from dataclasses import is_dataclass
-
- from local_deep_research.followup_research.models import (
- FollowUpResponse,
- )
-
- assert is_dataclass(FollowUpResponse)
-
def test_request_equality(self):
"""FollowUpRequest supports equality comparison."""
from local_deep_research.followup_research.models import FollowUpRequest
@@ -439,29 +194,3 @@ class TestFollowUpModelsDataclass:
parent_research_id="abc", question="Q", strategy="s"
)
assert req1 == req2
-
- def test_response_equality(self):
- """FollowUpResponse supports equality comparison."""
- from local_deep_research.followup_research.models import (
- FollowUpResponse,
- )
-
- resp1 = FollowUpResponse(
- research_id="r",
- question="Q",
- answer="A",
- sources_used=[],
- parent_context_used=True,
- reused_links_count=0,
- new_links_count=0,
- )
- resp2 = FollowUpResponse(
- research_id="r",
- question="Q",
- answer="A",
- sources_used=[],
- parent_context_used=True,
- reused_links_count=0,
- new_links_count=0,
- )
- assert resp1 == resp2