Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions camel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -21,4 +28,14 @@
'disable_logging',
'enable_logging',
'set_log_level',
'BaseMessage',
'BaseToolkit',
'ChatAgent',
'ChatAgentResponse',
'FunctionTool',
'ModelFactory',
'ModelPlatformType',
'ModelType',
'RolePlaying',
'Workforce',
]
1 change: 0 additions & 1 deletion camel/prompts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,5 @@
'ObjectRecognitionPromptTemplateDict',
'ImageCraftPromptTemplateDict',
'MultiConditionImageCraftPromptTemplateDict',
'DescriptionVideoPromptTemplateDict',
'VideoDescriptionPromptTemplateDict',
]
60 changes: 60 additions & 0 deletions test/test_all_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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 <module> import <name>``."""
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}"
)