camel-ai 0.2.71a3__py3-none-any.whl → 0.2.71a5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of camel-ai might be problematic. Click here for more details.
- camel/__init__.py +1 -1
- camel/agents/chat_agent.py +1482 -134
- camel/agents/repo_agent.py +2 -1
- camel/benchmarks/browsecomp.py +6 -6
- camel/interpreters/docker_interpreter.py +3 -2
- camel/loaders/base_loader.py +85 -0
- camel/logger.py +1 -1
- camel/messages/base.py +12 -1
- camel/models/azure_openai_model.py +96 -7
- camel/models/base_model.py +68 -10
- camel/models/deepseek_model.py +5 -0
- camel/models/gemini_model.py +5 -0
- camel/models/litellm_model.py +48 -16
- camel/models/model_manager.py +24 -6
- camel/models/openai_compatible_model.py +109 -5
- camel/models/openai_model.py +117 -8
- camel/societies/workforce/prompts.py +68 -5
- camel/societies/workforce/role_playing_worker.py +1 -0
- camel/societies/workforce/single_agent_worker.py +1 -0
- camel/societies/workforce/utils.py +67 -2
- camel/societies/workforce/workforce.py +412 -67
- camel/societies/workforce/workforce_logger.py +0 -8
- camel/tasks/task.py +2 -0
- camel/toolkits/__init__.py +7 -2
- camel/toolkits/craw4ai_toolkit.py +2 -2
- camel/toolkits/file_write_toolkit.py +526 -121
- camel/toolkits/hybrid_browser_toolkit/hybrid_browser_toolkit.py +9 -3
- camel/toolkits/hybrid_browser_toolkit/unified_analyzer.js +31 -8
- camel/toolkits/message_agent_toolkit.py +608 -0
- camel/toolkits/note_taking_toolkit.py +90 -0
- camel/toolkits/openai_image_toolkit.py +292 -0
- camel/toolkits/slack_toolkit.py +4 -4
- camel/toolkits/terminal_toolkit.py +223 -73
- camel/utils/mcp_client.py +37 -1
- {camel_ai-0.2.71a3.dist-info → camel_ai-0.2.71a5.dist-info}/METADATA +48 -7
- {camel_ai-0.2.71a3.dist-info → camel_ai-0.2.71a5.dist-info}/RECORD +38 -35
- camel/toolkits/dalle_toolkit.py +0 -175
- {camel_ai-0.2.71a3.dist-info → camel_ai-0.2.71a5.dist-info}/WHEEL +0 -0
- {camel_ai-0.2.71a3.dist-info → camel_ai-0.2.71a5.dist-info}/licenses/LICENSE +0 -0
|
@@ -56,6 +56,7 @@ class HybridBrowserToolkit(BaseToolkit):
|
|
|
56
56
|
"visit_page",
|
|
57
57
|
"click",
|
|
58
58
|
"type",
|
|
59
|
+
"enter",
|
|
59
60
|
]
|
|
60
61
|
|
|
61
62
|
# All available tools
|
|
@@ -509,17 +510,19 @@ class HybridBrowserToolkit(BaseToolkit):
|
|
|
509
510
|
# Public API Methods
|
|
510
511
|
|
|
511
512
|
async def open_browser(
|
|
512
|
-
self, start_url: Optional[str] =
|
|
513
|
+
self, start_url: Optional[str] = "https://search.brave.com/"
|
|
513
514
|
) -> Dict[str, str]:
|
|
514
515
|
r"""Launches a new browser session, making it ready for web automation.
|
|
515
516
|
|
|
516
517
|
This method initializes the underlying browser instance. If a
|
|
517
|
-
`start_url` is provided, it will also navigate to that URL.
|
|
518
|
+
`start_url` is provided, it will also navigate to that URL. If you
|
|
519
|
+
don't have a specific URL to start with, you can use a search engine
|
|
520
|
+
like 'https://search.brave.com/'.
|
|
518
521
|
|
|
519
522
|
Args:
|
|
520
523
|
start_url (Optional[str]): The initial URL to navigate to after the
|
|
521
524
|
browser is launched. If not provided, the browser will start
|
|
522
|
-
with a blank page.
|
|
525
|
+
with a blank page. (default: :obj:`https://search.brave.com/`)
|
|
523
526
|
|
|
524
527
|
Returns:
|
|
525
528
|
Dict[str, str]: A dictionary containing:
|
|
@@ -590,6 +593,9 @@ class HybridBrowserToolkit(BaseToolkit):
|
|
|
590
593
|
"snapshot": "",
|
|
591
594
|
}
|
|
592
595
|
|
|
596
|
+
if '://' not in url:
|
|
597
|
+
url = f'https://{url}'
|
|
598
|
+
|
|
593
599
|
logger.info(f"Navigating to URL: {url}")
|
|
594
600
|
|
|
595
601
|
# Navigate to page
|
|
@@ -10,18 +10,31 @@
|
|
|
10
10
|
// === Complete snapshot.js logic preservation ===
|
|
11
11
|
|
|
12
12
|
function isVisible(node) {
|
|
13
|
+
// Check if node is null or not a valid DOM node
|
|
14
|
+
if (!node || typeof node.nodeType === 'undefined') return false;
|
|
13
15
|
if (node.nodeType !== Node.ELEMENT_NODE) return true;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
const style = window.getComputedStyle(node);
|
|
19
|
+
if (style.display === 'none' || style.visibility === 'hidden' || style.opacity === '0')
|
|
20
|
+
return false;
|
|
21
|
+
// An element with `display: contents` is not rendered itself, but its children are.
|
|
22
|
+
if (style.display === 'contents')
|
|
23
|
+
return true;
|
|
24
|
+
const rect = node.getBoundingClientRect();
|
|
25
|
+
return rect.width > 0 && rect.height > 0;
|
|
26
|
+
} catch (e) {
|
|
27
|
+
// If there's an error getting computed style or bounding rect, assume element is not visible
|
|
16
28
|
return false;
|
|
17
|
-
|
|
18
|
-
if (style.display === 'contents')
|
|
19
|
-
return true;
|
|
20
|
-
const rect = node.getBoundingClientRect();
|
|
21
|
-
return rect.width > 0 && rect.height > 0;
|
|
29
|
+
}
|
|
22
30
|
}
|
|
23
31
|
|
|
24
32
|
function getRole(node) {
|
|
33
|
+
// Check if node is null or doesn't have required properties
|
|
34
|
+
if (!node || !node.tagName || !node.getAttribute) {
|
|
35
|
+
return 'generic';
|
|
36
|
+
}
|
|
37
|
+
|
|
25
38
|
const role = node.getAttribute('role');
|
|
26
39
|
if (role) return role;
|
|
27
40
|
|
|
@@ -39,6 +52,9 @@
|
|
|
39
52
|
}
|
|
40
53
|
|
|
41
54
|
function getAccessibleName(node) {
|
|
55
|
+
// Check if node is null or doesn't have required methods
|
|
56
|
+
if (!node || !node.hasAttribute || !node.getAttribute) return '';
|
|
57
|
+
|
|
42
58
|
if (node.hasAttribute('aria-label')) return node.getAttribute('aria-label') || '';
|
|
43
59
|
if (node.hasAttribute('aria-labelledby')) {
|
|
44
60
|
const id = node.getAttribute('aria-labelledby');
|
|
@@ -55,6 +71,9 @@
|
|
|
55
71
|
|
|
56
72
|
const textCache = new Map();
|
|
57
73
|
function getVisibleTextContent(_node) {
|
|
74
|
+
// Check if node is null or doesn't have nodeType
|
|
75
|
+
if (!_node || typeof _node.nodeType === 'undefined') return '';
|
|
76
|
+
|
|
58
77
|
if (textCache.has(_node)) return textCache.get(_node);
|
|
59
78
|
|
|
60
79
|
if (_node.nodeType === Node.TEXT_NODE) {
|
|
@@ -85,6 +104,9 @@
|
|
|
85
104
|
const visited = new Set();
|
|
86
105
|
|
|
87
106
|
function toAriaNode(element) {
|
|
107
|
+
// Check if element is null or not a valid DOM element
|
|
108
|
+
if (!element || !element.tagName) return null;
|
|
109
|
+
|
|
88
110
|
// Only consider visible elements
|
|
89
111
|
if (!isVisible(element)) return null;
|
|
90
112
|
|
|
@@ -115,7 +137,8 @@
|
|
|
115
137
|
}
|
|
116
138
|
|
|
117
139
|
function traverse(element, parentNode) {
|
|
118
|
-
if
|
|
140
|
+
// Check if element is null or not a valid DOM element
|
|
141
|
+
if (!element || !element.tagName || visited.has(element)) return;
|
|
119
142
|
visited.add(element);
|
|
120
143
|
|
|
121
144
|
// FIX: Completely skip script and style tags and their children.
|