Files
autoMate/agent/plan_agent.py
yuruo 27e0b7e31c new
2024-02-19 17:11:51 +08:00

27 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import logging
from agent.agent_base import AgentBase
from tools.tool_base import ToolBase
from tools.tools_factory import ToolsFactory
from work_principle.okr_principle import OKR_Object
class PlanAgent(AgentBase):
def __init__(self):
self.logger = logging.getLogger(__name__)
super().__init__('#Goals:\n你是一名计划拆解者将object拆解成key_result\n#Workflow:1.')
'''
'''
# '多个key_result完成这一个目标返回格式如下{"tools_name":"web_browser","request_param":"请求参数"}'
# 根据object和已有的工具能力拆解成key resultkey
def aligning(self, okr_object: OKR_Object):
raw = okr_object.raw_user_task
r = self.call_gpt(f"object为'{raw}' 工具列表为{list(ToolsFactory().get_tools())}")
self.logger.info(f"promptobject为'{raw}' 工具列表为{list(ToolsFactory().get_tools())}")
self.logger.info(f"Alignment result: {r}")
# return r
def get_subclasses(self, cls):
subclasses = []
for subclass in cls.__subclasses__():
subclasses.append(subclass)
return subclasses