camel-ai 0.2.61__py3-none-any.whl → 0.2.64__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.

Files changed (68) hide show
  1. camel/__init__.py +1 -1
  2. camel/agents/chat_agent.py +75 -16
  3. camel/agents/mcp_agent.py +10 -6
  4. camel/configs/__init__.py +3 -0
  5. camel/configs/crynux_config.py +94 -0
  6. camel/{data_collector → data_collectors}/alpaca_collector.py +1 -1
  7. camel/{data_collector → data_collectors}/sharegpt_collector.py +1 -1
  8. camel/interpreters/base.py +14 -1
  9. camel/interpreters/docker/Dockerfile +63 -7
  10. camel/interpreters/docker_interpreter.py +65 -7
  11. camel/interpreters/e2b_interpreter.py +23 -8
  12. camel/interpreters/internal_python_interpreter.py +30 -2
  13. camel/interpreters/ipython_interpreter.py +21 -3
  14. camel/interpreters/subprocess_interpreter.py +34 -2
  15. camel/memories/records.py +5 -3
  16. camel/models/__init__.py +2 -0
  17. camel/models/azure_openai_model.py +101 -25
  18. camel/models/cohere_model.py +65 -0
  19. camel/models/crynux_model.py +94 -0
  20. camel/models/deepseek_model.py +43 -1
  21. camel/models/gemini_model.py +50 -4
  22. camel/models/litellm_model.py +38 -0
  23. camel/models/mistral_model.py +66 -0
  24. camel/models/model_factory.py +10 -1
  25. camel/models/openai_compatible_model.py +81 -17
  26. camel/models/openai_model.py +86 -16
  27. camel/models/reka_model.py +69 -0
  28. camel/models/samba_model.py +69 -2
  29. camel/models/sglang_model.py +74 -2
  30. camel/models/watsonx_model.py +62 -0
  31. camel/retrievers/auto_retriever.py +20 -1
  32. camel/{runtime → runtimes}/daytona_runtime.py +1 -1
  33. camel/{runtime → runtimes}/docker_runtime.py +1 -1
  34. camel/{runtime → runtimes}/llm_guard_runtime.py +2 -2
  35. camel/{runtime → runtimes}/remote_http_runtime.py +1 -1
  36. camel/{runtime → runtimes}/ubuntu_docker_runtime.py +1 -1
  37. camel/societies/workforce/base.py +7 -3
  38. camel/societies/workforce/role_playing_worker.py +2 -2
  39. camel/societies/workforce/single_agent_worker.py +25 -1
  40. camel/societies/workforce/worker.py +5 -3
  41. camel/societies/workforce/workforce.py +409 -7
  42. camel/storages/__init__.py +2 -0
  43. camel/storages/vectordb_storages/__init__.py +2 -0
  44. camel/storages/vectordb_storages/weaviate.py +714 -0
  45. camel/tasks/task.py +19 -10
  46. camel/toolkits/__init__.py +2 -0
  47. camel/toolkits/code_execution.py +37 -8
  48. camel/toolkits/file_write_toolkit.py +4 -2
  49. camel/toolkits/mcp_toolkit.py +480 -733
  50. camel/toolkits/pptx_toolkit.py +777 -0
  51. camel/types/enums.py +56 -1
  52. camel/types/unified_model_type.py +5 -0
  53. camel/utils/__init__.py +16 -0
  54. camel/utils/langfuse.py +258 -0
  55. camel/utils/mcp_client.py +1046 -0
  56. {camel_ai-0.2.61.dist-info → camel_ai-0.2.64.dist-info}/METADATA +9 -1
  57. {camel_ai-0.2.61.dist-info → camel_ai-0.2.64.dist-info}/RECORD +68 -62
  58. /camel/{data_collector → data_collectors}/__init__.py +0 -0
  59. /camel/{data_collector → data_collectors}/base.py +0 -0
  60. /camel/{runtime → runtimes}/__init__.py +0 -0
  61. /camel/{runtime → runtimes}/api.py +0 -0
  62. /camel/{runtime → runtimes}/base.py +0 -0
  63. /camel/{runtime → runtimes}/configs.py +0 -0
  64. /camel/{runtime → runtimes}/utils/__init__.py +0 -0
  65. /camel/{runtime → runtimes}/utils/function_risk_toolkit.py +0 -0
  66. /camel/{runtime → runtimes}/utils/ignore_risk_toolkit.py +0 -0
  67. {camel_ai-0.2.61.dist-info → camel_ai-0.2.64.dist-info}/WHEEL +0 -0
  68. {camel_ai-0.2.61.dist-info → camel_ai-0.2.64.dist-info}/licenses/LICENSE +0 -0
camel/tasks/task.py CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  import re
16
16
  from enum import Enum
17
- from typing import Callable, Dict, List, Literal, Optional, Union
17
+ from typing import Any, Callable, Dict, List, Literal, Optional, Union
18
18
 
19
19
  from pydantic import BaseModel
20
20
 
@@ -69,14 +69,23 @@ class Task(BaseModel):
69
69
  r"""Task is specific assignment that can be passed to a agent.
70
70
 
71
71
  Attributes:
72
- content: string content for task.
73
- id: An unique string identifier for the task. This should
74
- ideally be provided by the provider/model which created the task.
75
- state: The state which should be OPEN, RUNNING, DONE or DELETED.
76
- type: task type
77
- parent: The parent task, None for root task.
78
- subtasks: The childrent sub-tasks for the task.
79
- result: The answer for the task.
72
+ content (str): string content for task.
73
+ id (str): An unique string identifier for the task. This should
74
+ ideally be provided by the provider/model which created the task.
75
+ (default: :obj: `""`)
76
+ state (TaskState): The state which should be OPEN, RUNNING, DONE or
77
+ DELETED. (default: :obj: `TaskState.OPEN`)
78
+ type (Optional[str]): task type. (default: :obj: `None`)
79
+ parent (Optional[Task]): The parent task, None for root task.
80
+ (default: :obj: `None`)
81
+ subtasks (List[Task]): The childrent sub-tasks for the task.
82
+ (default: :obj: `[]`)
83
+ result (Optional[str]): The answer for the task.
84
+ (default: :obj: `""`)
85
+ failure_count (int): The failure count for the task.
86
+ (default: :obj: `0`)
87
+ additional_info (Optional[Dict[str, Any]]): Additional information for
88
+ the task. (default: :obj: `None`)
80
89
  """
81
90
 
82
91
  content: str
@@ -95,7 +104,7 @@ class Task(BaseModel):
95
104
 
96
105
  failure_count: int = 0
97
106
 
98
- additional_info: Optional[str] = None
107
+ additional_info: Optional[Dict[str, Any]] = None
99
108
 
100
109
  @classmethod
101
110
  def from_message(cls, message: BaseMessage) -> "Task":
@@ -62,6 +62,7 @@ from .mcp_toolkit import MCPToolkit
62
62
  from .browser_toolkit import BrowserToolkit
63
63
  from .async_browser_toolkit import AsyncBrowserToolkit
64
64
  from .file_write_toolkit import FileWriteToolkit
65
+ from .pptx_toolkit import PPTXToolkit
65
66
  from .terminal_toolkit import TerminalToolkit
66
67
  from .pubmed_toolkit import PubMedToolkit
67
68
  from .data_commons_toolkit import DataCommonsToolkit
@@ -124,6 +125,7 @@ __all__ = [
124
125
  'BrowserToolkit',
125
126
  'AsyncBrowserToolkit',
126
127
  'FileWriteToolkit',
128
+ 'PPTXToolkit',
127
129
  'TerminalToolkit',
128
130
  'PubMedToolkit',
129
131
  'DataCommonsToolkit',
@@ -20,10 +20,13 @@ from camel.interpreters import (
20
20
  JupyterKernelInterpreter,
21
21
  SubprocessInterpreter,
22
22
  )
23
+ from camel.logger import get_logger
23
24
  from camel.toolkits import FunctionTool
24
25
  from camel.toolkits.base import BaseToolkit
25
26
  from camel.utils import MCPServer
26
27
 
28
+ logger = get_logger(__name__)
29
+
27
30
 
28
31
  @MCPServer()
29
32
  class CodeExecutionToolkit(BaseToolkit):
@@ -36,10 +39,10 @@ class CodeExecutionToolkit(BaseToolkit):
36
39
  (default: :obj:`False`)
37
40
  unsafe_mode (bool): If `True`, the interpreter runs the code
38
41
  by `eval()` without any security check. (default: :obj:`False`)
39
- import_white_list ( Optional[List[str]]): A list of allowed imports.
42
+ import_white_list (Optional[List[str]]): A list of allowed imports.
40
43
  (default: :obj:`None`)
41
- require_confirm (bool): Whether to require confirmation before executing code.
42
- (default: :obj:`False`)
44
+ require_confirm (bool): Whether to require confirmation before
45
+ executing code. (default: :obj:`False`)
43
46
  """
44
47
 
45
48
  def __init__(
@@ -97,18 +100,41 @@ class CodeExecutionToolkit(BaseToolkit):
97
100
  f"The sandbox type `{sandbox}` is not supported."
98
101
  )
99
102
 
100
- def execute_code(self, code: str) -> str:
103
+ def execute_code(self, code: str, code_type: str = "python") -> str:
101
104
  r"""Execute a given code snippet.
102
105
 
103
106
  Args:
104
107
  code (str): The input code to the Code Interpreter tool call.
108
+ code_type (str): The type of the code to be executed
109
+ (e.g. node.js, python, etc). (default: obj:`python`)
105
110
 
106
111
  Returns:
107
112
  str: The text output from the Code Interpreter tool call.
108
113
  """
109
- output = self.interpreter.run(code, "python")
110
- # ruff: noqa: E501
111
- content = f"Executed the code below:\n```py\n{code}\n```\n> Executed Results:\n{output}"
114
+ output = self.interpreter.run(code, code_type)
115
+ content = (
116
+ f"Executed the code below:\n```{code_type}\n{code}\n```\n"
117
+ f"> Executed Results:\n{output}"
118
+ )
119
+ if self.verbose:
120
+ print(content)
121
+ return content
122
+
123
+ def execute_command(self, command: str) -> Union[str, tuple[str, str]]:
124
+ r"""Execute a command can be used to resolve the dependency of the
125
+ code.
126
+
127
+ Args:
128
+ command (str): The command to execute.
129
+
130
+ Returns:
131
+ Union[str, tuple[str, str]]: The output of the command.
132
+ """
133
+ output = self.interpreter.execute_command(command)
134
+ content = (
135
+ f"Executed the command below:\n```sh\n{command}\n```\n"
136
+ f"> Executed Results:\n{output}"
137
+ )
112
138
  if self.verbose:
113
139
  print(content)
114
140
  return content
@@ -121,4 +147,7 @@ class CodeExecutionToolkit(BaseToolkit):
121
147
  List[FunctionTool]: A list of FunctionTool objects
122
148
  representing the functions in the toolkit.
123
149
  """
124
- return [FunctionTool(self.execute_code)]
150
+ return [
151
+ FunctionTool(self.execute_code),
152
+ FunctionTool(self.execute_command),
153
+ ]
@@ -338,8 +338,10 @@ class FileWriteToolkit(BaseToolkit):
338
338
 
339
339
  Args:
340
340
  content (Union[str, List[List[str]]]): The content to write to the
341
- file. For all formats, content must be a string or list in the
342
- appropriate format.
341
+ file. Content format varies by file type:
342
+ - Text formats (txt, md, html, yaml): string
343
+ - CSV: string or list of lists
344
+ - JSON: string or serializable object
343
345
  filename (str): The name or path of the file. If a relative path is
344
346
  supplied, it is resolved to self.output_dir.
345
347
  encoding (Optional[str]): The character encoding to use. (default: