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 new llm provider - ppio (#1991)

saikidevf53c50ec1625
diff --git a/camel/configs/__init__.py b/camel/configs/__init__.py
index 402ed0e0f..178a28aac 100644
--- a/camel/configs/__init__.py
+++ b/camel/configs/__init__.py
@@ -27,6 +27,7 @@ from .nvidia_config import NVIDIA_API_PARAMS, NvidiaConfig
from .ollama_config import OLLAMA_API_PARAMS, OllamaConfig
from .openai_config import OPENAI_API_PARAMS, ChatGPTConfig
from .openrouter_config import OPENROUTER_API_PARAMS, OpenRouterConfig
+from .ppio_config import PPIO_API_PARAMS, PPIOConfig
from .qwen_config import QWEN_API_PARAMS, QwenConfig
from .reka_config import REKA_API_PARAMS, RekaConfig
from .samba_config import (
@@ -82,6 +83,8 @@ __all__ = [
'QWEN_API_PARAMS',
'DeepSeekConfig',
'DEEPSEEK_API_PARAMS',
+ 'PPIOConfig',
+ 'PPIO_API_PARAMS',
'InternLMConfig',
'INTERNLM_API_PARAMS',
'MoonshotConfig',
diff --git a/camel/configs/ppio_config.py b/camel/configs/ppio_config.py
new file mode 100644
index 000000000..11f3e959d
--- /dev/null
+++ b/camel/configs/ppio_config.py
@@ -0,0 +1,105 @@
+# ========= 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 __future__ import annotations
+
+from typing import Any, Sequence, Union
+
+from pydantic import Field
+
+from camel.configs.base_config import BaseConfig
+from camel.types import NOT_GIVEN, NotGiven
+
+
+class PPIOConfig(BaseConfig):
+ r"""Defines the parameters for generating chat completions using the
+ OpenAI API.
+
+ Args:
+ temperature (float, optional): Sampling temperature to use, between
+ :obj:`0` and :obj:`2`. Higher values make the output more random,
+ while lower values make it more focused and deterministic.
+ (default: :obj:`0.2`)
+ top_p (float, optional): An alternative to sampling with temperature,
+ called nucleus sampling, where the model considers the results of
+ the tokens with top_p probability mass. So :obj:`0.1` means only
+ the tokens comprising the top 10% probability mass are considered.
+ (default: :obj:`1.0`)
+ n (int, optional): How many chat completion choices to generate for
+ each input message. (default: :obj:`1`)
+ response_format (object, optional): An object specifying the format
+ that the model must output. Compatible with GPT-4 Turbo and all
+ GPT-3.5 Turbo models newer than gpt-3.5-turbo-1106. Setting to
+ {"type": "json_object"} enables JSON mode, which guarantees the
+ message the model generates is valid JSON. Important: when using
+ JSON mode, you must also instruct the model to produce JSON
+ yourself via a system or user message. Without this, the model
+ may generate an unending stream of whitespace until the generation
+ reaches the token limit, resulting in a long-running and seemingly
+ "stuck" request. Also note that the message content may be
+ partially cut off if finish_reason="length", which indicates the
+ generation exceeded max_tokens or the conversation exceeded the
+ max context length.
+ stream (bool, optional): If True, partial message deltas will be sent
+ as data-only server-sent events as they become available.
+ (default: :obj:`False`)
+ stop (str or list, optional): Up to :obj:`4` sequences where the API
+ will stop generating further tokens. (default: :obj:`None`)
+ max_tokens (int, optional): The maximum number of tokens to generate
+ in the chat completion. The total length of input tokens and
+ generated tokens is limited by the model's context length.
+ (default: :obj:`None`)
+ presence_penalty (float, optional): Number between :obj:`-2.0` and
+ :obj:`2.0`. Positive values penalize new tokens based on whether
+ they appear in the text so far, increasing the model's likelihood
+ to talk about new topics. See more information about frequency and
+ presence penalties. (default: :obj:`0.0`)
+ frequency_penalty (float, optional): Number between :obj:`-2.0` and
+ :obj:`2.0`. Positive values penalize new tokens based on their
+ existing frequency in the text so far, decreasing the model's
+ likelihood to repeat the same line verbatim. See more information
+ about frequency and presence penalties. (default: :obj:`0.0`)
+ logit_bias (dict, optional): Modify the likelihood of specified tokens
+ appearing in the completion. Accepts a json object that maps tokens
+ (specified by their token ID in the tokenizer) to an associated
+ bias value from :obj:`-100` to :obj:`100`. Mathematically, the bias
+ is added to the logits generated by the model prior to sampling.
+ The exact effect will vary per model, but values between:obj:` -1`
+ and :obj:`1` should decrease or increase likelihood of selection;
+ values like :obj:`-100` or :obj:`100` should result in a ban or
+ exclusive selection of the relevant token. (default: :obj:`{}`)
+ user (str, optional): A unique identifier representing your end-user,
+ which can help OpenAI to monitor and detect abuse.
+ (default: :obj:`""`)
+ """
+
+ temperature: float = 0.2 # openai default: 1.0
+ top_p: float = 1.0
+ n: int = 1
+ stream: bool = False
+ stop: Union[str, Sequence[str], NotGiven] = NOT_GIVEN
+ max_tokens: Union[int, NotGiven] = NOT_GIVEN
+ presence_penalty: float = 0.0
+ response_format: Union[dict, NotGiven] = NOT_GIVEN
+ frequency_penalty: float = 0.0
+ logit_bias: dict = Field(default_factory=dict)
+ user: str = ""
+
+ def as_dict(self) -> dict[str, Any]:
+ config_dict = super().as_dict()
+ if "tools" in config_dict:
+ del config_dict["tools"] # Currently does not support tool calling
+ return config_dict
+
+
+PPIO_API_PARAMS = {param for param in PPIOConfig.model_fields.keys()}
diff --git a/camel/models/__init__.py b/camel/models/__init__.py
index 43d6ad9f5..0f77c3f0b 100644
--- a/camel/models/__init__.py
+++ b/camel/models/__init__.py
@@ -35,6 +35,7 @@ from .openai_audio_models import OpenAIAudioModels
from .openai_compatible_model import OpenAICompatibleModel
from .openai_model import OpenAIModel
from .openrouter_model import OpenRouterModel
+from .ppio_model import PPIOModel
from .qwen_model import QwenModel
from .reka_model import RekaModel
from .samba_model import SambaModel
@@ -72,6 +73,7 @@ __all__ = [
'RekaModel',
'SambaModel',
'TogetherAIModel',
+ 'PPIOModel',
'YiModel',
'QwenModel',
'ModelProcessingError',
diff --git a/camel/models/model_factory.py b/camel/models/model_factory.py
index ff9d5f339..8e13ec68b 100644
--- a/camel/models/model_factory.py
+++ b/camel/models/model_factory.py
@@ -34,6 +34,7 @@ from camel.models.ollama_model import OllamaModel
from camel.models.openai_compatible_model import OpenAICompatibleModel
from camel.models.openai_model import OpenAIModel
from camel.models.openrouter_model import OpenRouterModel
+from camel.models.ppio_model import PPIOModel
from camel.models.qwen_model import QwenModel
from camel.models.reka_model import RekaModel
from camel.models.samba_model import SambaModel
@@ -145,6 +146,8 @@ class ModelFactory:
model_class = QwenModel
elif model_platform.is_deepseek:
model_class = DeepSeekModel
+ elif model_platform.is_ppio:
+ model_class = PPIOModel
elif model_platform.is_internlm and model_type.is_internlm:
model_class = InternLMModel
elif model_platform.is_moonshot and model_type.is_moonshot:
diff --git a/camel/models/ppio_model.py b/camel/models/ppio_model.py
new file mode 100644
index 000000000..5754a2165
--- /dev/null
+++ b/camel/models/ppio_model.py
@@ -0,0 +1,177 @@
+# ========= 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. =========
+
+import os
+from typing import Any, Dict, List, Optional, Type, Union
+
+from openai import AsyncOpenAI, AsyncStream, OpenAI, Stream
+from pydantic import BaseModel
+
+from camel.configs import PPIO_API_PARAMS, PPIOConfig
+from camel.messages import OpenAIMessage
+from camel.models import BaseModelBackend
+from camel.types import (
+ ChatCompletion,
+ ChatCompletionChunk,
+ ModelType,
+)
+from camel.utils import (
+ BaseTokenCounter,
+ OpenAITokenCounter,
+ api_keys_required,
+)
+
+
+class PPIOModel(BaseModelBackend):
+ r"""Constructor for PPIO backend with OpenAI compatibility.
+
+ Args:
+ model_type (Union[ModelType, str]): Model for which a backend is
+ created, supported model can be found here:
+ https://ppinfra.com/model-api/product/llm-api?utm_source=github_owl
+ model_config_dict (Optional[Dict[str, Any]], optional): A dictionary
+ that will be fed into:obj:`openai.ChatCompletion.create()`. If
+ :obj:`None`, :obj:`PPIOConfig().as_dict()` will be used.
+ (default: :obj:`None`)
+ api_key (Optional[str], optional): The API key for authenticating with
+ the PPIO service. (default: :obj:`None`)
+ url (Optional[str], optional): The url to the PPIO service.
+ If not provided, "https://api.ppinfra.com/v3/openai" will be used.
+ (default: :obj:`None`)
+ token_counter (Optional[BaseTokenCounter], optional): Token counter to
+ use for the model. If not provided, :obj:`OpenAITokenCounter(
+ ModelType.GPT_4O_MINI)` will be used.
+ """
+
+ @api_keys_required(
+ [
+ ("api_key", 'PPIO_API_KEY'),
+ ]
+ )
+ def __init__(
+ self,
+ model_type: Union[ModelType, str],
+ model_config_dict: Optional[Dict[str, Any]] = None,
+ api_key: Optional[str] = None,
+ url: Optional[str] = None,
+ token_counter: Optional[BaseTokenCounter] = None,
+ ) -> None:
+ if model_config_dict is None:
+ model_config_dict = PPIOConfig().as_dict()
+ api_key = api_key or os.environ.get("PPIO_API_KEY")
+ url = url or os.environ.get(
+ "PPIO_API_BASE_URL", "https://api.ppinfra.com/v3/openai"
+ )
+ super().__init__(
+ model_type, model_config_dict, api_key, url, token_counter
+ )
+
+ self._client = OpenAI(
+ timeout=180,
+ max_retries=3,
+ api_key=self._api_key,
+ base_url=self._url,
+ )
+ self._async_client = AsyncOpenAI(
+ timeout=180,
+ max_retries=3,
+ api_key=self._api_key,
+ base_url=self._url,
+ )
+
+ async def _arun(
+ self,
+ messages: List[OpenAIMessage],
+ response_format: Optional[Type[BaseModel]] = None,
+ tools: Optional[List[Dict[str, Any]]] = None,
+ ) -> Union[ChatCompletion, AsyncStream[ChatCompletionChunk]]:
+ r"""Runs inference of OpenAI chat completion.
+
+ Args:
+ messages (List[OpenAIMessage]): Message list with the chat history
+ in OpenAI API format.
+
+ Returns:
+ Union[ChatCompletion, AsyncStream[ChatCompletionChunk]]:
+ `ChatCompletion` in the non-stream mode, or
+ `AsyncStream[ChatCompletionChunk]` in the stream mode.
+ """
+ response = await self._async_client.chat.completions.create(
+ messages=messages,
+ model=self.model_type,
+ **self.model_config_dict,
+ )
+ return response
+
+ def _run(
+ self,
+ messages: List[OpenAIMessage],
+ response_format: Optional[Type[BaseModel]] = None,
+ tools: Optional[List[Dict[str, Any]]] = None,
+ ) -> Union[ChatCompletion, Stream[ChatCompletionChunk]]:
+ r"""Runs inference of OpenAI chat completion.
+
+ Args:
+ messages (List[OpenAIMessage]): Message list with the chat history
+ in OpenAI API format.
+
+ Returns:
+ Union[ChatCompletion, Stream[ChatCompletionChunk]]:
+ `ChatCompletion` in the non-stream mode, or
+ `Stream[ChatCompletionChunk]` in the stream mode.
+ """
+ response = self._client.chat.completions.create(
+ messages=messages,
+ model=self.model_type,
+ **self.model_config_dict,
+ )
+ return response
+
+ @property
+ def token_counter(self) -> BaseTokenCounter:
+ r"""Initialize the token counter for the model backend.
+
+ Returns:
+ OpenAITokenCounter: The token counter following the model's
+ tokenization style.
+ """
+
+ if not self._token_counter:
+ self._token_counter = OpenAITokenCounter(ModelType.GPT_4O_MINI)
+ return self._token_counter
+
+ def check_model_config(self):
+ r"""Check whether the model configuration contains any
+ unexpected arguments to PPIO API.
+
+ Raises:
+ ValueError: If the model configuration dictionary contains any
+ unexpected arguments to PPIO API.
+ """
+ for param in self.model_config_dict:
+ if param not in PPIO_API_PARAMS:
+ raise ValueError(
+ f"Unexpected argument `{param}` is "
+ "input into PPIO model backend."
+ )
+
+ @property
+ def stream(self) -> bool:
+ r"""Returns whether the model is in stream mode, which sends partial
+ results each time.
+
+ Returns:
+ bool: Whether the model is in stream mode.
+ """
+ return self.model_config_dict.get('stream', False)
diff --git a/camel/types/enums.py b/camel/types/enums.py
index b72a347a5..4d26541da 100644
--- a/camel/types/enums.py
+++ b/camel/types/enums.py
@@ -80,6 +80,19 @@ class ModelType(UnifiedModelType, Enum):
TOGETHER_MIXTRAL_8_7B = "mistralai/Mixtral-8x7B-Instruct-v0.1"
TOGETHER_MISTRAL_7B = "mistralai/Mistral-7B-Instruct-v0.1"
+ # PPIO platform models support tool calling
+ PPIO_DEEPSEEK_R1_TURBO = "deepseek/deepseek-r1-turbo"
+ PPIO_DEEPSEEK_V3_TURBO = "deepseek/deepseek-v3-turbo"
+ PPIO_DEEPSEEK_R1_COMMUNITY = "deepseek/deepseek-r1/community"
+ PPIO_DEEPSEEK_V3_COMMUNITY = "deepseek/deepseek-v3/community"
+ PPIO_DEEPSEEK_R1 = "deepseek/deepseek-r1"
+ PPIO_DEEPSEEK_V3 = "deepseek/deepseek-v3"
+ PPIO_QWEN_2_5_72B = "qwen/qwen-2.5-72b-instruct"
+ PPIO_BAICHUAN_2_13B_CHAT = "baichuan/baichuan2-13b-chat"
+ PPIO_LLAMA_3_3_70B = "meta-llama/llama-3.3-70b-instruct"
+ PPIO_LLAMA_3_1_70B = "meta-llama/llama-3.1-70b-instruct"
+ PPIO_YI_1_5_34B_CHAT = "01-ai/yi-1.5-34b-chat"
+
# SambaNova Cloud platform models support tool calling
SAMBA_LLAMA_3_1_8B = "Meta-Llama-3.1-8B-Instruct"
SAMBA_LLAMA_3_1_70B = "Meta-Llama-3.1-70B-Instruct"
@@ -281,6 +294,7 @@ class ModelType(UnifiedModelType, Enum):
self.is_mistral,
self.is_qwen,
self.is_deepseek,
+ self.is_ppio,
self.is_cohere,
self.is_internlm,
self.is_together,
@@ -538,6 +552,22 @@ class ModelType(UnifiedModelType, Enum):
ModelType.DEEPSEEK_REASONER,
}
+ @property
+ def is_ppio(self) -> bool:
+ return self in {
+ ModelType.PPIO_DEEPSEEK_R1_TURBO,
+ ModelType.PPIO_DEEPSEEK_V3_TURBO,
+ ModelType.PPIO_DEEPSEEK_R1_COMMUNITY,
+ ModelType.PPIO_DEEPSEEK_V3_COMMUNITY,
+ ModelType.PPIO_DEEPSEEK_R1,
+ ModelType.PPIO_DEEPSEEK_V3,
+ ModelType.PPIO_QWEN_2_5_72B,
+ ModelType.PPIO_BAICHUAN_2_13B_CHAT,
+ ModelType.PPIO_LLAMA_3_3_70B,
+ ModelType.PPIO_LLAMA_3_1_70B,
+ ModelType.PPIO_YI_1_5_34B_CHAT,
+ }
+
@property
def is_internlm(self) -> bool:
return self in {
@@ -652,6 +682,10 @@ class ModelType(UnifiedModelType, Enum):
ModelType.OPENROUTER_OLYMPICODER_7B,
}:
return 8_192
+ elif self in {
+ ModelType.PPIO_BAICHUAN_2_13B_CHAT,
+ }:
+ return 14_336
elif self in {
ModelType.GPT_3_5_TURBO,
ModelType.YI_LIGHTNING,
@@ -664,6 +698,7 @@ class ModelType(UnifiedModelType, Enum):
ModelType.SAMBA_LLAMA_3_1_405B,
ModelType.GLM_4V_PLUS_0111,
ModelType.GLM_ZERO_PREVIEW,
+ ModelType.PPIO_YI_1_5_34B_CHAT,
}:
return 16_384
elif self in {
@@ -690,6 +725,8 @@ class ModelType(UnifiedModelType, Enum):
ModelType.MOONSHOT_V1_32K,
ModelType.AIML_MIXTRAL_8X7B,
ModelType.AIML_MISTRAL_7B_INSTRUCT,
+ ModelType.PPIO_QWEN_2_5_72B,
+ ModelType.PPIO_LLAMA_3_1_70B,
ModelType.MODELSCOPE_QWEN_2_5_7B_INSTRUCT,
ModelType.MODELSCOPE_QWEN_2_5_14B_INSTRUCT,
ModelType.MODELSCOPE_QWEN_2_5_32B_INSTRUCT,
@@ -712,6 +749,12 @@ class ModelType(UnifiedModelType, Enum):
ModelType.MISTRAL_MIXTRAL_8x22B,
ModelType.DEEPSEEK_CHAT,
ModelType.DEEPSEEK_REASONER,
+ ModelType.PPIO_DEEPSEEK_R1_TURBO,
+ ModelType.PPIO_DEEPSEEK_V3_TURBO,
+ ModelType.PPIO_DEEPSEEK_R1_COMMUNITY,
+ ModelType.PPIO_DEEPSEEK_V3_COMMUNITY,
+ ModelType.PPIO_DEEPSEEK_R1,
+ ModelType.PPIO_DEEPSEEK_V3,
}:
return 64_000
elif self in {
@@ -773,6 +816,7 @@ class ModelType(UnifiedModelType, Enum):
ModelType.SGLANG_QWEN_2_5_32B,
ModelType.SGLANG_QWEN_2_5_72B,
ModelType.OPENROUTER_LLAMA_3_1_70B,
+ ModelType.PPIO_LLAMA_3_3_70B,
ModelType.OPENROUTER_LLAMA_4_SCOUT,
}:
return 131_072
@@ -994,6 +1038,7 @@ class ModelPlatformType(Enum):
QWEN = "tongyi-qianwen"
NVIDIA = "nvidia"
DEEPSEEK = "deepseek"
+ PPIO = "ppio"
SGLANG = "sglang"
INTERNLM = "internlm"
MOONSHOT = "moonshot"
@@ -1116,6 +1161,11 @@ class ModelPlatformType(Enum):
r"""Returns whether this platform is DeepSeek."""
return self is ModelPlatformType.DEEPSEEK
+ @property
+ def is_ppio(self) -> bool:
+ r"""Returns whether this platform is PPIO."""
+ return self is ModelPlatformType.PPIO
+
@property
def is_internlm(self) -> bool:
r"""Returns whether this platform is InternLM."""
diff --git a/camel/types/unified_model_type.py b/camel/types/unified_model_type.py
index 9b6b667cd..f2ee08f50 100644
--- a/camel/types/unified_model_type.py
+++ b/camel/types/unified_model_type.py
@@ -83,6 +83,11 @@ class UnifiedModelType(str):
r"""Returns whether the model is a OpenRouter served model."""
return True
+ @property
+ def is_ppio(self) -> bool:
+ r"""Returns whether the model is a PPIO served model."""
+ return True
+
@property
def is_zhipuai(self) -> bool:
r"""Returns whether the model is a Zhipuai model."""
diff --git a/docs/key_modules/models.md b/docs/key_modules/models.md
index c8848d324..90589f089 100644
--- a/docs/key_modules/models.md
+++ b/docs/key_modules/models.md
@@ -30,6 +30,7 @@ CAMEL supports a wide range of models, including [OpenAI’s GPT series](https:/
| **SambaNova** | [supported models](https://docs.sambanova.ai/cloud/docs/get-started/supported-models) |
| **Ollama** | [supported models](https://ollama.com/library) |
| **OpenRouter** | [supported models](https://openrouter.ai/models) |
+| **PPIO** | [supported models](https://ppinfra.com/model-api/product/llm-api?utm_source=github_owl) |
| **LiteLLM** | [supported models](https://docs.litellm.ai/docs/providers) |
| **vLLM** | [supported models](https://docs.vllm.ai/en/latest/models/supported_models.html) |
| **SGLANG** | [supported models](https://sgl-project.github.io/references/supported_models.html) |
diff --git a/examples/models/ppio_model_example.py b/examples/models/ppio_model_example.py
new file mode 100644
index 000000000..bddd665ac
--- /dev/null
+++ b/examples/models/ppio_model_example.py
@@ -0,0 +1,58 @@
+# ========= 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 PPIOConfig
+from camel.models import ModelFactory
+from camel.types import ModelPlatformType, ModelType
+
+model = ModelFactory.create(
+ model_platform=ModelPlatformType.PPIO,
+ model_type=ModelType.PPIO_DEEPSEEK_R1,
+ model_config_dict=PPIOConfig(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 CAMEL AI! 👋 A warm welcome to the open-source community pushing the
+boundaries of autonomous and communicative agents! Your work in exploring
+multi-agent systems, human-AI collaboration, and self-improving AI
+architectures is incredibly exciting. By fostering transparency and
+collaboration, you're empowering researchers and developers to tackle
+challenges like agent coordination, ethical alignment, and real-world
+deployment—critical steps toward responsible AI advancement.
+
+If anyone's curious, CAMEL AI's projects often dive into simulations where AI
+agents role-play scenarios (like a negotiation between a "seller" and "buyer"
+bot), testing how they communicate, adapt, and solve problems autonomously.
+ This hands-on approach helps uncover insights into emergent behaviors and
+ scalable solutions.
+
+Keep innovating! 🌟 The future of AI is brighter with communities like yours
+driving open, creative research.
+===============================================================================
+'''
diff --git a/test/models/test_ppio_model.py b/test/models/test_ppio_model.py
new file mode 100644
index 000000000..1cd477c03
--- /dev/null
+++ b/test/models/test_ppio_model.py
@@ -0,0 +1,62 @@
+# ========= 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. =========
+import re
+
+import pytest
+
+from camel.configs import PPIOConfig
+from camel.models import PPIOModel
+from camel.types import ModelType
+from camel.utils import OpenAITokenCounter
+
+
+ "model_type",
+ [
+ ModelType.PPIO_DEEPSEEK_R1,
+ ModelType.PPIO_LLAMA_3_1_70B,
+ ModelType.PPIO_QWEN_2_5_72B,
+ ],
+)
+def test_ppio_model(model_type: ModelType):
+ model = PPIOModel(model_type)
+ assert model.model_type == model_type
+ assert model.model_config_dict == PPIOConfig().as_dict()
+ assert isinstance(model.token_counter, OpenAITokenCounter)
+ assert isinstance(model.model_type.value_for_tiktoken, str)
+ assert isinstance(model.model_type.token_limit, int)
+
+
+def test_ppio_model_unexpected_argument():
+ model_type = ModelType.PPIO_LLAMA_3_1_70B
+ model_config_dict = {"model_path": "ppio_llama_3_1_70B"}
+
+ with pytest.raises(
+ ValueError,
+ match=re.escape(
+ (
+ "Unexpected argument `model_path` is "
+ "input into PPIO model backend."
+ )
+ ),
+ ):
+ _ = PPIOModel(model_type, model_config_dict)
+
+
+def test_ppio_model_stream_property():
+ model = PPIOModel(ModelType.PPIO_LLAMA_3_1_70B)
+ assert model.stream is False