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: string representation of `ModelType` (#1106)

Isaac Jine87211b77fea
diff --git a/camel/types/enums.py b/camel/types/enums.py
index 680830bde..12274583d 100644
--- a/camel/types/enums.py
+++ b/camel/types/enums.py
@@ -85,6 +85,9 @@ class ModelType(UnifiedModelType, Enum):
REKA_FLASH = "reka-flash"
REKA_EDGE = "reka-edge"
+ def __str__(self):
+ return self.value
+
def __new__(cls, value) -> "ModelType":
return cast("ModelType", UnifiedModelType.__new__(cls, value))
diff --git a/camel/types/unified_model_type.py b/camel/types/unified_model_type.py
index 880b31f97..369d2cce5 100644
--- a/camel/types/unified_model_type.py
+++ b/camel/types/unified_model_type.py
@@ -75,7 +75,7 @@ class UnifiedModelType(str):
@property
def is_groq(self) -> bool:
- r"""Returns whether the model is an Groq served model."""
+ r"""Returns whether the model is a Groq served model."""
return True
@property
diff --git a/test/models/test_model_type.py b/test/models/test_model_type.py
index b495a9428..364763907 100644
--- a/test/models/test_model_type.py
+++ b/test/models/test_model_type.py
@@ -17,12 +17,14 @@ from camel.types import ModelType, UnifiedModelType
def test_predefined_model():
model_type = UnifiedModelType("gpt-4o-mini")
assert model_type == ModelType.GPT_4O_MINI
+ assert f"test_prefix/{model_type}" == "test_prefix/gpt-4o-mini"
def test_duplicated_model_types():
model_type_1 = UnifiedModelType("random-open-source")
model_type_2 = UnifiedModelType("random-open-source")
assert id(model_type_1) == id(model_type_2)
+ assert f"test_prefix/{model_type_1}" == "test_prefix/random-open-source"
model_type_3 = UnifiedModelType(ModelType.GPT_4O_MINI)
model_type_4 = UnifiedModelType("gpt-4o-mini")