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 ERNIE_5_0_THINKING model (#3459)

Tao Sun7cef48578232
diff --git a/camel/types/enums.py b/camel/types/enums.py
index 6525a1cf8..1b9eb5362 100644
--- a/camel/types/enums.py
+++ b/camel/types/enums.py
@@ -465,6 +465,9 @@ class ModelType(UnifiedModelType, Enum):
MODELSCOPE_LLAMA_3_3_70B_INSTRUCT = "LLM-Research/Llama-3.3-70B-Instruct"
MODELSCOPE_MINISTRAL_8B_INSTRUCT = "mistralai/Ministral-8B-Instruct-2410"
MODELSCOPE_DEEPSEEK_V3_0324 = "deepseek-ai/DeepSeek-V3-0324"
+ MODELSCOPE_ERNIE_4_5_VL_28B_A3B_THINKING = (
+ "PaddlePaddle/ERNIE-4.5-VL-28B-A3B-Thinking"
+ )
# WatsonX models
WATSONX_GRANITE_3_8B_INSTRUCT = "ibm/granite-3-8b-instruct"
@@ -491,6 +494,8 @@ class ModelType(UnifiedModelType, Enum):
DEEPSEEK_V3 = "deepseek-v3"
DEEPSEEK_R1 = "deepseek-r1"
QWEN3_235B_A22B = "qwen3-235b-a22b"
+ ERNIE_5_0_THINKING = "ernie-5.0-thinking-latest"
+ ERNIE_4_5_TURBO_VL = "ernie-4.5-turbo-vl-latest"
# Crynux models
CRYNUX_DEEPSEEK_R1_DISTILL_QWEN_1_5B = (
@@ -1007,6 +1012,7 @@ class ModelType(UnifiedModelType, Enum):
ModelType.MODELSCOPE_LLAMA_3_3_70B_INSTRUCT,
ModelType.MODELSCOPE_MINISTRAL_8B_INSTRUCT,
ModelType.MODELSCOPE_DEEPSEEK_V3_0324,
+ ModelType.MODELSCOPE_ERNIE_4_5_VL_28B_A3B_THINKING,
}
@property
@@ -1087,6 +1093,8 @@ class ModelType(UnifiedModelType, Enum):
ModelType.DEEPSEEK_V3,
ModelType.DEEPSEEK_R1,
ModelType.QWEN3_235B_A22B,
+ ModelType.ERNIE_5_0_THINKING,
+ ModelType.ERNIE_4_5_TURBO_VL,
}
@property
@@ -1474,6 +1482,9 @@ class ModelType(UnifiedModelType, Enum):
ModelType.SILICONFLOW_THUDM_GLM_4_32B_0414,
ModelType.SILICONFLOW_THUDM_GLM_Z1_RUMINATION_32B_0414,
ModelType.SILICONFLOW_THUDM_GLM_4_9B_0414,
+ ModelType.MODELSCOPE_ERNIE_4_5_VL_28B_A3B_THINKING,
+ ModelType.ERNIE_5_0_THINKING,
+ ModelType.ERNIE_4_5_TURBO_VL,
}:
return 128_000
elif self in {
diff --git a/docs/key_modules/models.md b/docs/key_modules/models.md
index d0a059a32..0cd751b4f 100644
--- a/docs/key_modules/models.md
+++ b/docs/key_modules/models.md
@@ -80,7 +80,7 @@ CAMEL supports a wide range of models, including [OpenAI’s GPT series](https:/
| **SiliconFlow** | [supported models](https://cloud.siliconflow.cn/me/models) |
| **AMD** | dvue-aoai-001-gpt-4.1 |
| **Volcano** | [supported models](https://console.volcengine.com/ark) |
-| **Qianfan** | [supported models](https://cloud.baidu.com/doc/qianfan-api/s/3m7of64lb) |
+| **Qianfan** | [supported models](https://cloud.baidu.com/doc/qianfan/s/rmh4stp0j) |
diff --git a/examples/models/qianfan_model_example.py b/examples/models/qianfan_model_example.py
index a5646c429..343167fa4 100644
--- a/examples/models/qianfan_model_example.py
+++ b/examples/models/qianfan_model_example.py
@@ -12,19 +12,16 @@
# limitations under the License.
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
-from colorama import Fore
-
from camel.agents import ChatAgent
from camel.configs import QianfanConfig
+from camel.messages import BaseMessage
from camel.models import ModelFactory
-from camel.societies import RolePlaying
from camel.types import ModelPlatformType, ModelType
-from camel.utils import print_text_animated
-# Create ERNIE 4.5 model configuration
+# Create ERNIE 5.0 Thinking model configuration
model = ModelFactory.create(
model_platform=ModelPlatformType.QIANFAN,
- model_type=ModelType.ERNIE_4_5_TURBO_128K,
+ model_type=ModelType.ERNIE_5_0_THINKING,
model_config_dict=QianfanConfig(temperature=0.2).as_dict(),
)
@@ -34,97 +31,241 @@ 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 believe that
-scaling up multi-agent systems is a pathway toward AGI. It's mission is:
-Finding the Scaling Laws of Agents. Intelligence emerges from diversity, not a
-single perfect principle. Multi-agent systems naturally follow "divide and
-conquer" approaches, breaking down complex problems across multiple
-specialized agents. Since 2023, they have been building the first multi-agent
-framework CAMEL"""
+user_msg = """Explain how Generative AI works."""
# Get response information
response = camel_agent.step(user_msg)
+print(response.msgs[0].reasoning_content)
+print("========================")
print(response.msgs[0].content)
'''
===============================================================================
-Hi, CAMEL-AI! It's fantastic to learn about your open - source community and
-your ambitious mission of finding the scaling laws of agents. The idea that
-intelligence emerges from diversity rather than a single perfect principle is
-quite intriguing and aligns with the complex nature of real - world problems.
-
-The "divide and conquer" approach of multi - agent systems to tackle complex
-problems by distributing tasks among specialized agents makes a lot of sense.
-It's impressive that you've been working on the CAMEL framework since 2023.
-I'm curious, what are some of the key challenges you've faced so far in
-building this multi - agent framework, and how do you plan to overcome them as
-you continue your journey toward understanding the scaling laws of agents?
-===============================================================================
-'''
+The user is asking for an explanation of how Generative AI works. This is a
+broad topic, so I should start with a simple analogy to make it accessible,
+then gradually introduce more technical details.
-# Using RolePlaying to simulate a role-playing session between a Computer
-# Programmer and a Gamer with ERNIE 4.5 Turbo 128K
-task_prompt = "Design a custom game using pygame"
-print(Fore.YELLOW + f"Original task prompt:\n{task_prompt}\n")
-role_play_session = RolePlaying(
- "Computer Programmer", "Gamer", task_prompt=task_prompt, model=model
-)
-print(Fore.CYAN + f"Specified task prompt:\n{role_play_session.task_prompt}\n")
+The analogy of a student learning from examples seems effective—it mirrors how
+generative models learn patterns from data. I can break it down into three key
+stages: training, learning representations, and generating new content.
-chat_turn_limit, n = 50, 0
-input_msg = role_play_session.init_chat()
-while n < chat_turn_limit:
- n += 1
- assistant_response, user_response = role_play_session.step(input_msg)
- print_text_animated(
- Fore.BLUE + f"AI User:\n\n{user_response.msg.content}\n"
- )
- print_text_animated(
- Fore.GREEN + "AI Assistant:\n\n" f"{assistant_response.msg.content}\n"
- )
+For the technical part, I should focus on the most common architectures like
+GANs and Transformers, since they represent distinct approaches (adversarial
+training vs. probabilistic modeling). It's important to highlight the role of
+latent space and probability distributions, as these are core to how
+generative models create novel outputs.
- if "CAMEL_TASK_DONE" in user_response.msg.content:
- break
+I'll wrap up with a concise summary to reinforce the main ideas. The goal is
+to balance clarity with depth, avoiding unnecessary jargon unless I explain
+it.
+========================
+Let's break down how Generative AI works, from a simple analogy to the
+technical core.
- input_msg = assistant_response.msg
+### The Simple Analogy: A Student Learning Art
-'''
-===============================================================================
-Original task prompt:
-Design a custom game using pygame
+Imagine a student who wants to learn to paint like "Impressionist Art."
+
+1. **Training**: You show this student thousands of paintings by Monet,
+Renoir, and others. They don't memorize any single painting. Instead, they
+start to understand the *concepts*: the brush strokes, the use of light,
+the color palettes, the common subjects (water lilies, Parisian streets).
+2. **Learning the "Essence"**: The student's brain forms an internal,
+abstract understanding of what makes an Impressionist painting. This
+isn't a specific image; it's the *idea* or *essence* of Impressionism.
+3. **Creating (Generating)**: Now, you ask the student: "Paint me a *new*
+picture in the style of Impressionism." Using their learned internal model,
+they create a completely original painting that has never existed before,
+but it still looks like a valid Impressionist piece because it follows the
+rules and patterns they learned.
+
+**Generative AI works exactly like this student.** It is trained on a massive
+dataset (e.g., all of Wikipedia, a huge collection of images, or a library of
+music). It doesn't store copies of this data; instead, it learns the
+underlying patterns, relationships, and "essence" of the data. Then,
+it uses this learned model to create new, original content that fits
+within those patterns.
+
+---
+
+### The Technical Core: How It Actually Works
+
+The "magic" happens through a type of machine learning model called a
+**neural network**, specifically designed for generation. The two most
+important architectures are **Generative Adversarial Networks (GANs)** and
+**Transformers** (which power models like GPT and DALL-E).
+Let's look at the process in three key stages:
+#### Stage 1: Training - Learning the Patterns
+
+The model is fed a colossal amount of data—text, images, audio, etc. The goal
+is for the model to learn the probability distribution of the data. In simpler
+terms, it learns what kinds of things are likely to appear together.
-Specified task prompt:
-Design a 2D platformer game using Pygame where the player controls a robot
-collecting energy crystals while avoiding traps and enemies, with multiple
-levels and a boss battle at the end.
+* **For Text**: It learns that the word "sky" is often followed by "is,"
+ "was," or "blue," and almost never by "photosynthesis."
+* **For Images**: It learns that in a face, eyes are usually above a nose,
+ and a nose is usually above a mouth. It learns the texture of fur, the
+ shape of a wheel, the reflection of light on water.
-AI User:
+#### Stage 2: The Model's Internal "World" (Latent Space)
-Instruction: Set up a basic Pygame project structure with a main game file
-named `main.py`.
-Input: None
+This is a crucial concept. The model doesn't just store a giant database of
+images or text. It compresses the information it learns into a much smaller,
+dense, and abstract mathematical representation called **latent space**.
-AI Assistant:
+Think of latent space as a vast map of all possible concepts the model has
+learned.
+* For a face-generating AI, this map would have regions for "smiling faces,"
+ "faces with glasses," "faces with long hair," etc.
+* Moving a little in one direction on this map might change a person's
+ expression from neutral to smiling. Moving in another direction might add
+ glasses.
-Solution: To set up a basic Pygame project structure, we'll start by creating
-a directory for our project and then add a main game file named `main.py`.
-This file will initialize Pygame, set up the display window, and include a
-basic game loop. Here's how you can structure it:
+This space is continuous, meaning every point in it corresponds to a valid
+piece of data (e.g., a specific face that doesn't exist but *could* exist).
-1. **Create a Project Directory**: Let's name our project directory
-`RobotPlatformer`.
+#### Stage 3: Generation - Creating Something New
-2. **Create `main.py`**: Inside the `RobotPlatformer` directory, create a file
-named `main.py`. This file will contain the core of our game.
+When you give a generative AI a prompt (e.g., "a cat wearing a top hat"), it
+uses this learned model and latent space to create a response.
-Here's a basic implementation for `main.py`:
+**Interpretation**: The model converts your text prompt into a mathematical
+representation that points to a specific region in its latent space. In
+this case, it's the area where "cat" and "top hat" concepts overlap.
-```python
-import pygame
-import sys
+**Sampling**: The model then picks a random point within that targeted
+region of the latent space. Because the space is continuous, this point is
+unique and haven't been seen before.
-# Initialize Pygame
-pygame.init()
-...
+**Decoding**: The model then works backwards, using its neural network as a
+"decoder." It takes this abstract point from latent space and gradually
+transforms it into a concrete output—pixel by pixel for an image, or word
+by word for text.
+
+This is why you can ask for "a photorealistic cat wearing a red top hat,
+sitting on a couch," and it will generate a unique image that fits that
+description. It's not copying and pasting; it's navigating its internal "map"
+of concepts to a new location and then rendering what that location looks like.
+
+---
+
+### Two Key Architectural Approaches
+
+1. **Generative Adversarial Networks (GANs) - Common for Images**
+* **How it works**: A GAN pits two neural networks against each other in a
+ game.
+* **The Generator**: Tries to create fake data (e.g., a fake human face).
+* **The Discriminator**: Tries to tell the difference between real data
+ (from the training set) and fake data from the Generator.
+* **The "Adversarial" Process**: The Generator gets better at fooling the
+ Discriminator, and the Discriminator gets better at catching fakes. This
+ competition drives both to become incredibly sophisticated, resulting in
+ highly realistic generated content.
+
+2. **Transformers & Autoregressive Models - Common for Text (e.g., ChatGPT)**
+* **How it works**: These models predict the next most likely piece of data
+ in a sequence.
+* **For Text**: Given the prompt "The cat sat on the," the model calculates
+ the probability for every possible next word. "Mat" might have a high
+ probability, "cloud" a very low one. It then selects a word (sometimes
+ introducing a bit of randomness for creativity) and repeats the process:
+ "The cat sat on the mat. It then..." and so on, word by word, until it
+ generates a complete response.
+* **For Images (like DALL-E)**: They can treat a n image as a sequence of
+ patches and predict the next patch based on the previous ones and the text
+ prompt.
+
+### Summary
+
+In a nutshell, Generative AI works by:
+
+1. **Training** on a massive dataset to learn the underlying patterns.
+2. **Compressing** this knowledge into an abstract mathematical space
+ (latent space).
+3. **Generating** new content by navigating this space based on a user's
+ prompt and then decoding that abstract point into a concrete output
+ (text, image, sound, etc.).
+
+It's a powerful form of pattern recognition and probabilistic creation, not
+conscious thought or understanding.
===============================================================================
'''
+
+# Create ERNIE 4.5 VL model configuration
+model = ModelFactory.create(
+ model_platform=ModelPlatformType.QIANFAN,
+ model_type=ModelType.ERNIE_4_5_TURBO_VL,
+ model_config_dict=QianfanConfig(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)
+
+image_list = [
+ "https://raw.githubusercontent.com/camel-ai/camel/master/misc/logo_light.png"
+]
+
+user_msg = BaseMessage.make_user_message(
+ role_name="User",
+ content="Please tell me what is in the image!",
+ image_list=image_list,
+)
+
+# Get response information
+response = camel_agent.step(user_msg)
+print(response.msgs[0].reasoning_content)
+print("========================")
+print(response.msgs[0].content)
+
+"""
+===============================================================================
+Okay, the user has shared an image with the logo of "CAMEL-AI" which features
+a stylized camel and the text "CAMEL-AI" in purple.
+First, I need to recognize that this is a brand logo. The camel is a
+well-known symbol associated with endurance and reliability, often used by
+brands that want to convey strength or dependability. The text is in
+uppercase, bold, and purple - a color that can represent creativity, wisdom,
+or luxury. The user's request is straightforward: they want to know what's in
+the image. Since this is a simple identification task, I should respond
+clearly and directly. No need for complex analysis unless the user asks for
+deeper interpretation. I notice the user didn't provide any context about
+why they're asking. Maybe they encountered this logo somewhere and got
+curious, or perhaps they're testing my recognition abilities. Either way,
+keeping the response simple and factual is best. The logo appears clean and
+professional - likely from a tech or AI company given the "-AI" suffix. But
+since the user didn't ask for brand analysis, I'll stick to basic description.
+Hmm, should I mention possible interpretations of the camel symbolism? Probably
+not - that would be overcomplicating a simple identification request. If the
+user wants more, they'll ask.
+Final decision: Just state the obvious elements - camel icon and "CAMEL-AI"
+text in purple. Keep it concise.
+
+========================
+The image shows the **logo for "CAMEL-AI"**, featuring two primary elements:
+
+1. **Stylized Camel Icon**:
+ On the left, a minimalist silhouette of a camel in **solid purple**.
+ The design is abstract, emphasizing the camel's distinctive hump and
+ profile with clean lines and no intricate details.
+
+2. **Text "CAMEL-AI"**:
+ To the right of the camel icon, the words "**CAMEL-AI**" are written in
+ **bold, uppercase purple letters**. The font is modern, sans-serif, and
+ evenly spaced, matching the camel icon's color for visual unity.
+
+### Key Details:
+- **Color Scheme**: Uniform purple (#4A248E or similar) on a white background,
+ creating high contrast and a professional aesthetic.
+- **Design Style**: Minimalist and geometric, prioritizing simplicity and
+ clarity.
+- **Symbolism**: The camel likely represents endurance, reliability, or
+"carrying" intelligence, while "-AI" explicitly denotes a focus on artificial
+intelligence.
+
+This logo likely represents a tech company, platform, or initiative bridging
+the identity of "Camel" with AI innovation.
+===============================================================================
+"""