From 47430f2a0ba7fc55121a9328767b16c07bab9205 Mon Sep 17 00:00:00 2001 From: Fangyin Cheng Date: Wed, 22 May 2024 15:38:49 +0800 Subject: [PATCH] fix(agent): Remove resources of planner agent (#1540) --- dbgpt/agent/core/plan/planner_agent.py | 11 ++++++++++- dbgpt/serve/agent/agents/controller.py | 12 ++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/dbgpt/agent/core/plan/planner_agent.py b/dbgpt/agent/core/plan/planner_agent.py index 4177e36b0..3a73be382 100644 --- a/dbgpt/agent/core/plan/planner_agent.py +++ b/dbgpt/agent/core/plan/planner_agent.py @@ -1,6 +1,6 @@ """Planner Agent.""" -from typing import Any, Dict, List +from typing import Any, Dict, List, Optional from dbgpt._private.pydantic import Field @@ -160,6 +160,15 @@ def bind_agents(self, agents: List[ConversableAgent]) -> ConversableAgent: self.resource = ResourcePack(resources) return self + async def generate_resource_variables( + self, question: Optional[str] = None + ) -> Dict[str, Any]: + """Generate the resource variables.""" + out_schema: Optional[str] = None + if self.actions and len(self.actions) > 0: + out_schema = self.actions[0].ai_out_schema + return {"out_schema": out_schema} + def prepare_act_param(self) -> Dict[str, Any]: """Prepare the parameters for the act method.""" return { diff --git a/dbgpt/serve/agent/agents/controller.py b/dbgpt/serve/agent/agents/controller.py index a72517fd2..88809d46f 100644 --- a/dbgpt/serve/agent/agents/controller.py +++ b/dbgpt/serve/agent/agents/controller.py @@ -291,21 +291,13 @@ async def agent_team_chat_new( else: raise ValueError(f"Unknown Agent Team Mode!{team_mode}") manager = ( - await manager.bind(context) - .bind(llm_config) - .bind(depend_resource) - .bind(agent_memory) - .build() + await manager.bind(context).bind(llm_config).bind(agent_memory).build() ) manager.hire(employees) recipient = manager user_proxy: UserProxyAgent = ( - await UserProxyAgent() - .bind(context) - .bind(depend_resource) - .bind(agent_memory) - .build() + await UserProxyAgent().bind(context).bind(agent_memory).build() ) if is_retry_chat: # retry chat