Skip to content

Commit 69860ac

Browse files
authored
Merge pull request #157 from Fr4nc3/main
fix: missing context
2 parents ce6b819 + 678475b commit 69860ac

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

src/backend/kernel_agents/agent_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ async def handle_action_request(self, action_request: ActionRequest) -> str:
161161
# thread=step.session_id
162162
# ) # AzureAIAgentThread(thread_id=step.session_id)
163163
async_generator = self._agent.invoke(
164-
messages=f"{action_request.action}\n\nPlease perform this action",
164+
messages=f"{str(self._chat_history)}\n\nPlease perform this action",
165165
thread=thread,
166166
)
167167

src/backend/kernel_agents/group_chat_manager.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class Step(BaseDataModel):
198198
)
199199
if plan.human_clarification_response:
200200
received_human_feedback_on_plan = (
201-
plan.human_clarification_response
201+
f"{plan.human_clarification_request}: {plan.human_clarification_response}"
202202
+ " This information may or may not be relevant to the step you are executing - it was feedback provided by the human user on the overall plan, which includes multiple steps, not just the one you are actioning now."
203203
)
204204
else:
@@ -313,6 +313,12 @@ async def _execute_step(self, session_id: str, step: Step):
313313
formatted_string = ""
314314
formatted_string += "<conversation_history>Here is the conversation history so far for the current plan. This information may or may not be relevant to the step you have been asked to execute."
315315
formatted_string += f"The user's task was:\n{plan.summary}\n\n"
316+
formatted_string += (
317+
f" human_clarification_request:\n{plan.human_clarification_request}\n\n"
318+
)
319+
formatted_string += (
320+
f" human_clarification_response:\n{plan.human_clarification_response}\n\n"
321+
)
316322
formatted_string += (
317323
"The conversation between the previous agents so far is below:\n"
318324
)
@@ -323,7 +329,7 @@ async def _execute_step(self, session_id: str, step: Step):
323329
break
324330
formatted_string += f"Step {i}\n"
325331
formatted_string += f"{AgentType.GROUP_CHAT_MANAGER.value}: {step.action}\n"
326-
formatted_string += f"{step.agent.name}: {step.agent_reply}\n"
332+
formatted_string += f"{step.agent.value}: {step.agent_reply}\n"
327333
formatted_string += "<conversation_history \\>"
328334

329335
logging.info(f"Formatted string: {formatted_string}")

src/backend/kernel_agents/planner_agent.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ async def handle_input_task(self, input_task: InputTask) -> str:
181181
user_id=self._user_id,
182182
plan_id=plan.id,
183183
content=f"Generated a plan with {len(steps)} steps. Click the blue check box beside each step to complete it, click the x to remove this step.",
184-
source="PlannerAgent",
184+
source=AgentType.PLANNER.value,
185185
step_id="",
186186
)
187187
)
@@ -193,7 +193,7 @@ async def handle_input_task(self, input_task: InputTask) -> str:
193193
"user_id": self._user_id,
194194
"plan_id": plan.id,
195195
"content": f"Generated a plan with {len(steps)} steps. Click the blue check box beside each step to complete it, click the x to remove this step.",
196-
"source": "PlannerAgent",
196+
"source": AgentType.PLANNER.value,
197197
},
198198
)
199199

@@ -208,7 +208,7 @@ async def handle_input_task(self, input_task: InputTask) -> str:
208208
user_id=self._user_id,
209209
plan_id=plan.id,
210210
content=f"I require additional information before we can proceed: {plan.human_clarification_request}",
211-
source="PlannerAgent",
211+
source=AgentType.PLANNER.value,
212212
step_id="",
213213
)
214214
)
@@ -220,7 +220,7 @@ async def handle_input_task(self, input_task: InputTask) -> str:
220220
"user_id": self._user_id,
221221
"plan_id": plan.id,
222222
"content": f"I require additional information before we can proceed: {plan.human_clarification_request}",
223-
"source": "PlannerAgent",
223+
"source": AgentType.PLANNER.value,
224224
},
225225
)
226226

@@ -275,7 +275,7 @@ async def handle_plan_clarification(self, kernel_arguments: KernelArguments) ->
275275
user_id=self._user_id,
276276
plan_id="",
277277
content="Thanks. The plan has been updated.",
278-
source="PlannerAgent",
278+
source=AgentType.PLANNER.value,
279279
step_id="",
280280
)
281281
)
@@ -286,7 +286,7 @@ async def handle_plan_clarification(self, kernel_arguments: KernelArguments) ->
286286
"session_id": session_id,
287287
"user_id": self._user_id,
288288
"content": "Thanks. The plan has been updated.",
289-
"source": "PlannerAgent",
289+
"source": AgentType.PLANNER.value,
290290
},
291291
)
292292

@@ -508,7 +508,7 @@ async def _create_structured_plan(
508508
"user_id": self._user_id,
509509
"error": str(e),
510510
"description": input_task.description,
511-
"source": "PlannerAgent",
511+
"source": AgentType.PLANNER.value,
512512
},
513513
)
514514
except Exception as event_error:

0 commit comments

Comments
 (0)