-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgui_agent.py
50 lines (41 loc) · 1.72 KB
/
gui_agent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import os
import logging
import sys
from camel.agents.chat_agent import ChatAgent
from camel.messages.base import BaseMessage
from camel.models import ModelFactory
# from camel.societies.workforce import Workforce
from camel.tasks.task import Task
from camel.types import ModelPlatformType, ModelType
from camel.configs import DeepSeekConfig
from camel.toolkits import FunctionTool, SearchToolkit
from camel.toolkits.browser_use_toolkit import BrowserUseToolkit
def main():
print("camel agent with BrowserUseToolkit() ")
toolkit = BrowserUseToolkit()
gui_agent_model = ModelFactory.create(
model_platform=ModelPlatformType.DEEPSEEK,
model_type=ModelType.DEEPSEEK_CHAT,
)
gui_agent = ChatAgent(
BaseMessage.make_assistant_message(
role_name="You are a UI Tester",
content="You are a UI tester, you are experienced in working with UI test."
" You can break the goals into numbered list of action."
" And you know how to use BrowserUseTool and run the tool with your detailed output",
),
model=gui_agent_model,
tools=[FunctionTool(BrowserUseToolkit().execute_browser_task)],
)
print(gui_agent.role_name)
print(gui_agent._original_system_message.content)
usr_msg = """Task:
To access http://localhost:8089; login with x_name and x_password; place an order there with brand: Brand-A, size: XXL, qty:10 . Finally logout. You need use BrowserUseTool to execute these steps and logout.
expected_output:
The tool completes successfully and no error returns
"""
print(usr_msg)
response = gui_agent.step(input_message=usr_msg, response_format=None)
print(response.msgs[0].content)
if __name__ == "__main__":
main()