🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
Add xAI Grok 4.5 model support (#4161)
Tao Sun66ce3b08bd88
diff --git a/camel/types/enums.py b/camel/types/enums.pyindex 6c1e582c2..217445b3e 100644--- a/camel/types/enums.py+++ b/camel/types/enums.py@@ -114,6 +114,9 @@ class ModelType(UnifiedModelType, Enum):GROQ_LLAMA_3_1_8B = "llama-3.1-8b-instant"GROQ_LLAMA_3_3_70B = "llama-3.3-70b-versatile"+ # xAI platform models+ XAI_GROK_4_5 = "grok-4.5"+# Cerebras platform modelsCEREBRAS_GPT_OSS_120B = "gpt-oss-120b"CEREBRAS_LLAMA_3_1_8B = "llama3.1-8b"@@ -594,6 +597,7 @@ class ModelType(UnifiedModelType, Enum):return any([self.is_openai,+ self.is_xai,])@@ -626,6 +630,7 @@ class ModelType(UnifiedModelType, Enum):self.is_azure_openai,self.is_novita,self.is_avian,+ self.is_xai,])@@ -778,6 +783,13 @@ class ModelType(UnifiedModelType, Enum):ModelType.GROQ_LLAMA_3_3_70B,}+ @property+ def is_xai(self) -> bool:+ r"""Returns whether this type of models is served by xAI."""+ return self in {+ ModelType.XAI_GROK_4_5,+ }+@propertydef is_cerebras(self) -> bool:r"""Returns whether this type of models is served by Cerebras."""@@ -1706,6 +1718,10 @@ class ModelType(UnifiedModelType, Enum):ModelType.NETMIND_LLAMA_4_MAVERICK_17B_128E_INSTRUCT,}:return 512_000+ elif self in {+ ModelType.XAI_GROK_4_5,+ }:+ return 500_000elif self in {ModelType.GEMINI_3_1_PRO,ModelType.GEMINI_3_1_FLASH_LITE,diff --git a/examples/models/xai_model_example.py b/examples/models/xai_model_example.pyindex 2eb45dcfb..92348f552 100644--- a/examples/models/xai_model_example.py+++ b/examples/models/xai_model_example.py@@ -23,11 +23,11 @@ python examples/models/xai_model_example.pyfrom camel.agents import ChatAgentfrom camel.configs import XAIConfigfrom camel.models import ModelFactory-from camel.types import ModelPlatformType+from camel.types import ModelPlatformType, ModelTypemodel = ModelFactory.create(model_platform=ModelPlatformType.XAI,- model_type="grok-4.20-reasoning",+ model_type=ModelType.XAI_GROK_4_5,model_config_dict=XAIConfig(use_encrypted_content=True).as_dict(),)diff --git a/test/models/test_xai_model.py b/test/models/test_xai_model.pyindex 828f5d0cb..f9a0f6054 100644--- a/test/models/test_xai_model.py+++ b/test/models/test_xai_model.py@@ -15,6 +15,7 @@from types import MethodTypefrom camel.models.xai_model import XAIModel+from camel.types import ModelTypedef test_stream_to_chunks_handles_empty_stream():@@ -26,3 +27,11 @@ def test_stream_to_chunks_handles_empty_stream():model._make_chunk = MethodType(lambda self, **kwargs: kwargs, model)assert list(XAIModel._stream_to_chunks(model, iter([]), 0)) == []+++def test_grok_4_5_model_type_metadata():+ assert ModelType.XAI_GROK_4_5.value == "grok-4.5"+ assert ModelType.XAI_GROK_4_5.is_xai is True+ assert ModelType.XAI_GROK_4_5.token_limit == 500_000+ assert ModelType.XAI_GROK_4_5.support_native_tool_calling is True+ assert ModelType.XAI_GROK_4_5.support_native_structured_output is True