Skip to content

Commit 3dc5394

Browse files
committed
Refactor agent model config and remove unused agent code
Replaced environment variable usage with config value for model deployment name in json_service.py. Removed unused agent imports and the get_agents function from utils_kernel.py to clean up code and dependencies.
1 parent 92a0673 commit 3dc5394

File tree

2 files changed

+1
-62
lines changed

2 files changed

+1
-62
lines changed

src/backend/common/services/json_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ async def validate_team_models(
424424
required_models.update(team_level_models)
425425

426426
if not required_models:
427-
default_model = os.getenv("AZURE_AI_MODEL_DEPLOYMENT_NAME", "gpt-4o")
427+
default_model = config.AZURE_OPENAI_DEPLOYMENT_NAME
428428
required_models.add(default_model.lower())
429429

430430
missing_models: List[str] = []

src/backend/common/utils/utils_kernel.py

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,6 @@
1313
from common.auth.azure_credential_utils import get_azure_credential
1414

1515
# Import agent factory and the new AppConfig
16-
from kernel_agents.agent_factory import AgentFactory
17-
from kernel_agents.group_chat_manager import GroupChatManager
18-
from kernel_agents.hr_agent import HrAgent
19-
from kernel_agents.human_agent import HumanAgent
20-
from kernel_agents.marketing_agent import MarketingAgent
21-
from kernel_agents.planner_agent import PlannerAgent
22-
from kernel_agents.procurement_agent import ProcurementAgent
23-
from kernel_agents.product_agent import ProductAgent
24-
from kernel_agents.tech_support_agent import TechSupportAgent
25-
from common.models.messages_kernel import AgentType
2616
from semantic_kernel.agents.azure_ai.azure_ai_agent import AzureAIAgent
2717

2818
logging.basicConfig(level=logging.INFO)
@@ -32,57 +22,6 @@
3222
azure_agent_instances: Dict[str, Dict[str, AzureAIAgent]] = {}
3323

3424

35-
async def get_agents(session_id: str, user_id: str) -> Dict[str, Any]:
36-
"""
37-
Get or create agent instances for a session.
38-
39-
Args:
40-
session_id: The session identifier
41-
user_id: The user identifier
42-
43-
Returns:
44-
Dictionary of agent instances mapped by their names
45-
"""
46-
cache_key = f"{session_id}_{user_id}"
47-
48-
if cache_key in agent_instances:
49-
return agent_instances[cache_key]
50-
51-
try:
52-
# Create all agents for this session using the factory
53-
raw_agents = await AgentFactory.create_all_agents(
54-
session_id=session_id,
55-
user_id=user_id,
56-
temperature=0.0, # Default temperature
57-
)
58-
59-
# Get mapping of agent types to class names
60-
agent_classes = {
61-
AgentType.HR: HrAgent.__name__,
62-
AgentType.PRODUCT: ProductAgent.__name__,
63-
AgentType.MARKETING: MarketingAgent.__name__,
64-
AgentType.PROCUREMENT: ProcurementAgent.__name__,
65-
AgentType.TECH_SUPPORT: TechSupportAgent.__name__,
66-
AgentType.GENERIC: TechSupportAgent.__name__,
67-
AgentType.HUMAN: HumanAgent.__name__,
68-
AgentType.PLANNER: PlannerAgent.__name__,
69-
AgentType.GROUP_CHAT_MANAGER: GroupChatManager.__name__,
70-
}
71-
72-
# Convert to the agent name dictionary format used by the rest of the app
73-
agents = {
74-
agent_classes[agent_type]: agent for agent_type, agent in raw_agents.items()
75-
}
76-
77-
# Cache the agents
78-
agent_instances[cache_key] = agents
79-
80-
return agents
81-
except Exception as e:
82-
logging.error(f"Error creating agents: {str(e)}")
83-
raise
84-
85-
8625
async def rai_success(description: str, is_task_creation: bool) -> bool:
8726
"""
8827
Checks if a description passes the RAI (Responsible AI) check.

0 commit comments

Comments
 (0)