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

feat: Add llama3.3_70B model (#1306)

Will Shanga60a6829fa2a
diff --git a/camel/models/groq_model.py b/camel/models/groq_model.py
index 5295ec70c..407d2c5dc 100644
--- a/camel/models/groq_model.py
+++ b/camel/models/groq_model.py
@@ -63,7 +63,7 @@ class GroqModel(BaseModelBackend):
model_config_dict = GroqConfig().as_dict()
api_key = api_key or os.environ.get("GROQ_API_KEY")
url = url or os.environ.get(
- "GROQ_API_BASE_URL" or "https://api.groq.com/openai/v1"
+ "GROQ_API_BASE_URL", "https://api.groq.com/openai/v1"
)
super().__init__(
model_type, model_config_dict, api_key, url, token_counter
diff --git a/camel/types/enums.py b/camel/types/enums.py
index 5cca71285..00aa0b85f 100644
--- a/camel/types/enums.py
+++ b/camel/types/enums.py
@@ -41,9 +41,12 @@ class ModelType(UnifiedModelType, Enum):
GLM_4V = 'glm-4v'
GLM_3_TURBO = "glm-3-turbo"
+ # Groq platform models
GROQ_LLAMA_3_1_8B = "llama-3.1-8b-instant"
GROQ_LLAMA_3_1_70B = "llama-3.1-70b-versatile"
GROQ_LLAMA_3_1_405B = "llama-3.1-405b-reasoning"
+ GROQ_LLAMA_3_3_70B = "llama-3.3-70b-versatile"
+ GROQ_LLAMA_3_3_70B_PREVIEW = "llama-3.3-70b-specdec"
GROQ_LLAMA_3_8B = "llama3-8b-8192"
GROQ_LLAMA_3_70B = "llama3-70b-8192"
GROQ_MIXTRAL_8_7B = "mixtral-8x7b-32768"
@@ -76,6 +79,7 @@ class ModelType(UnifiedModelType, Enum):
NVIDIA_LLAMA3_1_405B_INSTRUCT = "meta/llama-3.1-405b-instruct"
NVIDIA_LLAMA3_2_1B_INSTRUCT = "meta/llama-3.2-1b-instruct"
NVIDIA_LLAMA3_2_3B_INSTRUCT = "meta/llama-3.2-3b-instruct"
+ NVIDIA_LLAMA3_3_70B_INSTRUCT = "meta/llama-3.3-70b-instruct"
# Gemini models
GEMINI_1_5_FLASH = "gemini-1.5-flash"
@@ -211,6 +215,8 @@ class ModelType(UnifiedModelType, Enum):
ModelType.GROQ_LLAMA_3_1_8B,
ModelType.GROQ_LLAMA_3_1_70B,
ModelType.GROQ_LLAMA_3_1_405B,
+ ModelType.GROQ_LLAMA_3_3_70B,
+ ModelType.GROQ_LLAMA_3_3_70B_PREVIEW,
ModelType.GROQ_LLAMA_3_8B,
ModelType.GROQ_LLAMA_3_70B,
ModelType.GROQ_MIXTRAL_8_7B,
@@ -249,6 +255,7 @@ class ModelType(UnifiedModelType, Enum):
ModelType.NVIDIA_LLAMA3_1_405B_INSTRUCT,
ModelType.NVIDIA_LLAMA3_2_1B_INSTRUCT,
ModelType.NVIDIA_LLAMA3_2_3B_INSTRUCT,
+ ModelType.NVIDIA_LLAMA3_3_70B_INSTRUCT,
}
@property
@@ -362,6 +369,7 @@ class ModelType(UnifiedModelType, Enum):
ModelType.GPT_4,
ModelType.GROQ_LLAMA_3_8B,
ModelType.GROQ_LLAMA_3_70B,
+ ModelType.GROQ_LLAMA_3_3_70B_PREVIEW,
ModelType.GROQ_GEMMA_7B_IT,
ModelType.GROQ_GEMMA_2_9B_IT,
ModelType.GLM_3_TURBO,
@@ -428,6 +436,8 @@ class ModelType(UnifiedModelType, Enum):
ModelType.NVIDIA_LLAMA3_1_405B_INSTRUCT,
ModelType.NVIDIA_LLAMA3_2_1B_INSTRUCT,
ModelType.NVIDIA_LLAMA3_2_3B_INSTRUCT,
+ ModelType.NVIDIA_LLAMA3_3_70B_INSTRUCT,
+ ModelType.GROQ_LLAMA_3_3_70B,
}:
return 128_000
elif self in {
diff --git a/examples/models/groq_model_example.py b/examples/models/groq_model_example.py
new file mode 100644
index 000000000..c193c9e87
--- /dev/null
+++ b/examples/models/groq_model_example.py
@@ -0,0 +1,48 @@
+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
+
+from camel.agents import ChatAgent
+from camel.configs import GroqConfig
+from camel.models import ModelFactory
+from camel.types import ModelPlatformType, ModelType
+
+model = ModelFactory.create(
+ model_platform=ModelPlatformType.GROQ,
+ model_type=ModelType.GROQ_LLAMA_3_3_70B,
+ model_config_dict=GroqConfig(temperature=0.2).as_dict(),
+)
+
+# Define system message
+sys_msg = "You are a helpful assistant."
+
+# Set agent
+camel_agent = ChatAgent(system_message=sys_msg, model=model)
+
+user_msg = """Say hi to CAMEL AI, one open-source community
+ dedicated to the study of autonomous and communicative agents."""
+
+# Get response information
+response = camel_agent.step(user_msg)
+print(response.msgs[0].content)
+
+'''
+===============================================================================
+Hello to the CAMEL AI community. It's great to see a group of like-minded
+individuals coming together to explore and advance the field of autonomous and
+communicative agents. Your open-source approach is truly commendable, as it
+fosters collaboration, innovation, and transparency. I'm excited to learn more
+about your projects and initiatives, and I'm happy to help in any way I can.
+Keep pushing the boundaries of AI research and development!
+===============================================================================
+'''
diff --git a/examples/models/nvidia_model_example.py b/examples/models/nvidia_model_example.py
index d61e481a2..415e2ab00 100644
--- a/examples/models/nvidia_model_example.py
+++ b/examples/models/nvidia_model_example.py
@@ -143,3 +143,22 @@ I hope this helps! Let me know if you have any questions or need
further assistance.
===============================================================================
'''
+
+model = ModelFactory.create(
+ model_platform=ModelPlatformType.NVIDIA,
+ model_type=ModelType.NVIDIA_LLAMA3_3_70B_INSTRUCT,
+ model_config_dict=NvidiaConfig(temperature=0.2).as_dict(),
+)
+
+# Define system message
+sys_msg = "You are a helpful assistant."
+
+# Set agent
+camel_agent = ChatAgent(system_message=sys_msg, model=model)
+
+user_msg = """Say hi to CAMEL AI, one open-source community
+ dedicated to the study of autonomous and communicative agents."""
+
+# Get response information
+response = camel_agent.step(user_msg)
+print(response.msgs[0].content)