Skip to content

Commit 83310a1

Browse files
authored
Merge pull request microsoft#116 from microsoft/azd-semantickernel-marktayl
Finished name conversions
2 parents 357b4b9 + 530b90a commit 83310a1

File tree

8 files changed

+26
-30
lines changed

8 files changed

+26
-30
lines changed

src/backend/agents/base_agent.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Step,
2222
StepStatus,
2323
)
24+
from models.messages_kernel import AgentType
2425
from src.backend.event_utils import track_event_if_configured
2526

2627

@@ -76,7 +77,7 @@ async def handle_action_request(
7677
AssistantMessage(content=message.action, source="GroupChatManager"),
7778
UserMessage(
7879
content=f"{step.human_feedback}. Now make the function call",
79-
source="HumanAgent",
80+
source=AgentType.HUMAN.value,
8081
),
8182
]
8283
)

src/backend/agents/group_chat_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
Step,
2222
StepStatus,
2323
)
24-
24+
from models.messages_kernel import AgentType
2525
from src.backend.event_utils import track_event_if_configured
2626

2727

@@ -57,7 +57,7 @@ async def handle_input_task(
5757
user_id=self._user_id,
5858
plan_id="",
5959
content=f"{message.description}",
60-
source="HumanAgent",
60+
source=AgentType.HUMAN.value,
6161
step_id="",
6262
)
6363
)
@@ -68,7 +68,7 @@ async def handle_input_task(
6868
"session_id": message.session_id,
6969
"user_id": self._user_id,
7070
"content": message.description,
71-
"source": "HumanAgent",
71+
"source": AgentType.HUMAN.value,
7272
},
7373
)
7474

src/backend/agents/human.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
Step,
1414
)
1515
from src.backend.event_utils import track_event_if_configured
16+
from models.messages_kernel import AgentType
1617

1718

1819
@default_subscription
@@ -52,7 +53,7 @@ async def handle_step_feedback(
5253
user_id=self.user_id,
5354
plan_id=step.plan_id,
5455
content=f"Received feedback for step: {step.action}",
55-
source="HumanAgent",
56+
source=AgentType.HUMAN.value,
5657
step_id=message.step_id,
5758
)
5859
)
@@ -64,7 +65,7 @@ async def handle_step_feedback(
6465
"user_id": self.user_id,
6566
"plan_id": step.plan_id,
6667
"content": f"Received feedback for step: {step.action}",
67-
"source": "HumanAgent",
68+
"source": AgentType.HUMAN.value,
6869
"step_id": message.step_id,
6970
},
7071
)

src/backend/agents/planner.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
StepStatus,
2626
HumanFeedbackStatus,
2727
)
28-
28+
from models.messages_kernel import AgentType
2929
from src.backend.event_utils import track_event_if_configured
3030

3131

@@ -133,7 +133,7 @@ async def handle_plan_clarification(
133133
user_id=self._user_id,
134134
plan_id="",
135135
content=f"{message.human_clarification}",
136-
source="HumanAgent",
136+
source=AgentType.HUMAN.value,
137137
step_id="",
138138
)
139139
)
@@ -144,7 +144,7 @@ async def handle_plan_clarification(
144144
"session_id": message.session_id,
145145
"user_id": self._user_id,
146146
"content": f"{message.human_clarification}",
147-
"source": "HumanAgent",
147+
"source": AgentType.HUMAN.value,
148148
},
149149
)
150150

src/backend/app_kernel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ async def approve_step_endpoint(
413413
agents = await get_agents(human_feedback.session_id, user_id)
414414

415415
# Send the approval to the group chat manager
416-
group_chat_manager = agents["GroupChatManager"]
416+
group_chat_manager = agents[AgentType.GROUP_CHAT_MANAGER.value]
417417

418418
# Handle the approval
419419
human_feedback_json = human_feedback.json()

src/backend/models/messages.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@
22
from enum import Enum
33
from typing import Literal, Optional
44

5-
from autogen_core.components.models import (
6-
AssistantMessage,
7-
FunctionExecutionResultMessage,
8-
LLMMessage,
9-
SystemMessage,
10-
UserMessage,
11-
)
5+
from .messages_kernel import AgentType
126
from pydantic import BaseModel, Field
137

148

@@ -23,15 +17,15 @@ class DataType(str, Enum):
2317
class BAgentType(str, Enum):
2418
"""Enumeration of agent types."""
2519

26-
human_agent = "HumanAgent"
27-
hr_agent = "HrAgent"
28-
marketing_agent = "MarketingAgent"
29-
procurement_agent = "ProcurementAgent"
30-
product_agent = "ProductAgent"
31-
generic_agent = "GenericAgent"
32-
tech_support_agent = "TechSupportAgent"
33-
group_chat_manager = "GroupChatManager"
34-
planner_agent = "PlannerAgent"
20+
AgentType.HUMAN.value = "HumanAgent"
21+
AgentType.HR.value = "HrAgent"
22+
AgentType.MARKETING.value = "MarketingAgent"
23+
AgentType.PROCUREMENT.value = "ProcurementAgent"
24+
AgentType.PRODUCT.value = "ProductAgent"
25+
AgentType.GENERIC.value = "GenericAgent"
26+
AgentType.TECH_SUPPORT.value = "TechSupportAgent"
27+
AgentType.GROUP_CHAT_MANAGER.value = "GroupChatManager"
28+
AgentType.PLANNER.value = "PlannerAgent"
3529

3630
# Add other agents as needed
3731

src/backend/tests/test_group_chat_manager_integration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ async def initialize_group_chat_manager(self):
222222

223223
# Create agent dictionary for the group chat manager
224224
available_agents = {
225-
"PlannerAgent": planner_agent,
226-
"HumanAgent": human_agent,
227-
"GenericAgent": generic_agent
225+
"planner_agent": planner_agent,
226+
"human_agent": human_agent,
227+
"generic_agent": generic_agent
228228
}
229229

230230
# Create the group chat manager

src/backend/utils_kernel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ async def get_agents(session_id: str, user_id: str) -> Dict[str, Any]:
9595
}
9696

9797
# Convert to the agent name dictionary format used by the rest of the app
98-
agents = {agent_classes[agent_type]: agent for agent_type, agent in raw_agents.items()}
98+
agents = {agent_type.value: agent for agent_type, agent in raw_agents.items()}
9999

100100
# Cache the agents
101101
agent_instances[cache_key] = agents

0 commit comments

Comments
 (0)