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

feature(types): Add new OpenAI APIs (#361)

Tianqi Xu69c5cf913c28
diff --git a/.github/actions/camel_install/action.yml b/.github/actions/camel_install/action.yml
index 2de1f2f8c..69f85fea2 100644
--- a/.github/actions/camel_install/action.yml
+++ b/.github/actions/camel_install/action.yml
@@ -19,11 +19,18 @@ runs:
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
shell: bash
- - uses: actions/cache@v3
- name: Cache for the virtual environment based on poetry.lock
+ - uses: actions/cache/restore@v3
+ id: cache-restore
+ name: Restore caches for the virtual environment based on poetry.lock
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install the project dependencies
run: poetry install --with dev,docs -E all
shell: bash
+ - uses: actions/cache/save@v3
+ name: Save caches based on poetry.lock
+ if: ${{ !steps.cache-restore.outputs.cache-hit }}
+ with:
+ path: ./.venv
+ key: venv-${{ hashFiles('poetry.lock') }}
diff --git a/camel/types/enums.py b/camel/types/enums.py
index 4b4081699..f40ad4fd3 100644
--- a/camel/types/enums.py
+++ b/camel/types/enums.py
@@ -24,10 +24,13 @@ class RoleType(Enum):
class ModelType(Enum):
- GPT_3_5_TURBO = "gpt-3.5-turbo"
- GPT_3_5_TURBO_16K = "gpt-3.5-turbo-16k"
+ GPT_3_5_TURBO = "gpt-3.5-turbo-1106"
+ GPT_3_5_TURBO_16K = "gpt-3.5-turbo-1106"
GPT_4 = "gpt-4"
- GPT_4_32k = "gpt-4-32k"
+ GPT_4_32K = "gpt-4-32k"
+ GPT_4_TURBO = "gpt-4-1106-preview"
+ GPT_4_TURBO_VISION = "gpt-4-vision-preview"
+
STUB = "stub"
LLAMA_2 = "llama-2"
@@ -49,7 +52,9 @@ class ModelType(Enum):
"GPT_3_5_TURBO",
"GPT_3_5_TURBO_16K",
"GPT_4",
- "GPT_4_32k",
+ "GPT_4_32K",
+ "GPT_4_TURBO",
+ "GPT_4_TURBO_VISION",
}:
return True
else:
@@ -74,13 +79,17 @@ class ModelType(Enum):
int: The maximum token limit for the given model.
"""
if self is ModelType.GPT_3_5_TURBO:
- return 4096
+ return 16385
elif self is ModelType.GPT_3_5_TURBO_16K:
- return 16384
+ return 16385
elif self is ModelType.GPT_4:
return 8192
- elif self is ModelType.GPT_4_32k:
+ elif self is ModelType.GPT_4_32K:
return 32768
+ elif self is ModelType.GPT_4_TURBO:
+ return 128000
+ elif self is ModelType.GPT_4_TURBO_VISION:
+ return 128000
elif self is ModelType.STUB:
return 4096
elif self is ModelType.LLAMA_2:
diff --git a/test/models/test_model_factory.py b/test/models/test_model_factory.py
index 0409f8d76..a8f4b17fb 100644
--- a/test/models/test_model_factory.py
+++ b/test/models/test_model_factory.py
@@ -19,8 +19,7 @@ from camel.types import ModelType
parametrize = pytest.mark.parametrize('model', [
pytest.param(ModelType.GPT_3_5_TURBO, marks=pytest.mark.model_backend),
- pytest.param(ModelType.GPT_3_5_TURBO_16K, marks=pytest.mark.model_backend),
- pytest.param(ModelType.GPT_4, marks=pytest.mark.model_backend),
+ pytest.param(ModelType.GPT_4_TURBO, marks=pytest.mark.model_backend),
ModelType.STUB,
])
diff --git a/test/models/test_openai_model.py b/test/models/test_openai_model.py
index 97571413d..fdd48f5e6 100644
--- a/test/models/test_openai_model.py
+++ b/test/models/test_openai_model.py
@@ -26,6 +26,9 @@ from camel.utils import OpenAITokenCounter
ModelType.GPT_3_5_TURBO,
ModelType.GPT_3_5_TURBO_16K,
ModelType.GPT_4,
+ ModelType.GPT_4_32K,
+ ModelType.GPT_4_TURBO,
+ ModelType.GPT_4_TURBO_VISION,
])
def test_openai_model(model_type):
model_config_dict = ChatGPTConfig().__dict__