mirror of
https://github.com/yuruotong1/autoMate.git
synced 2025-12-26 05:16:21 +08:00
new
This commit is contained in:
parent
b352a14172
commit
f99ab9ed43
@ -6,15 +6,16 @@ from work_principle.okr_principle import OKR_Object
|
||||
class PlanAgent(AgentBase):
|
||||
def __init__(self):
|
||||
self.logger = logging.getLogger(__name__)
|
||||
super().__init__('你是一名计划拆解者,利用工具将object拆解成key_result,请你返回json格式的内容,比如[{"tools_name":"web_browser","param":"工具a"}]')
|
||||
super().__init__('你是一名计划拆解者,挑选工具列表中合适的工具将object拆解成key_result然后自动填充参数,建议拆解成多个key_result,' +
|
||||
'多个key_result完成这一个目标,返回格式如下:[{"tools_name":"web_browser","request_param":"请求参数"}]')
|
||||
|
||||
# 根据object和已有的工具能力拆解成key result,key
|
||||
def aligning(self, okr_object: OKR_Object):
|
||||
raw = okr_object.raw_user_task
|
||||
tools_list = [i().get_info() for i in self.get_subclasses(ToolsBase)]
|
||||
r = self.call_gpt(f"object为'{raw}', 工具列表为{tools_list}")
|
||||
print(r)
|
||||
self.logger.info(f"Alignment result: {r}")
|
||||
# return r
|
||||
|
||||
def get_subclasses(self, cls):
|
||||
subclasses = []
|
||||
|
||||
2
main.py
2
main.py
@ -16,7 +16,7 @@ class AutoMate:
|
||||
while True:
|
||||
o_kr = OKR_Object("因为想要增加编程效率,对比一下copilot和curson谁更好用,比较提示词数量、安装易用性,给出不少于100字的文章")
|
||||
ManagerAgent().optimization_Object(o_kr)
|
||||
r = input(f"最终对齐的任务是:{o_kr.raw_user_task},一切都OK对吧?y/n")
|
||||
r = input(f"最终对齐的任务是:{o_kr.raw_user_task},一切都OK对吧?y/n\n")
|
||||
if r == "y":
|
||||
break
|
||||
|
||||
|
||||
5
pytest.ini
Normal file
5
pytest.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[pytest]
|
||||
log_cli = True
|
||||
log_cli_level = info
|
||||
log_cli_format = %(asctime)s [%(levelname)s] | %(filename)s:%(lineno)s | %(message)s
|
||||
log_cli_date_format = %Y-%m-%d %H:%M:%S
|
||||
3
tests/pytest.in
Normal file
3
tests/pytest.in
Normal file
@ -0,0 +1,3 @@
|
||||
[pytest]
|
||||
log_cli = True
|
||||
log_cli_level = info
|
||||
15
tests/test_plan_agent.py
Normal file
15
tests/test_plan_agent.py
Normal file
@ -0,0 +1,15 @@
|
||||
import unittest
|
||||
|
||||
from agent.plan_agent import PlanAgent
|
||||
from work_principle.okr_principle import OKR_Object
|
||||
class TestPlanAgent(unittest.TestCase):
|
||||
def test_aligning(self):
|
||||
# Create an instance of the PlanAgent class
|
||||
plan_agent = PlanAgent()
|
||||
# Create a mock OKR_Object with a raw_user_task
|
||||
okr_object = OKR_Object("因为想要增加编程效率,对比一下copilot和curson谁更好用,比较提示词数量、安装易用性,给出不少于100字的文")
|
||||
# Call the aligning method
|
||||
plan_agent.aligning(okr_object)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
3
tools/init.py
Normal file
3
tools/init.py
Normal file
@ -0,0 +1,3 @@
|
||||
from llm_tools import LLMTools
|
||||
from web_browser_element_tools import WebBrowserElement
|
||||
from web_browser_url_tools import WebBrowserUrl
|
||||
Loading…
x
Reference in New Issue
Block a user