@@ -47,28 +47,20 @@ def plan(self, query: str, context: List[Dict[str, Any]] = None) -> str:
47
47
logger .info (f"\n 🎯 Planning step for query: { query } " )
48
48
49
49
if context :
50
- template = """You are a strategic planning agent. Your role is to break down complex problems into clear, manageable steps.
51
-
52
- Given the following context and query, create a step-by-step plan to answer the question.
53
- Each step should be clear and actionable.
54
-
55
- Context:
56
- {context}
50
+ template = """As a strategic planner, break down this problem into 3-4 clear steps.
57
51
52
+ Context: {context}
58
53
Query: {query}
59
54
60
- Plan :"""
55
+ Steps :"""
61
56
context_str = "\n \n " .join ([f"Context { i + 1 } :\n { item ['content' ]} " for i , item in enumerate (context )])
62
57
logger .info (f"Using context ({ len (context )} items)" )
63
58
else :
64
- template = """You are a strategic planning agent. Your role is to break down complex problems into clear, manageable steps.
65
-
66
- Given the following query, create a step-by-step plan to answer the question.
67
- Each step should be clear and actionable.
59
+ template = """As a strategic planner, break down this problem into 3-4 clear steps.
68
60
69
61
Query: {query}
70
62
71
- Plan :"""
63
+ Steps :"""
72
64
context_str = ""
73
65
logger .info ("No context available" )
74
66
@@ -109,15 +101,10 @@ def research(self, query: str, step: str) -> List[Dict[str, Any]]:
109
101
logger .warning ("No relevant documents found" )
110
102
return []
111
103
112
- # Have LLM analyze and summarize findings
113
- template = """You are a research agent. Your role is to analyze information and extract relevant details.
114
-
115
- Given the following research step and context, summarize the key findings that are relevant to this step.
104
+ template = """Extract and summarize key information relevant to this step.
116
105
117
106
Step: {step}
118
-
119
- Context:
120
- {context}
107
+ Context: {context}
121
108
122
109
Key Findings:"""
123
110
@@ -145,19 +132,13 @@ def __init__(self, llm):
145
132
def reason (self , query : str , step : str , context : List [Dict [str , Any ]]) -> str :
146
133
logger .info (f"\n 🤔 Reasoning about step: { step } " )
147
134
148
- template = """You are a reasoning agent. Your role is to apply logical analysis to information and draw conclusions.
149
-
150
- Given the following step, context, and query, apply logical reasoning to reach a conclusion.
151
- Show your reasoning process clearly.
135
+ template = """Analyze the information and draw a clear conclusion for this step.
152
136
153
137
Step: {step}
154
-
155
- Context:
156
- {context}
157
-
138
+ Context: {context}
158
139
Query: {query}
159
140
160
- Reasoning :"""
141
+ Conclusion :"""
161
142
162
143
context_str = "\n \n " .join ([f"Context { i + 1 } :\n { item ['content' ]} " for i , item in enumerate (context )])
163
144
prompt = ChatPromptTemplate .from_template (template )
@@ -182,17 +163,12 @@ def __init__(self, llm):
182
163
def synthesize (self , query : str , reasoning_steps : List [str ]) -> str :
183
164
logger .info (f"\n 📝 Synthesizing final answer from { len (reasoning_steps )} reasoning steps" )
184
165
185
- template = """You are a synthesis agent. Your role is to combine multiple pieces of information into a clear, coherent response.
186
-
187
- Given the following query and reasoning steps, create a final comprehensive answer.
188
- The answer should be well-structured and incorporate the key points from each step.
166
+ template = """Combine the reasoning steps into a clear, comprehensive answer.
189
167
190
168
Query: {query}
169
+ Steps: {steps}
191
170
192
- Reasoning Steps:
193
- {steps}
194
-
195
- Final Answer:"""
171
+ Answer:"""
196
172
197
173
steps_str = "\n \n " .join ([f"Step { i + 1 } :\n { step } " for i , step in enumerate (reasoning_steps )])
198
174
prompt = ChatPromptTemplate .from_template (template )
0 commit comments