From 1a08bbe8ac64b3a4f349bf570ba430659cc3d70d Mon Sep 17 00:00:00 2001 From: Dmitrii Khizbullin Date: Tue, 20 Jun 2023 15:11:55 +0300 Subject: [PATCH] Extracted RolePlaying to societies subpackage --- apps/agents/agents.py | 3 ++- camel/agents/__init__.py | 2 -- camel/societies/__init__.py | 18 ++++++++++++++++++ camel/{agents => societies}/role_playing.py | 0 examples/ai_society/role_playing.py | 2 +- .../ai_society/role_playing_multiprocess.py | 2 +- .../ai_society/role_playing_with_critic.py | 2 +- examples/ai_society/role_playing_with_human.py | 2 +- .../misalignment/role_playing_multiprocess.py | 2 +- .../misalignment/role_playing_with_human.py | 2 +- test/agents/test_role_playing.py | 3 ++- 11 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 camel/societies/__init__.py rename camel/{agents => societies}/role_playing.py (100%) diff --git a/apps/agents/agents.py b/apps/agents/agents.py index 253572436..c7555b4f4 100644 --- a/apps/agents/agents.py +++ b/apps/agents/agents.py @@ -28,8 +28,9 @@ import tenacity from apps.agents.text_utils import split_markdown_code -from camel.agents import RolePlaying, TaskSpecifyAgent +from camel.agents import TaskSpecifyAgent from camel.messages import AssistantChatMessage +from camel.societies import RolePlaying REPO_ROOT = os.path.realpath( os.path.join(os.path.dirname(os.path.abspath(__file__)), "../..")) diff --git a/camel/agents/__init__.py b/camel/agents/__init__.py index 619a94042..1ab31f3dc 100644 --- a/camel/agents/__init__.py +++ b/camel/agents/__init__.py @@ -18,7 +18,6 @@ from .tool_agents.base import BaseToolAgent from .tool_agents.hugging_face_tool_agent import HuggingFaceToolAgent from .embodied_agent import EmbodiedAgent -from .role_playing import RolePlaying __all__ = [ 'BaseAgent', @@ -29,5 +28,4 @@ 'BaseToolAgent', 'HuggingFaceToolAgent', 'EmbodiedAgent', - 'RolePlaying', ] diff --git a/camel/societies/__init__.py b/camel/societies/__init__.py new file mode 100644 index 000000000..b73b6f692 --- /dev/null +++ b/camel/societies/__init__.py @@ -0,0 +1,18 @@ +# =========== Copyright 2023 @ 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 @ CAMEL-AI.org. All Rights Reserved. =========== +from .role_playing import RolePlaying + +__all__ = [ + 'RolePlaying', +] diff --git a/camel/agents/role_playing.py b/camel/societies/role_playing.py similarity index 100% rename from camel/agents/role_playing.py rename to camel/societies/role_playing.py diff --git a/examples/ai_society/role_playing.py b/examples/ai_society/role_playing.py index d21995d66..6bf57256e 100644 --- a/examples/ai_society/role_playing.py +++ b/examples/ai_society/role_playing.py @@ -13,7 +13,7 @@ # =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. =========== from colorama import Fore -from camel.agents import RolePlaying +from camel.societies import RolePlaying from camel.utils import print_text_animated diff --git a/examples/ai_society/role_playing_multiprocess.py b/examples/ai_society/role_playing_multiprocess.py index 4ab1282d6..c2a33d935 100644 --- a/examples/ai_society/role_playing_multiprocess.py +++ b/examples/ai_society/role_playing_multiprocess.py @@ -18,8 +18,8 @@ from colorama import Fore -from camel.agents import RolePlaying from camel.configs import ChatGPTConfig +from camel.societies import RolePlaying from camel.typing import TaskType from camel.utils import download_tasks diff --git a/examples/ai_society/role_playing_with_critic.py b/examples/ai_society/role_playing_with_critic.py index f3c162582..4c8f35722 100644 --- a/examples/ai_society/role_playing_with_critic.py +++ b/examples/ai_society/role_playing_with_critic.py @@ -13,8 +13,8 @@ # =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. =========== from colorama import Fore -from camel.agents import RolePlaying from camel.configs import ChatGPTConfig +from camel.societies import RolePlaying from camel.utils import print_text_animated diff --git a/examples/ai_society/role_playing_with_human.py b/examples/ai_society/role_playing_with_human.py index be7d274b8..b59f5ae2d 100644 --- a/examples/ai_society/role_playing_with_human.py +++ b/examples/ai_society/role_playing_with_human.py @@ -13,8 +13,8 @@ # =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. =========== from colorama import Fore -from camel.agents import RolePlaying from camel.configs import ChatGPTConfig +from camel.societies import RolePlaying from camel.utils import print_text_animated diff --git a/examples/misalignment/role_playing_multiprocess.py b/examples/misalignment/role_playing_multiprocess.py index b19099135..304c41271 100644 --- a/examples/misalignment/role_playing_multiprocess.py +++ b/examples/misalignment/role_playing_multiprocess.py @@ -17,8 +17,8 @@ from colorama import Fore -from camel.agents import RolePlaying from camel.configs import ChatGPTConfig +from camel.societies import RolePlaying from camel.typing import TaskType diff --git a/examples/misalignment/role_playing_with_human.py b/examples/misalignment/role_playing_with_human.py index d22757c9f..c75945ed0 100644 --- a/examples/misalignment/role_playing_with_human.py +++ b/examples/misalignment/role_playing_with_human.py @@ -13,8 +13,8 @@ # =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. =========== from colorama import Fore -from camel.agents import RolePlaying from camel.configs import ChatGPTConfig +from camel.societies import RolePlaying from camel.typing import TaskType from camel.utils import print_text_animated diff --git a/test/agents/test_role_playing.py b/test/agents/test_role_playing.py index 521721de7..f66767716 100644 --- a/test/agents/test_role_playing.py +++ b/test/agents/test_role_playing.py @@ -15,8 +15,9 @@ import pytest -from camel.agents import ChatAgent, RolePlaying +from camel.agents import ChatAgent from camel.messages import AssistantChatMessage, ChatMessage, SystemMessageType +from camel.societies import RolePlaying from camel.typing import ModelType, TaskType