From f5f4dab087e2cfb89769891f11110d77d48a2652 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Feb 2026 07:53:13 +0000 Subject: [PATCH 1/2] Initial plan From fab3aff11f3f06cfa7529907f012d5410bb9fa65 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Feb 2026 07:59:26 +0000 Subject: [PATCH 2/2] Improve repo structure: expose core API from root, fix broken export, add export validation tests Co-authored-by: lightaime <23632352+lightaime@users.noreply.github.com> --- camel/__init__.py | 17 +++++++++++ camel/prompts/__init__.py | 1 - test/test_all_exports.py | 60 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/camel/__init__.py b/camel/__init__.py index 7dfd14bd21..16b6c08bde 100644 --- a/camel/__init__.py +++ b/camel/__init__.py @@ -12,7 +12,14 @@ # limitations under the License. # ========= Copyright 2023-2026 @ CAMEL-AI.org. All Rights Reserved. ========= +from camel.agents import ChatAgent from camel.logger import disable_logging, enable_logging, set_log_level +from camel.messages import BaseMessage +from camel.models import ModelFactory +from camel.responses import ChatAgentResponse +from camel.societies import RolePlaying, Workforce +from camel.toolkits import BaseToolkit, FunctionTool +from camel.types import ModelPlatformType, ModelType __version__ = '0.2.85' @@ -21,4 +28,14 @@ 'disable_logging', 'enable_logging', 'set_log_level', + 'BaseMessage', + 'BaseToolkit', + 'ChatAgent', + 'ChatAgentResponse', + 'FunctionTool', + 'ModelFactory', + 'ModelPlatformType', + 'ModelType', + 'RolePlaying', + 'Workforce', ] diff --git a/camel/prompts/__init__.py b/camel/prompts/__init__.py index d2d789e300..3b0b8c574f 100644 --- a/camel/prompts/__init__.py +++ b/camel/prompts/__init__.py @@ -50,6 +50,5 @@ 'ObjectRecognitionPromptTemplateDict', 'ImageCraftPromptTemplateDict', 'MultiConditionImageCraftPromptTemplateDict', - 'DescriptionVideoPromptTemplateDict', 'VideoDescriptionPromptTemplateDict', ] diff --git a/test/test_all_exports.py b/test/test_all_exports.py index 3a0f80b2d5..b080423598 100644 --- a/test/test_all_exports.py +++ b/test/test_all_exports.py @@ -11,6 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # ========= Copyright 2023-2026 @ CAMEL-AI.org. All Rights Reserved. ========= +import importlib + +import pytest def test_all_exports_from_camel(): @@ -31,3 +34,60 @@ def test_all_exports_type(): for item in camel.__all__: assert isinstance(item, str) + + +def test_core_classes_importable_from_root(): + """Verify that core public API classes are importable from the + root camel package for agent discoverability.""" + import camel + + core_names = [ + 'ChatAgent', + 'ModelFactory', + 'BaseMessage', + 'ModelType', + 'ModelPlatformType', + 'FunctionTool', + 'BaseToolkit', + 'RolePlaying', + 'Workforce', + 'ChatAgentResponse', + ] + for name in core_names: + assert hasattr( + camel, name + ), f"camel.{name} should be importable from root package" + + +# Submodules whose __all__ entries should all resolve to real attributes. +_SUBMODULES_TO_CHECK = [ + 'camel', + 'camel.agents', + 'camel.configs', + 'camel.loaders', + 'camel.memories', + 'camel.messages', + 'camel.models', + 'camel.prompts', + 'camel.responses', + 'camel.societies', + 'camel.storages', + 'camel.toolkits', + 'camel.types', +] + + +@pytest.mark.parametrize("module_name", _SUBMODULES_TO_CHECK) +def test_all_exports_are_resolvable(module_name): + """Every name listed in a submodule's __all__ must be an attribute of + that module. A mismatch means users (or agents) will hit an ImportError + when they try ``from import ``.""" + mod = importlib.import_module(module_name) + all_names = getattr(mod, '__all__', None) + if all_names is None: + pytest.skip(f"{module_name} does not define __all__") + missing = [n for n in all_names if not hasattr(mod, n)] + assert not missing, ( + f"{module_name}.__all__ contains names that are not defined: " + f"{missing}" + )