@@ -168,7 +168,7 @@ async def handle_human_feedback(self, human_feedback: HumanFeedback) -> str:
168168
169169 return "Human feedback processed successfully"
170170
171- async def provide_clarification (
171+ async def handle_human_clarification (
172172 self , human_clarification : HumanClarification
173173 ) -> str :
174174 """Provide clarification on a plan.
@@ -179,13 +179,13 @@ async def provide_clarification(
179179
180180 Args:
181181 human_clarification: The HumanClarification object containing the session_id
182- and clarification_text provided by the human user
182+ and human_clarification provided by the human user
183183
184184 Returns:
185185 Status message indicating success or failure of adding the clarification
186186 """
187187 session_id = human_clarification .session_id
188- clarification_text = human_clarification .clarification_text
188+ clarification_text = human_clarification .human_clarification
189189
190190 # Get the plan associated with this session
191191 plan = await self ._memory_store .get_plan_by_session (session_id )
@@ -195,7 +195,16 @@ async def provide_clarification(
195195 # Update the plan with the clarification
196196 plan .human_clarification_response = clarification_text
197197 await self ._memory_store .update_plan (plan )
198-
198+ await self ._memory_store .add_item (
199+ AgentMessage (
200+ session_id = session_id ,
201+ user_id = self ._user_id ,
202+ plan_id = "" ,
203+ content = f"{ clarification_text } " ,
204+ source = AgentType .HUMAN .value ,
205+ step_id = "" ,
206+ )
207+ )
199208 # Track the event
200209 track_event_if_configured (
201210 "Human Agent - Provided clarification for plan" ,
@@ -204,7 +213,26 @@ async def provide_clarification(
204213 "user_id" : self ._user_id ,
205214 "plan_id" : plan .id ,
206215 "clarification" : clarification_text ,
216+ "source" : AgentType .HUMAN .value ,
217+ },
218+ )
219+ await self ._memory_store .add_item (
220+ AgentMessage (
221+ session_id = session_id ,
222+ user_id = self ._user_id ,
223+ plan_id = "" ,
224+ content = "Thanks. The plan has been updated." ,
225+ source = AgentType .PLANNER .value ,
226+ step_id = "" ,
227+ )
228+ )
229+ track_event_if_configured (
230+ "Planner - Updated with HumanClarification and added into the cosmos" ,
231+ {
232+ "session_id" : session_id ,
233+ "user_id" : self ._user_id ,
234+ "content" : "Thanks. The plan has been updated." ,
235+ "source" : AgentType .PLANNER .value ,
207236 },
208237 )
209-
210238 return f"Clarification provided for plan { plan .id } "
0 commit comments