Coverage for src / local_deep_research / advanced_search_system / questions / followup / llm_followup_question.py: 0%
11 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"""
2LLM-based follow-up question generator.
4This implementation uses an LLM to intelligently reformulate follow-up
5questions based on the previous research context.
6"""
8from typing import Dict, List
9from loguru import logger
10from .base_followup_question import BaseFollowUpQuestionGenerator
13class LLMFollowUpQuestionGenerator(BaseFollowUpQuestionGenerator):
14 """
15 LLM-based follow-up question generator.
17 This generator uses an LLM to reformulate follow-up questions
18 based on the previous research context, creating more targeted
19 and effective search queries.
21 NOTE: This is a placeholder for future implementation.
22 Currently falls back to simple concatenation.
23 """
25 def generate_contextualized_query(
26 self,
27 follow_up_query: str,
28 original_query: str,
29 past_findings: str,
30 **kwargs,
31 ) -> str:
32 """
33 Generate a contextualized query using LLM reformulation.
35 Future implementation will:
36 1. Analyze the follow-up query in context of past findings
37 2. Identify information gaps
38 3. Reformulate for more effective searching
39 4. Generate multiple targeted search questions
41 Args:
42 follow_up_query: The user's follow-up question
43 original_query: The original research query
44 past_findings: The findings from previous research
45 **kwargs: Additional context parameters
47 Returns:
48 str: An LLM-reformulated contextualized query
49 """
50 # TODO: Implement LLM-based reformulation
51 # For now, fall back to simple concatenation
52 logger.warning(
53 "LLM-based follow-up question generation not yet implemented, "
54 "falling back to simple concatenation"
55 )
57 from .simple_followup_question import SimpleFollowUpQuestionGenerator
59 simple_generator = SimpleFollowUpQuestionGenerator(self.model)
60 return simple_generator.generate_contextualized_query(
61 follow_up_query, original_query, past_findings, **kwargs
62 )
64 def generate_questions(
65 self,
66 current_knowledge: str,
67 query: str,
68 questions_per_iteration: int,
69 questions_by_iteration: Dict[int, List[str]],
70 ) -> List[str]:
71 """
72 Generate multiple targeted questions for follow-up research.
74 Future implementation will generate multiple specific questions
75 based on the follow-up query and context.
77 Args:
78 current_knowledge: The accumulated knowledge so far
79 query: The research query
80 questions_per_iteration: Number of questions to generate
81 questions_by_iteration: Previous questions
83 Returns:
84 List[str]: List of targeted follow-up questions
85 """
86 # TODO: Implement multi-question generation
87 # For now, return single contextualized query
88 return super().generate_questions(
89 current_knowledge,
90 query,
91 questions_per_iteration,
92 questions_by_iteration,
93 )