camel-ai 0.2.60__py3-none-any.whl → 0.2.62__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 +159 -8
- camel/agents/mcp_agent.py +5 -5
- camel/configs/anthropic_config.py +6 -5
- camel/{data_collector → data_collectors}/alpaca_collector.py +1 -1
- camel/{data_collector → data_collectors}/sharegpt_collector.py +1 -1
- camel/datagen/evol_instruct/scorer.py +22 -23
- camel/datagen/evol_instruct/templates.py +46 -46
- camel/datasets/static_dataset.py +144 -0
- camel/loaders/__init__.py +5 -2
- camel/loaders/chunkr_reader.py +117 -91
- camel/loaders/mistral_reader.py +148 -0
- camel/memories/blocks/chat_history_block.py +1 -2
- camel/models/model_manager.py +7 -3
- camel/retrievers/auto_retriever.py +20 -1
- camel/{runtime → runtimes}/daytona_runtime.py +1 -1
- camel/{runtime → runtimes}/docker_runtime.py +1 -1
- camel/{runtime → runtimes}/llm_guard_runtime.py +2 -2
- camel/{runtime → runtimes}/remote_http_runtime.py +1 -1
- camel/{runtime → runtimes}/ubuntu_docker_runtime.py +1 -1
- camel/societies/workforce/base.py +7 -3
- camel/societies/workforce/single_agent_worker.py +2 -1
- camel/societies/workforce/worker.py +5 -3
- camel/societies/workforce/workforce.py +65 -24
- camel/storages/__init__.py +2 -0
- camel/storages/vectordb_storages/__init__.py +2 -0
- camel/storages/vectordb_storages/faiss.py +712 -0
- camel/toolkits/__init__.py +4 -0
- camel/toolkits/async_browser_toolkit.py +75 -523
- camel/toolkits/bohrium_toolkit.py +318 -0
- camel/toolkits/browser_toolkit.py +215 -538
- camel/toolkits/browser_toolkit_commons.py +568 -0
- camel/toolkits/file_write_toolkit.py +80 -31
- camel/toolkits/mcp_toolkit.py +477 -665
- camel/toolkits/pptx_toolkit.py +777 -0
- camel/toolkits/wolfram_alpha_toolkit.py +5 -1
- camel/types/enums.py +13 -1
- camel/utils/__init__.py +2 -0
- camel/utils/commons.py +27 -0
- camel/utils/mcp_client.py +979 -0
- {camel_ai-0.2.60.dist-info → camel_ai-0.2.62.dist-info}/METADATA +14 -1
- {camel_ai-0.2.60.dist-info → camel_ai-0.2.62.dist-info}/RECORD +53 -47
- /camel/{data_collector → data_collectors}/__init__.py +0 -0
- /camel/{data_collector → data_collectors}/base.py +0 -0
- /camel/{runtime → runtimes}/__init__.py +0 -0
- /camel/{runtime → runtimes}/api.py +0 -0
- /camel/{runtime → runtimes}/base.py +0 -0
- /camel/{runtime → runtimes}/configs.py +0 -0
- /camel/{runtime → runtimes}/utils/__init__.py +0 -0
- /camel/{runtime → runtimes}/utils/function_risk_toolkit.py +0 -0
- /camel/{runtime → runtimes}/utils/ignore_risk_toolkit.py +0 -0
- {camel_ai-0.2.60.dist-info → camel_ai-0.2.62.dist-info}/WHEEL +0 -0
- {camel_ai-0.2.60.dist-info → camel_ai-0.2.62.dist-info}/licenses/LICENSE +0 -0
|
@@ -48,29 +48,58 @@ logger = get_logger(__name__)
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
class Workforce(BaseNode):
|
|
51
|
-
r"""A system where multiple
|
|
52
|
-
to solve tasks. It can assign tasks to
|
|
51
|
+
r"""A system where multiple worker nodes (agents) cooperate together
|
|
52
|
+
to solve tasks. It can assign tasks to worker nodes and also take
|
|
53
53
|
strategies such as create new worker, decompose tasks, etc. to handle
|
|
54
54
|
situations when the task fails.
|
|
55
55
|
|
|
56
|
+
The workforce uses three specialized ChatAgents internally:
|
|
57
|
+
- Coordinator Agent: Assigns tasks to workers based on their
|
|
58
|
+
capabilities
|
|
59
|
+
- Task Planner Agent: Decomposes complex tasks and composes results
|
|
60
|
+
- Dynamic Workers: Created at runtime when tasks fail repeatedly
|
|
61
|
+
|
|
56
62
|
Args:
|
|
57
|
-
description (str): Description of the
|
|
63
|
+
description (str): Description of the workforce.
|
|
58
64
|
children (Optional[List[BaseNode]], optional): List of child nodes
|
|
59
65
|
under this node. Each child node can be a worker node or
|
|
60
66
|
another workforce node. (default: :obj:`None`)
|
|
61
67
|
coordinator_agent_kwargs (Optional[Dict], optional): Keyword
|
|
62
|
-
arguments
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
(default: :obj:`None`
|
|
68
|
+
arguments passed directly to the coordinator :obj:`ChatAgent`
|
|
69
|
+
constructor. The coordinator manages task assignment and failure
|
|
70
|
+
handling strategies. See :obj:`ChatAgent` documentation
|
|
71
|
+
for all available parameters.
|
|
72
|
+
(default: :obj:`None` - uses ModelPlatformType.DEFAULT,
|
|
73
|
+
ModelType.DEFAULT)
|
|
74
|
+
task_agent_kwargs (Optional[Dict], optional): Keyword arguments
|
|
75
|
+
passed directly to the task planning :obj:`ChatAgent` constructor.
|
|
76
|
+
The task agent handles task decomposition into subtasks and result
|
|
77
|
+
composition. See :obj:`ChatAgent` documentation for all
|
|
78
|
+
available parameters.
|
|
79
|
+
(default: :obj:`None` - uses ModelPlatformType.DEFAULT,
|
|
80
|
+
ModelType.DEFAULT)
|
|
81
|
+
new_worker_agent_kwargs (Optional[Dict], optional): Default keyword
|
|
82
|
+
arguments passed to :obj:`ChatAgent` constructor for workers
|
|
83
|
+
created dynamically at runtime when existing workers cannot handle
|
|
84
|
+
failed tasks. See :obj:`ChatAgent` documentation for all
|
|
85
|
+
available parameters.
|
|
86
|
+
(default: :obj:`None` - creates workers with SearchToolkit,
|
|
87
|
+
CodeExecutionToolkit, and ThinkingToolkit)
|
|
88
|
+
|
|
89
|
+
Example:
|
|
90
|
+
>>> # Configure with custom model
|
|
91
|
+
>>> model = ModelFactory.create(
|
|
92
|
+
... ModelPlatformType.OPENAI, ModelType.GPT_4O
|
|
93
|
+
... )
|
|
94
|
+
>>> workforce = Workforce(
|
|
95
|
+
... "Research Team",
|
|
96
|
+
... coordinator_agent_kwargs={"model": model, "token_limit": 4000},
|
|
97
|
+
... task_agent_kwargs={"model": model, "token_limit": 8000}
|
|
98
|
+
... )
|
|
99
|
+
>>>
|
|
100
|
+
>>> # Process a task
|
|
101
|
+
>>> task = Task(content="Research AI trends", id="1")
|
|
102
|
+
>>> result = workforce.process_task(task)
|
|
74
103
|
"""
|
|
75
104
|
|
|
76
105
|
def __init__(
|
|
@@ -89,21 +118,33 @@ class Workforce(BaseNode):
|
|
|
89
118
|
# Warning messages for default model usage
|
|
90
119
|
if coordinator_agent_kwargs is None:
|
|
91
120
|
logger.warning(
|
|
92
|
-
"No coordinator_agent_kwargs provided. "
|
|
93
|
-
"
|
|
94
|
-
"
|
|
121
|
+
"No coordinator_agent_kwargs provided. Using default "
|
|
122
|
+
"ChatAgent settings (ModelPlatformType.DEFAULT, "
|
|
123
|
+
"ModelType.DEFAULT). To customize the coordinator agent "
|
|
124
|
+
"that assigns tasks and handles failures, pass a dictionary "
|
|
125
|
+
"with ChatAgent parameters, e.g.: {'model': your_model, "
|
|
126
|
+
"'tools': your_tools, 'token_limit': 8000}. See ChatAgent "
|
|
127
|
+
"documentation for all available options."
|
|
95
128
|
)
|
|
96
129
|
if task_agent_kwargs is None:
|
|
97
130
|
logger.warning(
|
|
98
|
-
"No task_agent_kwargs provided. "
|
|
99
|
-
"
|
|
100
|
-
"
|
|
131
|
+
"No task_agent_kwargs provided. Using default ChatAgent "
|
|
132
|
+
"settings (ModelPlatformType.DEFAULT, ModelType.DEFAULT). "
|
|
133
|
+
"To customize the task planning agent that "
|
|
134
|
+
"decomposes/composes tasks, pass a dictionary with "
|
|
135
|
+
"ChatAgent parameters, e.g.: {'model': your_model, "
|
|
136
|
+
"'token_limit': 16000}. See ChatAgent documentation for "
|
|
137
|
+
"all available options."
|
|
101
138
|
)
|
|
102
139
|
if new_worker_agent_kwargs is None:
|
|
103
140
|
logger.warning(
|
|
104
|
-
"No new_worker_agent_kwargs provided. "
|
|
105
|
-
"
|
|
106
|
-
"
|
|
141
|
+
"No new_worker_agent_kwargs provided. Workers created at "
|
|
142
|
+
"runtime will use default ChatAgent settings with "
|
|
143
|
+
"SearchToolkit, CodeExecutionToolkit, and ThinkingToolkit. "
|
|
144
|
+
"To customize runtime worker creation, pass a dictionary "
|
|
145
|
+
"with ChatAgent parameters, e.g.: {'model': your_model, "
|
|
146
|
+
"'tools': your_tools}. See ChatAgent documentation for all "
|
|
147
|
+
"available options."
|
|
107
148
|
)
|
|
108
149
|
|
|
109
150
|
coord_agent_sys_msg = BaseMessage.make_assistant_message(
|
camel/storages/__init__.py
CHANGED
|
@@ -26,6 +26,7 @@ from .vectordb_storages.base import (
|
|
|
26
26
|
VectorDBQueryResult,
|
|
27
27
|
VectorRecord,
|
|
28
28
|
)
|
|
29
|
+
from .vectordb_storages.faiss import FaissStorage
|
|
29
30
|
from .vectordb_storages.milvus import MilvusStorage
|
|
30
31
|
from .vectordb_storages.oceanbase import OceanBaseStorage
|
|
31
32
|
from .vectordb_storages.qdrant import QdrantStorage
|
|
@@ -43,6 +44,7 @@ __all__ = [
|
|
|
43
44
|
'QdrantStorage',
|
|
44
45
|
'MilvusStorage',
|
|
45
46
|
"TiDBStorage",
|
|
47
|
+
"FaissStorage",
|
|
46
48
|
'BaseGraphStorage',
|
|
47
49
|
'Neo4jGraph',
|
|
48
50
|
'NebulaGraph',
|
|
@@ -19,6 +19,7 @@ from .base import (
|
|
|
19
19
|
VectorDBStatus,
|
|
20
20
|
VectorRecord,
|
|
21
21
|
)
|
|
22
|
+
from .faiss import FaissStorage
|
|
22
23
|
from .milvus import MilvusStorage
|
|
23
24
|
from .oceanbase import OceanBaseStorage
|
|
24
25
|
from .qdrant import QdrantStorage
|
|
@@ -31,6 +32,7 @@ __all__ = [
|
|
|
31
32
|
'QdrantStorage',
|
|
32
33
|
'MilvusStorage',
|
|
33
34
|
"TiDBStorage",
|
|
35
|
+
'FaissStorage',
|
|
34
36
|
'OceanBaseStorage',
|
|
35
37
|
'VectorRecord',
|
|
36
38
|
'VectorDBStatus',
|