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

enhance: add AMD model platform support PR2985 (#3070)

Wendong-Fan16cce6c6fbe8
diff --git a/.github/workflows/pytest_package.yml b/.github/workflows/pytest_package.yml
index e34bb3c9d..2a3c3ba6b 100644
--- a/.github/workflows/pytest_package.yml
+++ b/.github/workflows/pytest_package.yml
@@ -166,6 +166,7 @@ jobs:
BOHRIUM_API_KEY: "${{ secrets.BOHRIUM_API_KEY }}"
CRYNUX_API_KEY: "${{ secrets.CRYNUX_API_KEY }}"
NEBIUS_API_KEY: "${{ secrets.NEBIUS_API_KEY }}"
+ AMD_API_KEY: "${{ secrets.AMD_API_KEY }}"
run: |
source .venv/bin/activate
uv pip install -e ".[all, dev, docs]"
@@ -249,6 +250,7 @@ jobs:
BOHRIUM_API_KEY: "${{ secrets.BOHRIUM_API_KEY }}"
CRYNUX_API_KEY: "${{ secrets.CRYNUX_API_KEY }}"
NEBIUS_API_KEY: "${{ secrets.NEBIUS_API_KEY }}"
+ AMD_API_KEY: "${{ secrets.AMD_API_KEY }}"
run: |
source .venv/bin/activate
uv pip install -e ".[all, dev, docs]"
diff --git a/camel/configs/__init__.py b/camel/configs/__init__.py
index 2e5f9fdcd..f89cb4751 100644
--- a/camel/configs/__init__.py
+++ b/camel/configs/__init__.py
@@ -112,7 +112,7 @@ __all__ = [
'SILICONFLOW_API_PARAMS',
'AIMLConfig',
'AIML_API_PARAMS',
- 'AMDConfigs',
+ 'AMDConfig',
'AMD_API_PARAMS',
'OpenRouterConfig',
'OPENROUTER_API_PARAMS',
diff --git a/camel/models/amd_model.py b/camel/models/amd_model.py
index fafbf3140..3e811f44d 100644
--- a/camel/models/amd_model.py
+++ b/camel/models/amd_model.py
@@ -71,9 +71,7 @@ class AMDModel(OpenAICompatibleModel):
url = url or os.environ.get(
"AMD_API_BASE_URL", "https://llm-api.amd.com"
)
- headers = {
- 'Ocp-Apim-Subscription-Key': api_key
- }
+ headers = {'Ocp-Apim-Subscription-Key': api_key}
kwargs["default_headers"] = headers
timeout = timeout or float(os.environ.get("MODEL_TIMEOUT", 180))
super().__init__(
diff --git a/camel/types/enums.py b/camel/types/enums.py
index 36cf712da..5ba2858b9 100644
--- a/camel/types/enums.py
+++ b/camel/types/enums.py
@@ -517,14 +517,14 @@ class ModelType(UnifiedModelType, Enum):
ModelType.O4_MINI,
ModelType.O3,
}
-
+
@property
def is_amd(self) -> bool:
r"""Returns whether this type of models is a AMD model."""
return self in {
ModelType.AMD_GPT4,
}
-
+
@property
def is_aws_bedrock(self) -> bool:
r"""Returns whether this type of models is an AWS Bedrock model."""
diff --git a/examples/models/amd_model_example.py b/examples/models/amd_model_example.py
index 9290fa8a7..7b5c8301c 100644
--- a/examples/models/amd_model_example.py
+++ b/examples/models/amd_model_example.py
@@ -141,7 +141,4 @@ if __name__ == "__main__":
- Test with a demo/sandbox account or very small amounts first.
- You can expand this bot with strategies, stop-loss, take-profit, etc.
- For real trading, always understand the risks and comply with local regulations.
-
-
-
-"""
+""" # noqa: E501, RUF001
diff --git a/test/models/test_amd_model.py b/test/models/test_amd_model.py
index b38a2145f..d91f59c18 100644
--- a/test/models/test_amd_model.py
+++ b/test/models/test_amd_model.py
@@ -12,7 +12,6 @@
# limitations under the License.
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
-import re
import pytest
@@ -24,9 +23,7 @@ from camel.types import ModelType
@pytest.mark.model_backend
@pytest.mark.parametrize(
"model_type",
- [
- ModelType.AMD_GPT4
- ],
+ [ModelType.AMD_GPT4],
)
def test_amd_model(model_type: ModelType):
model = AMDModel(model_type)