🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
chore: fix pre commit, release new version (#2281)
Wendong-Fan617e7cc3568b
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.ymlindex fdee85829..4a5b5252e 100644--- a/.github/ISSUE_TEMPLATE/bug_report.yml+++ b/.github/ISSUE_TEMPLATE/bug_report.yml@@ -26,7 +26,7 @@ body:attributes:label: What version of camel are you using?description: Run command `python3 -c 'print(__import__("camel").__version__)'` in your shell and paste the output here.- placeholder: E.g., 0.2.48+ placeholder: E.g., 0.2.49validations:required: truediff --git a/camel/__init__.py b/camel/__init__.pyindex c91b547b5..dde3df9e4 100644--- a/camel/__init__.py+++ b/camel/__init__.py@@ -14,7 +14,7 @@from camel.logger import disable_logging, enable_logging, set_log_level-__version__ = '0.2.48'+__version__ = '0.2.49'__all__ = ['__version__',diff --git a/camel/societies/workforce/role_playing_worker.py b/camel/societies/workforce/role_playing_worker.pyindex 22cc8ae76..3e6802a22 100644--- a/camel/societies/workforce/role_playing_worker.py+++ b/camel/societies/workforce/role_playing_worker.py@@ -112,7 +112,7 @@ class RolePlayingWorker(Worker):chat_history = []while n < self.chat_turn_limit:n += 1- assistant_response, user_response = await role_play_session.step(+ assistant_response, user_response = await role_play_session.astep(input_msg)diff --git a/camel/societies/workforce/single_agent_worker.py b/camel/societies/workforce/single_agent_worker.pyindex 9f00fbc2b..618f00dd1 100644--- a/camel/societies/workforce/single_agent_worker.py+++ b/camel/societies/workforce/single_agent_worker.py@@ -72,7 +72,9 @@ class SingleAgentWorker(Worker):additional_info=task.additional_info,)try:- response = await self.worker.step(prompt, response_format=TaskResult)+ response = await self.worker.astep(+ prompt, response_format=TaskResult+ )except Exception as e:print(f"{Fore.RED}Error occurred while processing task {task.id}:"diff --git a/docs/conf.py b/docs/conf.pyindex e97cc658e..25826ac63 100644--- a/docs/conf.py+++ b/docs/conf.py@@ -27,7 +27,7 @@ sys.path.insert(0, os.path.abspath('..'))project = 'CAMEL'copyright = '2024, CAMEL-AI.org'author = 'CAMEL-AI.org'-release = '0.2.48'+release = '0.2.49'html_favicon = ('https://raw.githubusercontent.com/camel-ai/camel/master/misc/favicon.png'diff --git a/docs/key_modules/loaders.md b/docs/key_modules/loaders.mdindex 0cc47218d..78345c690 100644--- a/docs/key_modules/loaders.md+++ b/docs/key_modules/loaders.md@@ -340,14 +340,14 @@ response = jina_reader.read_content("https://docs.camel-ai.org/")print(response)``````markdown->>>Welcome to CAMEL’s documentation! — CAMEL 0.2.48 documentation+>>>Welcome to CAMEL’s documentation! — CAMEL 0.2.49 documentation===============[Skip to main content](https://docs.camel-ai.org/#main-content)Back to top Ctrl+K- [ CAMEL 0.2.48](https://docs.camel-ai.org/#)+ [ CAMEL 0.2.49](https://docs.camel-ai.org/#)Search Ctrl+Kdiff --git a/examples/workforce/hackathon_judges.py b/examples/workforce/hackathon_judges.pyindex 54338010a..fa440c3a3 100644--- a/examples/workforce/hackathon_judges.py+++ b/examples/workforce/hackathon_judges.py@@ -74,7 +74,6 @@ def main():search_toolkit = SearchToolkit()search_tools = [- FunctionTool(search_toolkit.search_google),FunctionTool(search_toolkit.search_duckduckgo),]diff --git a/pyproject.toml b/pyproject.tomlindex f3b031988..4fcbb0424 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "hatchling.build"[project]name = "camel-ai"-version = "0.2.48"+version = "0.2.49"description = "Communicative Agents for AI Society Study"authors = [{ name = "CAMEL-AI.org" }]requires-python = ">=3.10,<3.13"diff --git a/test/storages/vector_storages/test_milvus.py b/test/storages/vector_storages/test_milvus.pyindex 4c8467035..08fd4b57e 100644--- a/test/storages/vector_storages/test_milvus.py+++ b/test/storages/vector_storages/test_milvus.py@@ -39,46 +39,65 @@ def setup_mock_storage(mock_storage, vectors, query_result_id, payload):@pytest.fixturedef milvus_test_setup():"""Setup fixture for Milvus tests with mock search results.-+This fixture provides common setup for testing Milvus query functionality,including mock client, search results and storage instance."""# Mock search results structure: [[result1, result2, result3]]- mock_search_results = [[- {- 'id': '1',- 'distance': 0.9,- 'entity': {'vector': [0.1, 0.1, 0.1, 0.1], 'payload': {'message': 'text1'}}- },- {- 'id': '2',- 'distance': 0.8,- 'entity': {'vector': [0.2, 0.2, 0.2, 0.2], 'payload': {'message': 'text2'}}- },- {- 'id': '3',- 'distance': 0.7,- 'entity': {'vector': [0.3, 0.3, 0.3, 0.3], 'payload': {'message': 'text3'}}- },- ]]-+ mock_search_results = [+ [+ {+ 'id': '1',+ 'distance': 0.9,+ 'entity': {+ 'vector': [0.1, 0.1, 0.1, 0.1],+ 'payload': {'message': 'text1'},+ },+ },+ {+ 'id': '2',+ 'distance': 0.8,+ 'entity': {+ 'vector': [0.2, 0.2, 0.2, 0.2],+ 'payload': {'message': 'text2'},+ },+ },+ {+ 'id': '3',+ 'distance': 0.7,+ 'entity': {+ 'vector': [0.3, 0.3, 0.3, 0.3],+ 'payload': {'message': 'text3'},+ },+ },+ ]+ ]+# Mock Milvus clientwith patch('pymilvus.MilvusClient') as MockMilvusClient:mock_client = MockMilvusClient.return_valuemock_client.search.return_value = mock_search_results-+# Set up storage instance- with patch('camel.storages.vectordb_storages.milvus.MilvusStorage._create_collection'), \- patch('camel.storages.vectordb_storages.milvus.MilvusStorage._check_and_create_collection'), \- patch('camel.storages.vectordb_storages.milvus.MilvusStorage._collection_exists', return_value=True):-+ with (+ patch(+ 'camel.storages.vectordb_storages.milvus.MilvusStorage._create_collection'+ ),+ patch(+ 'camel.storages.vectordb_storages.milvus.MilvusStorage._check_and_create_collection'+ ),+ patch(+ 'camel.storages.vectordb_storages.milvus.MilvusStorage._collection_exists',+ return_value=True,+ ),+ ):storage = MilvusStorage(vector_dim=4,url_and_api_key=("http://localhost:19530", "fake_api_key"),- collection_name="test_collection"+ collection_name="test_collection",)storage._client = mock_client-+yield storage, mock_client, mock_search_results@@ -136,35 +155,36 @@ def test_multiple_remote_clients(mock_milvus_storage):def test_milvus_return_multiple_results(milvus_test_setup):- """Test that Milvus returns multiple results (top_k > 1)-+ r"""Test that Milvus returns multiple results (top_k > 1)+This test verifies the fix for a previous bug:- In the previous implementation, the loop would only execute once because the outer list only had one element,- and it only took the first result of each element (point[0]), which meant it could return at most one result.+ In the previous implementation, the loop would only execute once because+ the outer list only had one element, and it only took the first result of+ each element (point[0]), which meant it could return at most one result.The fixed code should be able to return the complete top_k results."""storage, mock_client, _ = milvus_test_setup-+# Execute queryquery = VectorDBQuery(query_vector=[0.1, 0.1, 0.1, 0.1], top_k=3)results = storage.query(query)-+# Verify resultsassert len(results) == 3, "Should return all 3 results (top_k=3)"-+# Verify the order and content of returned resultsassert results[0].record.id == '1'assert results[0].similarity == 0.9assert results[0].record.payload == {'message': 'text1'}-+assert results[1].record.id == '2'assert results[1].similarity == 0.8assert results[1].record.payload == {'message': 'text2'}-+assert results[2].record.id == '3'assert results[2].similarity == 0.7assert results[2].record.payload == {'message': 'text3'}-+# Verify search method was called correctlymock_client.search.assert_called_once()call_args = mock_client.search.call_args[1]@@ -173,17 +193,17 @@ def test_milvus_return_multiple_results(milvus_test_setup):def test_milvus_bug_single_result(milvus_test_setup):- """Test the bug behavior of Milvus before fix, returning only one result-- This test simulates the code behavior before the fix, where even if top_k=3 was specified,- it would only return one result.+ r"""Test the bug behavior of Milvus before fix, returning only one result++ This test simulates the code behavior before the fix, where even if+ top_k=3 was specified, it would only return one result."""storage, mock_client, _ = milvus_test_setup-+# Mock old implementation - the way it was processed before the fixdef mock_buggy_query(query, **kwargs):from camel.storages import VectorDBQueryResult-+search_result = mock_client.search(collection_name=storage.collection_name,data=[query.query_vector],@@ -202,24 +222,28 @@ def test_milvus_bug_single_result(milvus_test_setup):))return query_results-+# Replace query method with the buggy versionstorage.query = mock_buggy_query-+# Execute queryquery = VectorDBQuery(query_vector=[0.1, 0.1, 0.1, 0.1], top_k=3)results = storage.query(query=query)-+# Verify results - before fix would only return 1 result- assert len(results) == 1, "Before the fix, should return only 1 result, even if top_k=3"-+ assert (+ len(results) == 1+ ), "Before the fix, should return only 1 result, even if top_k=3"+# Verify that it's the first resultassert results[0].record.id == '1'assert results[0].similarity == 0.9assert results[0].record.payload == {'message': 'text1'}-+# Verify search method was called correctlymock_client.search.assert_called_once()call_args = mock_client.search.call_args[1]assert call_args['collection_name'] == "test_collection"- assert call_args['limit'] == 3 # Even though limit=3, the buggy version only returns the first result+ assert (+ call_args['limit'] == 3+ ) # Even though limit=3, the buggy version only returns the first resultdiff --git a/uv.lock b/uv.lockindex 293504538..575e1194e 100644--- a/uv.lock+++ b/uv.lock@@ -539,7 +539,7 @@ wheels = [[[package]]name = "camel-ai"-version = "0.2.48"+version = "0.2.49"source = { editable = "." }dependencies = [{ name = "colorama" },