Coverage for src / local_deep_research / advanced_search_system / questions / base_question.py: 42%
15 statements
« prev ^ index » next coverage.py v7.12.0, created at 2026-01-11 00:51 +0000
« prev ^ index » next coverage.py v7.12.0, created at 2026-01-11 00:51 +0000
1"""
2Base class for all question generators.
3Defines the common interface and shared functionality for different question generation approaches.
4"""
6from abc import ABC, abstractmethod
7from typing import Dict, List
10class BaseQuestionGenerator(ABC):
11 """Abstract base class for all question generators."""
13 def __init__(self, model):
14 """
15 Initialize the question generator.
17 Args:
18 model: The language model to use for question generation
19 """
20 self.model = model
22 @abstractmethod
23 def generate_questions(
24 self,
25 current_knowledge: str,
26 query: str,
27 questions_per_iteration: int,
28 questions_by_iteration: Dict[int, List[str]],
29 ) -> List[str]:
30 """
31 Generate questions based on the current state of research.
33 Args:
34 current_knowledge: The accumulated knowledge so far
35 query: The original research query
36 questions_per_iteration: Number of questions to generate per iteration
37 questions_by_iteration: Questions generated in previous iterations
39 Returns:
40 List[str]: Generated questions
41 """
42 pass
44 def _format_previous_questions(
45 self, questions_by_iteration: Dict[int, List[str]]
46 ) -> str:
47 """
48 Format previous questions for context.
50 Args:
51 questions_by_iteration: Questions generated in previous iterations
53 Returns:
54 str: Formatted string of previous questions
55 """
56 formatted = []
57 for iteration, questions in questions_by_iteration.items():
58 formatted.append(f"Iteration {iteration}:")
59 for q in questions:
60 formatted.append(f"- {q}")
61 return "\n".join(formatted)