You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are a helpful assistant that can use these tools:
44
+
${tools_description}
45
+
46
+
Choose the appropriate tool based on the user's question.
47
+
If no tool is needed, respond directly.
48
+
If answering the user's question requires multiple tool calls, call only one tool at a time. After the user receives the tool result, they will provide you with feedback on the tool call result.
49
+
50
+
Important instructions for browser operations:
51
+
1. When performing web operations:
52
+
- Always verify URLs before visiting
53
+
- Handle page loading states appropriately
54
+
- Extract relevant information efficiently
55
+
- Save important data to files when requested
56
+
- Follow proper browser automation practices
57
+
58
+
2. When saving web content:
59
+
- Format data appropriately before saving
60
+
- Use clear file naming conventions
61
+
- Include relevant metadata
62
+
- Verify file save operations
63
+
64
+
3. When you need to use a tool, you must only respond with the exact JSON object format below, nothing else:
65
+
```json
66
+
{
67
+
"think": "Your thinking (if analysis is needed)",
68
+
"tool_name": "Tool name",
69
+
"arguments": {
70
+
"parameter_name": "parameter_value"
71
+
}
72
+
}
73
+
```
74
+
75
+
4. When a tool is still executing, you must wait for its result before calling another tool.
76
+
77
+
5. When calling multiple tools in sequence, you MUST correctly pass context and information from previous tool results to subsequent tool calls:
78
+
- Include relevant data from previous tool results in the arguments of your next tool call
79
+
- Maintain state and context across multiple tool calls
80
+
- If a tool returns data that will be needed by a future tool, you must store that data
81
+
82
+
After receiving the tool's response:
83
+
1. Transform the raw data into a natural conversational response
84
+
2. The answer should be concise but rich in content
85
+
3. Focus on the most relevant information
86
+
4. Use appropriate context from the user's question
87
+
5. Avoid simply repeating the raw data
88
+
89
+
Please only use the tools explicitly defined above.
90
+
"""
91
+
92
+
classBrowserDemo:
93
+
"""Browser demo implementation class."""
94
+
95
+
def__init__(self):
96
+
"""Initialize the browser demo with configuration."""
97
+
try:
98
+
self.config=load_config()
99
+
Config.set_agent_llm_model("default_llm")
100
+
self.oxy_space=self._create_oxy_space()
101
+
exceptExceptionase:
102
+
logger.error(f"Failed to initialize BrowserDemo: {str(e)}")
103
+
raise
104
+
105
+
def_create_oxy_space(self) ->list:
106
+
"""Create and configure the oxy space with all required components."""
107
+
try:
108
+
return [
109
+
self._create_http_llm(),
110
+
self._create_browser_tools(),
111
+
self._create_filesystem_tools(),
112
+
self._create_browser_agent(),
113
+
self._create_file_agent(),
114
+
self._create_master_agent()
115
+
]
116
+
exceptExceptionase:
117
+
logger.error(f"Failed to create oxy space: {str(e)}")
118
+
raise
119
+
120
+
def_create_http_llm(self) ->oxy.HttpLLM:
121
+
"""Create and configure the HTTP LLM component."""
122
+
returnoxy.HttpLLM(
123
+
name="default_llm",
124
+
api_key=self.config["DEFAULT_LLM_API_KEY"],
125
+
base_url=self.config["DEFAULT_LLM_BASE_URL"],
126
+
model_name=self.config["DEFAULT_LLM_MODEL_NAME"],
127
+
llm_params={"temperature": 0.01},
128
+
semaphore=4,
129
+
category="llm",
130
+
class_name="HttpLLM",
131
+
desc="Default language model",
132
+
desc_for_llm="Default language model for text generation",
0 commit comments