Skip to content

Commit

Permalink
feat(agent): Make the AutoPlanChatManager customizable for planner
Browse files Browse the repository at this point in the history
  • Loading branch information
dongzhancai1 committed Jan 10, 2025
1 parent 523ad32 commit d03637c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions dbgpt/agent/core/plan/team_auto_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import logging
from typing import Dict, List, Optional, Tuple

from pydantic import Field

from dbgpt.core.interface.message import ModelMessageRoleType

from ..action.base import ActionOutput
Expand All @@ -21,6 +23,11 @@
class AutoPlanChatManager(ManagerAgent):
"""A chat manager agent that can manage a team chat of multiple agents."""

planner_agent_class: PlannerAgent = Field(
default=PlannerAgent,
description="The class to use for creating the planner agent. "
"Defaults to PlannerAgent.",
)
profile: ProfileConfig = ProfileConfig(
name=DynConfig(
"AutoPlanChatManager",
Expand All @@ -46,9 +53,12 @@ class AutoPlanChatManager(ManagerAgent):
),
)

def __init__(self, **kwargs):
def __init__(self, planner_agent_class=None, **kwargs):
"""Create a new AutoPlanChatManager instance."""
super().__init__(**kwargs)
self.planner_agent_class = (
planner_agent_class or PlannerAgent
) # use PlannerAgent by default

async def process_rely_message(
self, conv_id: str, now_plan: GptsPlan, speaker: Agent
Expand Down Expand Up @@ -187,7 +197,7 @@ async def act(
"resources still fails to build a valid plan!",
)
planner: ConversableAgent = (
await PlannerAgent()
await self.planner_agent_class()
.bind(self.memory)
.bind(self.agent_context)
.bind(self.llm_config)
Expand Down

0 comments on commit d03637c

Please sign in to comment.