@@ -47,28 +47,20 @@ def plan(self, query: str, context: List[Dict[str, Any]] = None) -> str:
4747 logger .info (f"\n 🎯 Planning step for query: { query } " )
4848
4949 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.
5751
52+ Context: {context}
5853 Query: {query}
5954
60- Plan :"""
55+ Steps :"""
6156 context_str = "\n \n " .join ([f"Context { i + 1 } :\n { item ['content' ]} " for i , item in enumerate (context )])
6257 logger .info (f"Using context ({ len (context )} items)" )
6358 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.
6860
6961 Query: {query}
7062
71- Plan :"""
63+ Steps :"""
7264 context_str = ""
7365 logger .info ("No context available" )
7466
@@ -109,15 +101,10 @@ def research(self, query: str, step: str) -> List[Dict[str, Any]]:
109101 logger .warning ("No relevant documents found" )
110102 return []
111103
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.
116105
117106 Step: {step}
118-
119- Context:
120- {context}
107+ Context: {context}
121108
122109 Key Findings:"""
123110
@@ -145,19 +132,13 @@ def __init__(self, llm):
145132 def reason (self , query : str , step : str , context : List [Dict [str , Any ]]) -> str :
146133 logger .info (f"\n 🤔 Reasoning about step: { step } " )
147134
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.
152136
153137 Step: {step}
154-
155- Context:
156- {context}
157-
138+ Context: {context}
158139 Query: {query}
159140
160- Reasoning :"""
141+ Conclusion :"""
161142
162143 context_str = "\n \n " .join ([f"Context { i + 1 } :\n { item ['content' ]} " for i , item in enumerate (context )])
163144 prompt = ChatPromptTemplate .from_template (template )
@@ -182,17 +163,12 @@ def __init__(self, llm):
182163 def synthesize (self , query : str , reasoning_steps : List [str ]) -> str :
183164 logger .info (f"\n 📝 Synthesizing final answer from { len (reasoning_steps )} reasoning steps" )
184165
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.
189167
190168 Query: {query}
169+ Steps: {steps}
191170
192- Reasoning Steps:
193- {steps}
194-
195- Final Answer:"""
171+ Answer:"""
196172
197173 steps_str = "\n \n " .join ([f"Step { i + 1 } :\n { step } " for i , step in enumerate (reasoning_steps )])
198174 prompt = ChatPromptTemplate .from_template (template )
0 commit comments