Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(agent): Make the AutoPlanChatManager customizable for planner #2296

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading