Coverage for src / local_deep_research / followup_research / models.py: 95%

22 statements  

« prev     ^ index     » next       coverage.py v7.12.0, created at 2026-01-11 00:51 +0000

1""" 

2Data models for follow-up research functionality. 

3""" 

4 

5from dataclasses import dataclass 

6from typing import List, Dict, Any 

7 

8 

9@dataclass 

10class FollowUpRequest: 

11 """Request model for follow-up research.""" 

12 

13 parent_research_id: str 

14 question: str 

15 strategy: str = "source-based" # Default delegate strategy 

16 max_iterations: int = 1 # Quick summary by default 

17 questions_per_iteration: int = 3 

18 

19 def to_dict(self) -> Dict[str, Any]: 

20 """Convert to dictionary for API/service use.""" 

21 return { 

22 "parent_research_id": self.parent_research_id, 

23 "question": self.question, 

24 "strategy": self.strategy, 

25 "max_iterations": self.max_iterations, 

26 "questions_per_iteration": self.questions_per_iteration, 

27 } 

28 

29 

30@dataclass 

31class FollowUpResponse: 

32 """Response model for follow-up research.""" 

33 

34 research_id: str 

35 question: str 

36 answer: str 

37 sources_used: List[Dict[str, str]] 

38 parent_context_used: bool 

39 reused_links_count: int 

40 new_links_count: int 

41 

42 def to_dict(self) -> Dict[str, Any]: 

43 """Convert to dictionary for API response.""" 

44 return { 

45 "research_id": self.research_id, 

46 "question": self.question, 

47 "answer": self.answer, 

48 "sources_used": self.sources_used, 

49 "parent_context_used": self.parent_context_used, 

50 "reused_links_count": self.reused_links_count, 

51 "new_links_count": self.new_links_count, 

52 }