Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

fix: Ensure Enum values are properly defined in ModelPlatformType (#844)

mrsbeep28893ab82568
diff --git a/camel/types/enums.py b/camel/types/enums.py
index 7dd34fc9f..90f68ef33 100644
--- a/camel/types/enums.py
+++ b/camel/types/enums.py
@@ -436,7 +436,7 @@ class ModelPlatformType(Enum):
AZURE = "azure"
ANTHROPIC = "anthropic"
GROQ = "groq"
- OPENSOURCE = "open-source"
+ OPEN_SOURCE = "open-source"
OLLAMA = "ollama"
LITELLM = "litellm"
ZHIPU = "zhipuai"
@@ -444,7 +444,7 @@ class ModelPlatformType(Enum):
GEMINI = "gemini"
VLLM = "vllm"
MISTRAL = "mistral"
- OPENAICOMPATIBILITYMODEL = "openai-compatibility-model"
+ OPENAI_COMPATIBILITY_MODEL = "openai-compatibility-model"
@property
def is_openai(self) -> bool:
@@ -494,13 +494,13 @@ class ModelPlatformType(Enum):
@property
def is_open_source(self) -> bool:
r"""Returns whether this platform is opensource."""
- return self is ModelPlatformType.OPENSOURCE
+ return self is ModelPlatformType.OPEN_SOURCE
@property
def is_openai_compatibility_model(self) -> bool:
r"""Returns whether this is a platform supporting openai
compatibility"""
- return self is ModelPlatformType.OPENAICOMPATIBILITYMODEL
+ return self is ModelPlatformType.OPENAI_COMPATIBILITY_MODEL
@property
def is_gemini(self) -> bool:
diff --git a/docs/agents/single_agent.md b/docs/agents/single_agent.md
index 39c05941d..7135368d8 100644
--- a/docs/agents/single_agent.md
+++ b/docs/agents/single_agent.md
@@ -121,7 +121,7 @@ You can connect the agent with external database (as long-term memory) in which
from camel.models import ModelFactory
# Set the LLM model type and model config
- model_platform = ModelPlatformType.OPENSOURCE
+ model_platform = ModelPlatformType.OPEN_SOURCE
model_type = ModelType.LLAMA_2
model_config=OpenSourceConfig(
model_path='meta-llama/Llama-2-7b-chat-hf', # a local folder or HuggingFace repo Name
diff --git a/examples/models/openai_compatibility_model_example.py b/examples/models/openai_compatibility_model_example.py
index 4f1f1f00d..87f0b15f5 100644
--- a/examples/models/openai_compatibility_model_example.py
+++ b/examples/models/openai_compatibility_model_example.py
@@ -20,7 +20,7 @@ from camel.types import ModelPlatformType
# Take calling model from DashScope as an example
# Refer: https://dashscope.console.aliyun.com/overview
model = ModelFactory.create(
- model_platform=ModelPlatformType.OPENAICOMPATIBILITYMODEL,
+ model_platform=ModelPlatformType.OPENAI_COMPATIBILITY_MODEL,
model_type="qwen-plus",
api_key="sk-xxxx",
url="https://dashscope.aliyuncs.com/compatible-mode/v1",
diff --git a/examples/models/role_playing_with_open_source_model.py b/examples/models/role_playing_with_open_source_model.py
index a6ddec554..e67dbb30b 100644
--- a/examples/models/role_playing_with_open_source_model.py
+++ b/examples/models/role_playing_with_open_source_model.py
@@ -26,7 +26,7 @@ from camel.utils import print_text_animated
# model_path = "lmsys/vicuna-7b-v1.5"
def main(
chat_turn_limit=50,
- model_platform=ModelPlatformType.OPENSOURCE,
+ model_platform=ModelPlatformType.OPEN_SOURCE,
model_type=ModelType.STUB,
model_path="meta-llama/Llama-2-7b-chat-hf",
server_url="http://localhost:8000/v1",
diff --git a/test/models/test_model_factory.py b/test/models/test_model_factory.py
index 88605dfa7..281e8e079 100644
--- a/test/models/test_model_factory.py
+++ b/test/models/test_model_factory.py
@@ -34,7 +34,7 @@ parametrize = pytest.mark.parametrize(
[
(ModelPlatformType.OPENAI, ModelType.GPT_3_5_TURBO),
(ModelPlatformType.OPENAI, ModelType.GPT_4_TURBO),
- (ModelPlatformType.OPENSOURCE, ModelType.STUB),
+ (ModelPlatformType.OPEN_SOURCE, ModelType.STUB),
],
)
@@ -62,7 +62,7 @@ parameterize_token_counter = pytest.mark.parametrize(
# Test Stub model
# Stub model uses StubTokenCounter as default
(
- ModelPlatformType.OPENSOURCE,
+ ModelPlatformType.OPEN_SOURCE,
ModelType.STUB,
ChatGPTConfig().as_dict(),
None,
@@ -70,7 +70,7 @@ parameterize_token_counter = pytest.mark.parametrize(
None,
),
(
- ModelPlatformType.OPENSOURCE,
+ ModelPlatformType.OPEN_SOURCE,
ModelType.STUB,
ChatGPTConfig().as_dict(),
OpenAITokenCounter(ModelType.GPT_4),
@@ -97,7 +97,7 @@ parameterize_token_counter = pytest.mark.parametrize(
),
# Test OpenSource model (take VICUNA as an example)
(
- ModelPlatformType.OPENSOURCE,
+ ModelPlatformType.OPEN_SOURCE,
ModelType.VICUNA,
OpenSourceConfig(
model_path="lmsys/vicuna-7b-v1.5",
@@ -108,7 +108,7 @@ parameterize_token_counter = pytest.mark.parametrize(
ModelType.VICUNA,
),
(
- ModelPlatformType.OPENSOURCE,
+ ModelPlatformType.OPEN_SOURCE,
ModelType.VICUNA,
OpenSourceConfig(
model_path="lmsys/vicuna-7b-v1.5",