camel-ai 0.2.49__py3-none-any.whl → 0.2.51__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 -15
- camel/configs/__init__.py +6 -0
- camel/configs/modelscope_config.py +4 -1
- camel/configs/novita_config.py +102 -0
- camel/configs/qwen_config.py +0 -7
- camel/configs/watsonx_config.py +96 -0
- camel/environments/single_step.py +79 -11
- camel/models/__init__.py +4 -0
- camel/models/azure_openai_model.py +27 -9
- camel/models/model_factory.py +29 -6
- camel/models/modelscope_model.py +175 -2
- camel/models/novita_model.py +95 -0
- camel/models/ollama_model.py +15 -10
- camel/models/qwen_model.py +175 -2
- camel/models/vllm_model.py +15 -9
- camel/models/watsonx_model.py +253 -0
- camel/societies/workforce/prompts.py +31 -4
- camel/societies/workforce/workforce.py +1 -1
- camel/toolkits/browser_toolkit.py +53 -55
- camel/types/enums.py +226 -1
- camel/types/unified_model_type.py +10 -0
- camel/utils/__init__.py +2 -0
- camel/utils/filename.py +80 -0
- camel/verifiers/__init__.py +2 -0
- camel/verifiers/physics_verifier.py +881 -0
- camel/verifiers/python_verifier.py +16 -31
- {camel_ai-0.2.49.dist-info → camel_ai-0.2.51.dist-info}/METADATA +4 -1
- {camel_ai-0.2.49.dist-info → camel_ai-0.2.51.dist-info}/RECORD +31 -25
- {camel_ai-0.2.49.dist-info → camel_ai-0.2.51.dist-info}/WHEEL +0 -0
- {camel_ai-0.2.49.dist-info → camel_ai-0.2.51.dist-info}/licenses/LICENSE +0 -0
camel/utils/filename.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
# you may not use this file except in compliance with the License.
|
|
4
|
+
# You may obtain a copy of the License at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
# See the License for the specific language governing permissions and
|
|
12
|
+
# limitations under the License.
|
|
13
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
|
+
import platform
|
|
15
|
+
import re
|
|
16
|
+
import unicodedata
|
|
17
|
+
|
|
18
|
+
MAX_FILENAME_LENGTH = 255
|
|
19
|
+
WINDOWS_RESERVED = {
|
|
20
|
+
'CON',
|
|
21
|
+
'PRN',
|
|
22
|
+
'AUX',
|
|
23
|
+
'NUL',
|
|
24
|
+
'COM1',
|
|
25
|
+
'COM2',
|
|
26
|
+
'COM3',
|
|
27
|
+
'COM4',
|
|
28
|
+
'LPT1',
|
|
29
|
+
'LPT2',
|
|
30
|
+
'LPT3',
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def sanitize_filename(
|
|
35
|
+
url_name: str,
|
|
36
|
+
default: str = "index",
|
|
37
|
+
max_length: int = MAX_FILENAME_LENGTH,
|
|
38
|
+
) -> str:
|
|
39
|
+
r"""Sanitize a URL path into a safe filename that is safe for
|
|
40
|
+
most platforms.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
url_name (str): The URL path to sanitize.
|
|
44
|
+
default (str): Default name if sanitization results in empty string.
|
|
45
|
+
(default: :obj:`"index"`)
|
|
46
|
+
max_length (int): Maximum length of the filename.
|
|
47
|
+
(default: :obj:`MAX_FILENAME_LENGTH`)
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
str: A sanitized filename safe for most platforms.
|
|
51
|
+
"""
|
|
52
|
+
if max_length < 1:
|
|
53
|
+
raise ValueError(
|
|
54
|
+
f"`max_length` must be greater than " f"0, got {max_length}"
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
if not url_name:
|
|
58
|
+
return default
|
|
59
|
+
|
|
60
|
+
# Normalize Unicode characters by removing characters
|
|
61
|
+
# such as accents and special characters:
|
|
62
|
+
# café☕.txt -> cafe.txt
|
|
63
|
+
url_name = unicodedata.normalize('NFKD', url_name)
|
|
64
|
+
url_name = url_name.encode('ASCII', 'ignore').decode('ASCII')
|
|
65
|
+
|
|
66
|
+
# Replace special characters such as:
|
|
67
|
+
# Separators: my/file:name*.txt -> my_file_name.txt etc.
|
|
68
|
+
url_name = re.sub(r'[\\/:*?"<>|.]', '_', url_name)
|
|
69
|
+
url_name = re.sub(r'_+', '_', url_name) # Collapse multiple underscores
|
|
70
|
+
url_name = url_name.strip('_') # Remove leading/trailing underscores
|
|
71
|
+
|
|
72
|
+
# Handle empty result if all characters are invalid:
|
|
73
|
+
if not url_name:
|
|
74
|
+
return default
|
|
75
|
+
|
|
76
|
+
# Handle Windows reserved names
|
|
77
|
+
if platform.system() == "Windows" and url_name.upper() in WINDOWS_RESERVED:
|
|
78
|
+
url_name = f"_{url_name}"
|
|
79
|
+
|
|
80
|
+
return url_name[:max_length]
|
camel/verifiers/__init__.py
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
from .base import BaseVerifier
|
|
15
15
|
from .math_verifier import MathVerifier
|
|
16
16
|
from .models import VerificationOutcome
|
|
17
|
+
from .physics_verifier import PhysicsVerifier
|
|
17
18
|
from .python_verifier import PythonVerifier
|
|
18
19
|
|
|
19
20
|
__all__ = [
|
|
@@ -21,4 +22,5 @@ __all__ = [
|
|
|
21
22
|
"VerificationOutcome",
|
|
22
23
|
"PythonVerifier",
|
|
23
24
|
"MathVerifier",
|
|
25
|
+
"PhysicsVerifier",
|
|
24
26
|
]
|