camel-ai 0.2.74a5__py3-none-any.whl → 0.2.75a0__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/interpreters/e2b_interpreter.py +34 -1
- camel/models/aiml_model.py +1 -16
- camel/models/anthropic_model.py +6 -22
- camel/models/aws_bedrock_model.py +1 -16
- camel/models/azure_openai_model.py +1 -16
- camel/models/base_model.py +0 -12
- camel/models/cohere_model.py +1 -16
- camel/models/crynux_model.py +1 -16
- camel/models/deepseek_model.py +1 -16
- camel/models/gemini_model.py +1 -16
- camel/models/groq_model.py +1 -17
- camel/models/internlm_model.py +1 -16
- camel/models/litellm_model.py +1 -16
- camel/models/lmstudio_model.py +1 -17
- camel/models/mistral_model.py +1 -16
- camel/models/modelscope_model.py +1 -16
- camel/models/moonshot_model.py +1 -16
- camel/models/nemotron_model.py +0 -5
- camel/models/netmind_model.py +1 -16
- camel/models/novita_model.py +1 -16
- camel/models/nvidia_model.py +1 -16
- camel/models/ollama_model.py +1 -16
- camel/models/openai_compatible_model.py +0 -3
- camel/models/openai_model.py +1 -16
- camel/models/openrouter_model.py +1 -17
- camel/models/ppio_model.py +1 -16
- camel/models/qianfan_model.py +1 -16
- camel/models/qwen_model.py +1 -16
- camel/models/reka_model.py +1 -16
- camel/models/samba_model.py +0 -32
- camel/models/sglang_model.py +1 -16
- camel/models/siliconflow_model.py +1 -16
- camel/models/stub_model.py +0 -4
- camel/models/togetherai_model.py +1 -16
- camel/models/vllm_model.py +1 -16
- camel/models/volcano_model.py +0 -17
- camel/models/watsonx_model.py +1 -16
- camel/models/yi_model.py +1 -16
- camel/models/zhipuai_model.py +1 -16
- camel/toolkits/hybrid_browser_toolkit/config_loader.py +3 -0
- camel/toolkits/hybrid_browser_toolkit/hybrid_browser_toolkit_ts.py +225 -0
- camel/toolkits/hybrid_browser_toolkit/ts/src/browser-session.ts +164 -8
- camel/toolkits/hybrid_browser_toolkit/ts/src/config-loader.ts +2 -0
- camel/toolkits/hybrid_browser_toolkit/ts/src/hybrid-browser-toolkit.ts +106 -1
- camel/toolkits/hybrid_browser_toolkit/ts/src/types.ts +19 -1
- camel/toolkits/hybrid_browser_toolkit/ts/websocket-server.js +20 -0
- camel/toolkits/hybrid_browser_toolkit/ws_wrapper.py +41 -0
- camel/toolkits/hybrid_browser_toolkit_py/actions.py +158 -0
- camel/toolkits/hybrid_browser_toolkit_py/browser_session.py +55 -8
- camel/toolkits/hybrid_browser_toolkit_py/config_loader.py +43 -0
- camel/toolkits/hybrid_browser_toolkit_py/hybrid_browser_toolkit.py +312 -3
- camel/toolkits/hybrid_browser_toolkit_py/snapshot.py +10 -4
- camel/toolkits/hybrid_browser_toolkit_py/unified_analyzer.js +45 -4
- camel/toolkits/search_toolkit.py +182 -30
- camel/types/enums.py +9 -0
- camel/utils/mcp.py +2 -2
- camel/utils/token_counting.py +13 -2
- {camel_ai-0.2.74a5.dist-info → camel_ai-0.2.75a0.dist-info}/METADATA +6 -6
- {camel_ai-0.2.74a5.dist-info → camel_ai-0.2.75a0.dist-info}/RECORD +62 -62
- {camel_ai-0.2.74a5.dist-info → camel_ai-0.2.75a0.dist-info}/WHEEL +0 -0
- {camel_ai-0.2.74a5.dist-info → camel_ai-0.2.75a0.dist-info}/licenses/LICENSE +0 -0
camel/__init__.py
CHANGED
|
@@ -28,6 +28,11 @@ class E2BInterpreter(BaseInterpreter):
|
|
|
28
28
|
Args:
|
|
29
29
|
require_confirm (bool, optional): If True, prompt user before running
|
|
30
30
|
code strings for security. (default: :obj:`True`)
|
|
31
|
+
|
|
32
|
+
Environment Variables:
|
|
33
|
+
E2B_API_KEY: The API key for authenticating with the E2B service.
|
|
34
|
+
E2B_DOMAIN: The base URL for the E2B API. If not provided,
|
|
35
|
+
will use the default E2B endpoint.
|
|
31
36
|
"""
|
|
32
37
|
|
|
33
38
|
_CODE_TYPE_MAPPING: ClassVar[Dict[str, Optional[str]]] = {
|
|
@@ -55,7 +60,35 @@ class E2BInterpreter(BaseInterpreter):
|
|
|
55
60
|
from e2b_code_interpreter import Sandbox
|
|
56
61
|
|
|
57
62
|
self.require_confirm = require_confirm
|
|
58
|
-
|
|
63
|
+
|
|
64
|
+
# Get API key from environment variable
|
|
65
|
+
api_key = os.environ.get("E2B_API_KEY")
|
|
66
|
+
|
|
67
|
+
# Get domain from environment variable
|
|
68
|
+
domain = os.environ.get("E2B_DOMAIN")
|
|
69
|
+
|
|
70
|
+
# Create sandbox with appropriate parameters
|
|
71
|
+
sandbox_kwargs = {"api_key": api_key}
|
|
72
|
+
|
|
73
|
+
# Only add domain if it's provided
|
|
74
|
+
# (to maintain compatibility with standard E2B)
|
|
75
|
+
if domain:
|
|
76
|
+
sandbox_kwargs["domain"] = domain
|
|
77
|
+
logger.info(f"Using custom E2B endpoint: {domain}")
|
|
78
|
+
|
|
79
|
+
try:
|
|
80
|
+
self._sandbox = Sandbox(**sandbox_kwargs)
|
|
81
|
+
except TypeError as e:
|
|
82
|
+
if domain and "domain" in str(e):
|
|
83
|
+
logger.warning(
|
|
84
|
+
f"The e2b_code_interpreter library doesn't support "
|
|
85
|
+
f"custom domain. "
|
|
86
|
+
f"Using default E2B endpoint. Error: {e}"
|
|
87
|
+
)
|
|
88
|
+
# Fallback to default configuration without domain
|
|
89
|
+
self._sandbox = Sandbox(api_key=api_key)
|
|
90
|
+
else:
|
|
91
|
+
raise e
|
|
59
92
|
|
|
60
93
|
def __del__(self) -> None:
|
|
61
94
|
r"""Destructor for the E2BInterpreter class.
|
camel/models/aiml_model.py
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import os
|
|
15
15
|
from typing import Any, Dict, Optional, Union
|
|
16
16
|
|
|
17
|
-
from camel.configs import
|
|
17
|
+
from camel.configs import AIMLConfig
|
|
18
18
|
from camel.models.openai_compatible_model import OpenAICompatibleModel
|
|
19
19
|
from camel.types import ModelType
|
|
20
20
|
from camel.utils import (
|
|
@@ -82,18 +82,3 @@ class AIMLModel(OpenAICompatibleModel):
|
|
|
82
82
|
max_retries=max_retries,
|
|
83
83
|
**kwargs,
|
|
84
84
|
)
|
|
85
|
-
|
|
86
|
-
def check_model_config(self):
|
|
87
|
-
r"""Check whether the model configuration contains any
|
|
88
|
-
unexpected arguments to AIML API.
|
|
89
|
-
|
|
90
|
-
Raises:
|
|
91
|
-
ValueError: If the model configuration dictionary contains any
|
|
92
|
-
unexpected arguments to AIML API.
|
|
93
|
-
"""
|
|
94
|
-
for param in self.model_config_dict:
|
|
95
|
-
if param not in AIML_API_PARAMS:
|
|
96
|
-
raise ValueError(
|
|
97
|
-
f"Unexpected argument `{param}` is "
|
|
98
|
-
"input into AIML model backend."
|
|
99
|
-
)
|
camel/models/anthropic_model.py
CHANGED
|
@@ -16,13 +16,13 @@ from typing import Any, Dict, List, Optional, Union
|
|
|
16
16
|
|
|
17
17
|
from openai import AsyncStream, Stream
|
|
18
18
|
|
|
19
|
-
from camel.configs import
|
|
19
|
+
from camel.configs import AnthropicConfig
|
|
20
20
|
from camel.messages import OpenAIMessage
|
|
21
21
|
from camel.models.openai_compatible_model import OpenAICompatibleModel
|
|
22
22
|
from camel.types import ChatCompletion, ChatCompletionChunk, ModelType
|
|
23
23
|
from camel.utils import (
|
|
24
|
-
AnthropicTokenCounter,
|
|
25
24
|
BaseTokenCounter,
|
|
25
|
+
OpenAITokenCounter,
|
|
26
26
|
api_keys_required,
|
|
27
27
|
dependencies_required,
|
|
28
28
|
)
|
|
@@ -141,31 +141,15 @@ class AnthropicModel(OpenAICompatibleModel):
|
|
|
141
141
|
r"""Initialize the token counter for the model backend.
|
|
142
142
|
|
|
143
143
|
Returns:
|
|
144
|
-
|
|
144
|
+
OpenAITokenCounter: The token counter following the model's
|
|
145
145
|
tokenization style.
|
|
146
146
|
"""
|
|
147
|
+
# TODO: use anthropic token counter
|
|
148
|
+
|
|
147
149
|
if not self._token_counter:
|
|
148
|
-
|
|
149
|
-
self._token_counter = AnthropicTokenCounter(
|
|
150
|
-
self.model_type, api_key=self._api_key
|
|
151
|
-
)
|
|
150
|
+
self._token_counter = OpenAITokenCounter(ModelType.GPT_4O_MINI)
|
|
152
151
|
return self._token_counter
|
|
153
152
|
|
|
154
|
-
def check_model_config(self):
|
|
155
|
-
r"""Check whether the model configuration is valid for anthropic
|
|
156
|
-
model backends.
|
|
157
|
-
|
|
158
|
-
Raises:
|
|
159
|
-
ValueError: If the model configuration dictionary contains any
|
|
160
|
-
unexpected arguments to Anthropic API.
|
|
161
|
-
"""
|
|
162
|
-
for param in self.model_config_dict:
|
|
163
|
-
if param not in ANTHROPIC_API_PARAMS:
|
|
164
|
-
raise ValueError(
|
|
165
|
-
f"Unexpected argument `{param}` is "
|
|
166
|
-
"input into Anthropic model backend."
|
|
167
|
-
)
|
|
168
|
-
|
|
169
153
|
def _request_chat_completion(
|
|
170
154
|
self,
|
|
171
155
|
messages: List[OpenAIMessage],
|
|
@@ -18,7 +18,7 @@ from typing import Any, Dict, List, Optional, Type, Union
|
|
|
18
18
|
from openai import AsyncStream
|
|
19
19
|
from pydantic import BaseModel
|
|
20
20
|
|
|
21
|
-
from camel.configs import
|
|
21
|
+
from camel.configs import BedrockConfig
|
|
22
22
|
from camel.messages import OpenAIMessage
|
|
23
23
|
from camel.models.openai_compatible_model import OpenAICompatibleModel
|
|
24
24
|
from camel.types import (
|
|
@@ -103,18 +103,3 @@ class AWSBedrockModel(OpenAICompatibleModel):
|
|
|
103
103
|
raise NotImplementedError(
|
|
104
104
|
"AWS Bedrock does not support async inference."
|
|
105
105
|
)
|
|
106
|
-
|
|
107
|
-
def check_model_config(self):
|
|
108
|
-
r"""Check whether the input model configuration contains unexpected
|
|
109
|
-
arguments.
|
|
110
|
-
|
|
111
|
-
Raises:
|
|
112
|
-
ValueError: If the model configuration dictionary contains any
|
|
113
|
-
unexpected argument for this model class.
|
|
114
|
-
"""
|
|
115
|
-
for param in self.model_config_dict:
|
|
116
|
-
if param not in BEDROCK_API_PARAMS:
|
|
117
|
-
raise ValueError(
|
|
118
|
-
f"Invalid parameter '{param}' in model_config_dict. "
|
|
119
|
-
f"Valid parameters are: {BEDROCK_API_PARAMS}"
|
|
120
|
-
)
|
|
@@ -22,7 +22,7 @@ from openai.lib.streaming.chat import (
|
|
|
22
22
|
)
|
|
23
23
|
from pydantic import BaseModel
|
|
24
24
|
|
|
25
|
-
from camel.configs import
|
|
25
|
+
from camel.configs import ChatGPTConfig
|
|
26
26
|
from camel.messages import OpenAIMessage
|
|
27
27
|
from camel.models.base_model import BaseModelBackend
|
|
28
28
|
from camel.types import (
|
|
@@ -452,21 +452,6 @@ class AzureOpenAIModel(BaseModelBackend):
|
|
|
452
452
|
**request_config,
|
|
453
453
|
)
|
|
454
454
|
|
|
455
|
-
def check_model_config(self):
|
|
456
|
-
r"""Check whether the model configuration contains any
|
|
457
|
-
unexpected arguments to Azure OpenAI API.
|
|
458
|
-
|
|
459
|
-
Raises:
|
|
460
|
-
ValueError: If the model configuration dictionary contains any
|
|
461
|
-
unexpected arguments to Azure OpenAI API.
|
|
462
|
-
"""
|
|
463
|
-
for param in self.model_config_dict:
|
|
464
|
-
if param not in OPENAI_API_PARAMS:
|
|
465
|
-
raise ValueError(
|
|
466
|
-
f"Unexpected argument `{param}` is "
|
|
467
|
-
"input into Azure OpenAI model backend."
|
|
468
|
-
)
|
|
469
|
-
|
|
470
455
|
@property
|
|
471
456
|
def stream(self) -> bool:
|
|
472
457
|
r"""Returns whether the model is in stream mode,
|
camel/models/base_model.py
CHANGED
|
@@ -105,7 +105,6 @@ class BaseModelBackend(ABC, metaclass=ModelBackendMeta):
|
|
|
105
105
|
== "true"
|
|
106
106
|
)
|
|
107
107
|
self._log_dir = os.environ.get("CAMEL_LOG_DIR", "camel_logs")
|
|
108
|
-
self.check_model_config()
|
|
109
108
|
|
|
110
109
|
@property
|
|
111
110
|
@abstractmethod
|
|
@@ -457,17 +456,6 @@ class BaseModelBackend(ABC, metaclass=ModelBackendMeta):
|
|
|
457
456
|
|
|
458
457
|
return result
|
|
459
458
|
|
|
460
|
-
@abstractmethod
|
|
461
|
-
def check_model_config(self):
|
|
462
|
-
r"""Check whether the input model configuration contains unexpected
|
|
463
|
-
arguments
|
|
464
|
-
|
|
465
|
-
Raises:
|
|
466
|
-
ValueError: If the model configuration dictionary contains any
|
|
467
|
-
unexpected argument for this model class.
|
|
468
|
-
"""
|
|
469
|
-
pass
|
|
470
|
-
|
|
471
459
|
def count_tokens_from_messages(self, messages: List[OpenAIMessage]) -> int:
|
|
472
460
|
r"""Count the number of tokens in the messages using the specific
|
|
473
461
|
tokenizer.
|
camel/models/cohere_model.py
CHANGED
|
@@ -26,7 +26,7 @@ if TYPE_CHECKING:
|
|
|
26
26
|
ChatResponse,
|
|
27
27
|
)
|
|
28
28
|
|
|
29
|
-
from camel.configs import
|
|
29
|
+
from camel.configs import CohereConfig
|
|
30
30
|
from camel.messages import OpenAIMessage
|
|
31
31
|
from camel.models import BaseModelBackend
|
|
32
32
|
from camel.models._utils import try_modify_message_with_format
|
|
@@ -454,21 +454,6 @@ class CohereModel(BaseModelBackend):
|
|
|
454
454
|
|
|
455
455
|
return openai_response
|
|
456
456
|
|
|
457
|
-
def check_model_config(self):
|
|
458
|
-
r"""Check whether the model configuration contains any unexpected
|
|
459
|
-
arguments to Cohere API.
|
|
460
|
-
|
|
461
|
-
Raises:
|
|
462
|
-
ValueError: If the model configuration dictionary contains any
|
|
463
|
-
unexpected arguments to Cohere API.
|
|
464
|
-
"""
|
|
465
|
-
for param in self.model_config_dict:
|
|
466
|
-
if param not in COHERE_API_PARAMS:
|
|
467
|
-
raise ValueError(
|
|
468
|
-
f"Unexpected argument `{param}` is "
|
|
469
|
-
"input into Cohere model backend."
|
|
470
|
-
)
|
|
471
|
-
|
|
472
457
|
@property
|
|
473
458
|
def stream(self) -> bool:
|
|
474
459
|
r"""Returns whether the model is in stream mode, which sends partial
|
camel/models/crynux_model.py
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import os
|
|
16
16
|
from typing import Any, Dict, Optional, Union
|
|
17
17
|
|
|
18
|
-
from camel.configs import
|
|
18
|
+
from camel.configs import CrynuxConfig
|
|
19
19
|
from camel.models.openai_compatible_model import OpenAICompatibleModel
|
|
20
20
|
from camel.types import ModelType
|
|
21
21
|
from camel.utils import (
|
|
@@ -85,18 +85,3 @@ class CrynuxModel(OpenAICompatibleModel):
|
|
|
85
85
|
max_retries=max_retries,
|
|
86
86
|
**kwargs,
|
|
87
87
|
)
|
|
88
|
-
|
|
89
|
-
def check_model_config(self):
|
|
90
|
-
r"""Check whether the model configuration contains any
|
|
91
|
-
unexpected arguments to Crynux API.
|
|
92
|
-
|
|
93
|
-
Raises:
|
|
94
|
-
ValueError: If the model configuration dictionary contains any
|
|
95
|
-
unexpected arguments to Crynux API.
|
|
96
|
-
"""
|
|
97
|
-
for param in self.model_config_dict:
|
|
98
|
-
if param not in CRYNUX_API_PARAMS:
|
|
99
|
-
raise ValueError(
|
|
100
|
-
f"Unexpected argument `{param}` is "
|
|
101
|
-
"input into Crynux model backend."
|
|
102
|
-
)
|
camel/models/deepseek_model.py
CHANGED
|
@@ -18,7 +18,7 @@ from typing import Any, Dict, List, Optional, Type, Union
|
|
|
18
18
|
from openai import AsyncStream, Stream
|
|
19
19
|
from pydantic import BaseModel
|
|
20
20
|
|
|
21
|
-
from camel.configs import
|
|
21
|
+
from camel.configs import DeepSeekConfig
|
|
22
22
|
from camel.logger import get_logger
|
|
23
23
|
from camel.messages import OpenAIMessage
|
|
24
24
|
from camel.models._utils import try_modify_message_with_format
|
|
@@ -287,18 +287,3 @@ class DeepSeekModel(OpenAICompatibleModel):
|
|
|
287
287
|
)
|
|
288
288
|
|
|
289
289
|
return self._post_handle_response(response)
|
|
290
|
-
|
|
291
|
-
def check_model_config(self):
|
|
292
|
-
r"""Check whether the model configuration contains any
|
|
293
|
-
unexpected arguments to DeepSeek API.
|
|
294
|
-
|
|
295
|
-
Raises:
|
|
296
|
-
ValueError: If the model configuration dictionary contains any
|
|
297
|
-
unexpected arguments to DeepSeek API.
|
|
298
|
-
"""
|
|
299
|
-
for param in self.model_config_dict:
|
|
300
|
-
if param not in DEEPSEEK_API_PARAMS:
|
|
301
|
-
raise ValueError(
|
|
302
|
-
f"Unexpected argument `{param}` is "
|
|
303
|
-
"input into DeepSeek model backend."
|
|
304
|
-
)
|
camel/models/gemini_model.py
CHANGED
|
@@ -17,7 +17,7 @@ from typing import Any, Dict, List, Optional, Type, Union
|
|
|
17
17
|
from openai import AsyncStream, Stream
|
|
18
18
|
from pydantic import BaseModel
|
|
19
19
|
|
|
20
|
-
from camel.configs import
|
|
20
|
+
from camel.configs import GeminiConfig
|
|
21
21
|
from camel.messages import OpenAIMessage
|
|
22
22
|
from camel.models.openai_compatible_model import OpenAICompatibleModel
|
|
23
23
|
from camel.types import (
|
|
@@ -335,18 +335,3 @@ class GeminiModel(OpenAICompatibleModel):
|
|
|
335
335
|
model=self.model_type,
|
|
336
336
|
**request_config,
|
|
337
337
|
)
|
|
338
|
-
|
|
339
|
-
def check_model_config(self):
|
|
340
|
-
r"""Check whether the model configuration contains any
|
|
341
|
-
unexpected arguments to Gemini API.
|
|
342
|
-
|
|
343
|
-
Raises:
|
|
344
|
-
ValueError: If the model configuration dictionary contains any
|
|
345
|
-
unexpected arguments to Gemini API.
|
|
346
|
-
"""
|
|
347
|
-
for param in self.model_config_dict:
|
|
348
|
-
if param not in Gemini_API_PARAMS:
|
|
349
|
-
raise ValueError(
|
|
350
|
-
f"Unexpected argument `{param}` is "
|
|
351
|
-
"input into Gemini model backend."
|
|
352
|
-
)
|
camel/models/groq_model.py
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import os
|
|
15
15
|
from typing import Any, Dict, Optional, Union
|
|
16
16
|
|
|
17
|
-
from camel.configs import
|
|
17
|
+
from camel.configs import GroqConfig
|
|
18
18
|
from camel.models.openai_compatible_model import OpenAICompatibleModel
|
|
19
19
|
from camel.types import ModelType
|
|
20
20
|
from camel.utils import (
|
|
@@ -80,19 +80,3 @@ class GroqModel(OpenAICompatibleModel):
|
|
|
80
80
|
max_retries=max_retries,
|
|
81
81
|
**kwargs,
|
|
82
82
|
)
|
|
83
|
-
|
|
84
|
-
def check_model_config(self):
|
|
85
|
-
r"""Check whether the model configuration contains any unexpected
|
|
86
|
-
arguments to Groq API. But Groq API does not have any additional
|
|
87
|
-
arguments to check.
|
|
88
|
-
|
|
89
|
-
Raises:
|
|
90
|
-
ValueError: If the model configuration dictionary contains any
|
|
91
|
-
unexpected arguments to Groq API.
|
|
92
|
-
"""
|
|
93
|
-
for param in self.model_config_dict:
|
|
94
|
-
if param not in GROQ_API_PARAMS:
|
|
95
|
-
raise ValueError(
|
|
96
|
-
f"Unexpected argument `{param}` is "
|
|
97
|
-
"input into Groq model backend."
|
|
98
|
-
)
|
camel/models/internlm_model.py
CHANGED
|
@@ -18,7 +18,7 @@ from typing import Any, Dict, List, Optional, Type, Union
|
|
|
18
18
|
from openai import AsyncStream
|
|
19
19
|
from pydantic import BaseModel
|
|
20
20
|
|
|
21
|
-
from camel.configs import
|
|
21
|
+
from camel.configs import InternLMConfig
|
|
22
22
|
from camel.messages import OpenAIMessage
|
|
23
23
|
from camel.models.openai_compatible_model import OpenAICompatibleModel
|
|
24
24
|
from camel.types import (
|
|
@@ -101,18 +101,3 @@ class InternLMModel(OpenAICompatibleModel):
|
|
|
101
101
|
tools: Optional[List[Dict[str, Any]]] = None,
|
|
102
102
|
) -> Union[ChatCompletion, AsyncStream[ChatCompletionChunk]]:
|
|
103
103
|
raise NotImplementedError("InternLM does not support async inference.")
|
|
104
|
-
|
|
105
|
-
def check_model_config(self):
|
|
106
|
-
r"""Check whether the model configuration contains any
|
|
107
|
-
unexpected arguments to InternLM API.
|
|
108
|
-
|
|
109
|
-
Raises:
|
|
110
|
-
ValueError: If the model configuration dictionary contains any
|
|
111
|
-
unexpected arguments to InternLM API.
|
|
112
|
-
"""
|
|
113
|
-
for param in self.model_config_dict:
|
|
114
|
-
if param not in INTERNLM_API_PARAMS:
|
|
115
|
-
raise ValueError(
|
|
116
|
-
f"Unexpected argument `{param}` is "
|
|
117
|
-
"input into InternLM model backend."
|
|
118
|
-
)
|
camel/models/litellm_model.py
CHANGED
|
@@ -17,7 +17,7 @@ from typing import Any, Dict, List, Optional, Type, Union
|
|
|
17
17
|
|
|
18
18
|
from pydantic import BaseModel
|
|
19
19
|
|
|
20
|
-
from camel.configs import
|
|
20
|
+
from camel.configs import LiteLLMConfig
|
|
21
21
|
from camel.messages import OpenAIMessage
|
|
22
22
|
from camel.models import BaseModelBackend
|
|
23
23
|
from camel.types import ChatCompletion, ModelType
|
|
@@ -217,18 +217,3 @@ class LiteLLMModel(BaseModelBackend):
|
|
|
217
217
|
usage=response.usage,
|
|
218
218
|
)
|
|
219
219
|
return response
|
|
220
|
-
|
|
221
|
-
def check_model_config(self):
|
|
222
|
-
r"""Check whether the model configuration contains any unexpected
|
|
223
|
-
arguments to LiteLLM API.
|
|
224
|
-
|
|
225
|
-
Raises:
|
|
226
|
-
ValueError: If the model configuration dictionary contains any
|
|
227
|
-
unexpected arguments.
|
|
228
|
-
"""
|
|
229
|
-
for param in self.model_config_dict:
|
|
230
|
-
if param not in LITELLM_API_PARAMS:
|
|
231
|
-
raise ValueError(
|
|
232
|
-
f"Unexpected argument `{param}` is "
|
|
233
|
-
"input into LiteLLM model backend."
|
|
234
|
-
)
|
camel/models/lmstudio_model.py
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import os
|
|
15
15
|
from typing import Any, Dict, Optional, Union
|
|
16
16
|
|
|
17
|
-
from camel.configs import
|
|
17
|
+
from camel.configs import LMStudioConfig
|
|
18
18
|
from camel.models.openai_compatible_model import OpenAICompatibleModel
|
|
19
19
|
from camel.types import ModelType
|
|
20
20
|
from camel.utils import BaseTokenCounter
|
|
@@ -77,19 +77,3 @@ class LMStudioModel(OpenAICompatibleModel):
|
|
|
77
77
|
max_retries=max_retries,
|
|
78
78
|
**kwargs,
|
|
79
79
|
)
|
|
80
|
-
|
|
81
|
-
def check_model_config(self):
|
|
82
|
-
r"""Check whether the model configuration contains any unexpected
|
|
83
|
-
arguments to LMStudio API. But LMStudio API does not have any
|
|
84
|
-
additional arguments to check.
|
|
85
|
-
|
|
86
|
-
Raises:
|
|
87
|
-
ValueError: If the model configuration dictionary contains any
|
|
88
|
-
unexpected arguments to LMStudio API.
|
|
89
|
-
"""
|
|
90
|
-
for param in self.model_config_dict:
|
|
91
|
-
if param not in LMSTUDIO_API_PARAMS:
|
|
92
|
-
raise ValueError(
|
|
93
|
-
f"Unexpected argument `{param}` is "
|
|
94
|
-
"input into LMStudio model backend."
|
|
95
|
-
)
|
camel/models/mistral_model.py
CHANGED
|
@@ -24,7 +24,7 @@ if TYPE_CHECKING:
|
|
|
24
24
|
|
|
25
25
|
from openai import AsyncStream
|
|
26
26
|
|
|
27
|
-
from camel.configs import
|
|
27
|
+
from camel.configs import MistralConfig
|
|
28
28
|
from camel.logger import get_logger
|
|
29
29
|
from camel.messages import OpenAIMessage
|
|
30
30
|
from camel.models import BaseModelBackend
|
|
@@ -414,21 +414,6 @@ class MistralModel(BaseModelBackend):
|
|
|
414
414
|
|
|
415
415
|
return request_config
|
|
416
416
|
|
|
417
|
-
def check_model_config(self):
|
|
418
|
-
r"""Check whether the model configuration contains any
|
|
419
|
-
unexpected arguments to Mistral API.
|
|
420
|
-
|
|
421
|
-
Raises:
|
|
422
|
-
ValueError: If the model configuration dictionary contains any
|
|
423
|
-
unexpected arguments to Mistral API.
|
|
424
|
-
"""
|
|
425
|
-
for param in self.model_config_dict:
|
|
426
|
-
if param not in MISTRAL_API_PARAMS:
|
|
427
|
-
raise ValueError(
|
|
428
|
-
f"Unexpected argument `{param}` is "
|
|
429
|
-
"input into Mistral model backend."
|
|
430
|
-
)
|
|
431
|
-
|
|
432
417
|
@property
|
|
433
418
|
def stream(self) -> bool:
|
|
434
419
|
r"""Returns whether the model is in stream mode, which sends partial
|
camel/models/modelscope_model.py
CHANGED
|
@@ -18,7 +18,7 @@ from typing import Any, Dict, List, Optional, Union
|
|
|
18
18
|
|
|
19
19
|
from openai import AsyncStream, Stream
|
|
20
20
|
|
|
21
|
-
from camel.configs import
|
|
21
|
+
from camel.configs import ModelScopeConfig
|
|
22
22
|
from camel.messages import OpenAIMessage
|
|
23
23
|
from camel.models.openai_compatible_model import OpenAICompatibleModel
|
|
24
24
|
from camel.types import (
|
|
@@ -261,18 +261,3 @@ class ModelScopeModel(OpenAICompatibleModel):
|
|
|
261
261
|
**request_config,
|
|
262
262
|
)
|
|
263
263
|
return self._post_handle_response(response)
|
|
264
|
-
|
|
265
|
-
def check_model_config(self):
|
|
266
|
-
r"""Check whether the model configuration contains any
|
|
267
|
-
unexpected arguments to ModelScope API.
|
|
268
|
-
|
|
269
|
-
Raises:
|
|
270
|
-
ValueError: If the model configuration dictionary contains any
|
|
271
|
-
unexpected arguments to ModelScope API.
|
|
272
|
-
"""
|
|
273
|
-
for param in self.model_config_dict:
|
|
274
|
-
if param not in MODELSCOPE_API_PARAMS:
|
|
275
|
-
raise ValueError(
|
|
276
|
-
f"Unexpected argument `{param}` is "
|
|
277
|
-
"input into ModelScope model backend."
|
|
278
|
-
)
|
camel/models/moonshot_model.py
CHANGED
|
@@ -18,7 +18,7 @@ from typing import Any, Dict, List, Optional, Type, Union
|
|
|
18
18
|
from openai import AsyncStream
|
|
19
19
|
from pydantic import BaseModel
|
|
20
20
|
|
|
21
|
-
from camel.configs import
|
|
21
|
+
from camel.configs import MoonshotConfig
|
|
22
22
|
from camel.messages import OpenAIMessage
|
|
23
23
|
from camel.models._utils import try_modify_message_with_format
|
|
24
24
|
from camel.models.openai_compatible_model import OpenAICompatibleModel
|
|
@@ -183,18 +183,3 @@ class MoonshotModel(OpenAICompatibleModel):
|
|
|
183
183
|
model=self.model_type,
|
|
184
184
|
**request_config,
|
|
185
185
|
)
|
|
186
|
-
|
|
187
|
-
def check_model_config(self):
|
|
188
|
-
r"""Check whether the model configuration contains any
|
|
189
|
-
unexpected arguments to Moonshot API.
|
|
190
|
-
|
|
191
|
-
Raises:
|
|
192
|
-
ValueError: If the model configuration dictionary contains any
|
|
193
|
-
unexpected arguments to Moonshot API.
|
|
194
|
-
"""
|
|
195
|
-
for param in self.model_config_dict:
|
|
196
|
-
if param not in MOONSHOT_API_PARAMS:
|
|
197
|
-
raise ValueError(
|
|
198
|
-
f"Unexpected argument `{param}` is "
|
|
199
|
-
"input into Moonshot model backend."
|
|
200
|
-
)
|
camel/models/nemotron_model.py
CHANGED
camel/models/netmind_model.py
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import os
|
|
16
16
|
from typing import Any, Dict, Optional, Union
|
|
17
17
|
|
|
18
|
-
from camel.configs import
|
|
18
|
+
from camel.configs import NetmindConfig
|
|
19
19
|
from camel.models.openai_compatible_model import OpenAICompatibleModel
|
|
20
20
|
from camel.types import ModelType
|
|
21
21
|
from camel.utils import (
|
|
@@ -87,18 +87,3 @@ class NetmindModel(OpenAICompatibleModel):
|
|
|
87
87
|
max_retries=max_retries,
|
|
88
88
|
**kwargs,
|
|
89
89
|
)
|
|
90
|
-
|
|
91
|
-
def check_model_config(self):
|
|
92
|
-
r"""Check whether the model configuration contains any
|
|
93
|
-
unexpected arguments to NETMIND API.
|
|
94
|
-
|
|
95
|
-
Raises:
|
|
96
|
-
ValueError: If the model configuration dictionary contains any
|
|
97
|
-
unexpected arguments to NETMIND API.
|
|
98
|
-
"""
|
|
99
|
-
for param in self.model_config_dict:
|
|
100
|
-
if param not in NETMIND_API_PARAMS:
|
|
101
|
-
raise ValueError(
|
|
102
|
-
f"Unexpected argument `{param}` is "
|
|
103
|
-
"input into NETMIND model backend."
|
|
104
|
-
)
|
camel/models/novita_model.py
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import os
|
|
16
16
|
from typing import Any, Dict, Optional, Union
|
|
17
17
|
|
|
18
|
-
from camel.configs import
|
|
18
|
+
from camel.configs import NovitaConfig
|
|
19
19
|
from camel.models.openai_compatible_model import OpenAICompatibleModel
|
|
20
20
|
from camel.types import ModelType
|
|
21
21
|
from camel.utils import (
|
|
@@ -86,18 +86,3 @@ class NovitaModel(OpenAICompatibleModel):
|
|
|
86
86
|
max_retries=max_retries,
|
|
87
87
|
**kwargs,
|
|
88
88
|
)
|
|
89
|
-
|
|
90
|
-
def check_model_config(self):
|
|
91
|
-
r"""Check whether the model configuration contains any
|
|
92
|
-
unexpected arguments to Novita API.
|
|
93
|
-
|
|
94
|
-
Raises:
|
|
95
|
-
ValueError: If the model configuration dictionary contains any
|
|
96
|
-
unexpected arguments to Novita API.
|
|
97
|
-
"""
|
|
98
|
-
for param in self.model_config_dict:
|
|
99
|
-
if param not in NOVITA_API_PARAMS:
|
|
100
|
-
raise ValueError(
|
|
101
|
-
f"Unexpected argument `{param}` is "
|
|
102
|
-
"input into Novita model backend."
|
|
103
|
-
)
|
camel/models/nvidia_model.py
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import os
|
|
16
16
|
from typing import Any, Dict, Optional, Union
|
|
17
17
|
|
|
18
|
-
from camel.configs import
|
|
18
|
+
from camel.configs import NvidiaConfig
|
|
19
19
|
from camel.models.openai_compatible_model import OpenAICompatibleModel
|
|
20
20
|
from camel.types import ModelType
|
|
21
21
|
from camel.utils import BaseTokenCounter, api_keys_required
|
|
@@ -82,18 +82,3 @@ class NvidiaModel(OpenAICompatibleModel):
|
|
|
82
82
|
max_retries=max_retries,
|
|
83
83
|
**kwargs,
|
|
84
84
|
)
|
|
85
|
-
|
|
86
|
-
def check_model_config(self):
|
|
87
|
-
r"""Check whether the model configuration contains any
|
|
88
|
-
unexpected arguments to NVIDIA API.
|
|
89
|
-
|
|
90
|
-
Raises:
|
|
91
|
-
ValueError: If the model configuration dictionary contains any
|
|
92
|
-
unexpected arguments to NVIDIA API.
|
|
93
|
-
"""
|
|
94
|
-
for param in self.model_config_dict:
|
|
95
|
-
if param not in NVIDIA_API_PARAMS:
|
|
96
|
-
raise ValueError(
|
|
97
|
-
f"Unexpected argument `{param}` is "
|
|
98
|
-
"input into NVIDIA model backend."
|
|
99
|
-
)
|
camel/models/ollama_model.py
CHANGED
|
@@ -15,7 +15,7 @@ import os
|
|
|
15
15
|
import subprocess
|
|
16
16
|
from typing import Any, Dict, Optional, Union
|
|
17
17
|
|
|
18
|
-
from camel.configs import
|
|
18
|
+
from camel.configs import OllamaConfig
|
|
19
19
|
from camel.logger import get_logger
|
|
20
20
|
from camel.models.openai_compatible_model import OpenAICompatibleModel
|
|
21
21
|
from camel.types import ModelType
|
|
@@ -102,18 +102,3 @@ class OllamaModel(OpenAICompatibleModel):
|
|
|
102
102
|
)
|
|
103
103
|
except Exception as e:
|
|
104
104
|
logger.error(f"Failed to start Ollama server: {e}.")
|
|
105
|
-
|
|
106
|
-
def check_model_config(self):
|
|
107
|
-
r"""Check whether the model configuration contains any
|
|
108
|
-
unexpected arguments to Ollama API.
|
|
109
|
-
|
|
110
|
-
Raises:
|
|
111
|
-
ValueError: If the model configuration dictionary contains any
|
|
112
|
-
unexpected arguments to OpenAI API.
|
|
113
|
-
"""
|
|
114
|
-
for param in self.model_config_dict:
|
|
115
|
-
if param not in OLLAMA_API_PARAMS:
|
|
116
|
-
raise ValueError(
|
|
117
|
-
f"Unexpected argument `{param}` is "
|
|
118
|
-
"input into Ollama model backend."
|
|
119
|
-
)
|