🐫 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
fix: incorrect role assigning in rewardmodelfilter (#1390)
AveryYaye262fd13f8b8
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.ymlindex b61a174fc..227f4860e 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.15+ placeholder: E.g., 0.2.16validations:required: truediff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex d39a63a2f..f8adc2e1e 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -1,6 +1,6 @@repos:- repo: https://github.com/astral-sh/ruff-pre-commit- rev: 'v0.3.5'+ rev: 'v0.7'hooks:- id: ruffargs: [--fix, --exit-non-zero-on-fix, --show-fixes]diff --git a/README.md b/README.mdindex c45417812..0382e500b 100644--- a/README.md+++ b/README.md@@ -144,7 +144,7 @@ conda create --name camel python=3.10conda activate camel# Clone github repo-git clone -b v0.2.15 https://github.com/camel-ai/camel.git+git clone -b v0.2.16 https://github.com/camel-ai/camel.git# Change directory into project directorycd cameldiff --git a/camel/__init__.py b/camel/__init__.pyindex e8dfceb6a..5e9146385 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.15'+__version__ = '0.2.16'__all__ = ['__version__',diff --git a/camel/datagen/self_instruct/filter/filter_function.py b/camel/datagen/self_instruct/filter/filter_function.pyindex 4e7cf3993..7b8851215 100644--- a/camel/datagen/self_instruct/filter/filter_function.py+++ b/camel/datagen/self_instruct/filter/filter_function.py@@ -172,7 +172,12 @@ class RewardModelFilter(FilterFunction):to pass the filter."""- def __init__(self, reward_model: BaseRewardModel, threshold: float = 0.5):+ def __init__(+ self,+ reward_model: BaseRewardModel,+ threshold: float = 0.5,+ ):+ self.prompt = ""self.reward_model = reward_modelself.threshold = threshold@@ -190,8 +195,11 @@ class RewardModelFilter(FilterFunction):required score is not found in `scores`."""- messages = [{"role": "user", "content": instruction}]- scores = self.reward_model.evaluate(messages)+ data = [+ {"role": "user", "content": self.prompt},+ {"role": "assistant", "content": instruction},+ ]+ scores = self.reward_model.evaluate(data)score_types = self.reward_model.get_scores_types()if not score_types:raise ValueError("No score types available from the reward model.")diff --git a/camel/datagen/self_instruct/filter/instruction_filter.py b/camel/datagen/self_instruct/filter/instruction_filter.pyindex a1ea8726f..155cc1aa8 100644--- a/camel/datagen/self_instruct/filter/instruction_filter.py+++ b/camel/datagen/self_instruct/filter/instruction_filter.py@@ -13,7 +13,7 @@# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========from typing import Any, Dict, List-from .filter_function import FilterFunction+from .filter_function import FilterFunction, RewardModelFilterfrom .filter_registry import FILTER_REGISTRY@@ -53,10 +53,13 @@ class InstructionFilter:"""self.filters.append(filter_function)- def filter(self, instruction: str, return_details: bool = False):+ def filter(+ self, prompt: str, instruction: str, return_details: bool = False+ ):r"""Check if the given instruction passes all filter functions.Args:+ prompt (str): The prompt of generating the instruction.instruction (str): The instruction to evaluate.return_details (bool): If True, returns a tuple (bool, List[str])where the list contains the names of filters that failed.@@ -68,6 +71,8 @@ class InstructionFilter:"""failed_filters = []for f in self.filters:+ if isinstance(f, RewardModelFilter):+ f.prompt = promptif not f.apply(instruction):failed_filters.append(type(f).__name__)diff --git a/camel/datagen/self_instruct/self_instruct.py b/camel/datagen/self_instruct/self_instruct.pyindex d292eb52c..25a31a5b8 100644--- a/camel/datagen/self_instruct/self_instruct.py+++ b/camel/datagen/self_instruct/self_instruct.py@@ -136,14 +136,14 @@ class SelfInstructPipeline:return random.sample(self.machine_tasks, count)- def generate_machine_instruction(self) -> str:+ def generate_machine_instruction(self) -> List:r"""Generate a machine instruction using the agent.Combines human and machine tasks based on the configured ratio tocreate a prompt for instruction generation.Returns:- str: A machine-generated instruction.+ List: The prompt and a machine-generated instruction."""sampled_human_tasks = self.sample_human_tasks(@@ -176,7 +176,7 @@ class SelfInstructPipeline:for line in response.msgs[0].content.split("\n")if line.strip()]- return generated_tasks[0]+ return [prompt, generated_tasks[0]]def identify_instruction(self, instruction: str) -> bool:r"""Determine if the given instruction is a classification task.@@ -371,8 +371,8 @@ class SelfInstructPipeline:for f in self.instruction_filter.filters:if isinstance(f, RougeSimilarityFilter):f.existing_instructions = existing_instructions- instruction = self.generate_machine_instruction()- if self.instruction_filter.filter(instruction):+ prompt, instruction = self.generate_machine_instruction()+ if self.instruction_filter.filter(prompt, instruction):instruction_dict = {"id": f"machine_task_{len(self.machine_tasks) + 1}","instruction": instruction,diff --git a/docs/conf.py b/docs/conf.pyindex abf25f866..0337a777d 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.14'+release = '0.2.16'html_favicon = ('https://raw.githubusercontent.com/camel-ai/camel/master/misc/favicon.png'diff --git a/docs/cookbooks/agents_message.ipynb b/docs/cookbooks/agents_message.ipynbindex 63af93824..43648dfcc 100644--- a/docs/cookbooks/agents_message.ipynb+++ b/docs/cookbooks/agents_message.ipynb@@ -101,7 +101,7 @@},"outputs": [],"source": [- "!pip install \"camel-ai==0.2.14\""+ "!pip install \"camel-ai==0.2.16\""]},{diff --git a/docs/cookbooks/agents_prompting.ipynb b/docs/cookbooks/agents_prompting.ipynbindex 5134eafd3..8489a2e09 100644--- a/docs/cookbooks/agents_prompting.ipynb+++ b/docs/cookbooks/agents_prompting.ipynb@@ -64,7 +64,7 @@},"outputs": [],"source": [- "!pip install \"camel-ai==0.2.14\""+ "!pip install \"camel-ai==0.2.16\""]},{diff --git a/docs/cookbooks/agents_society.ipynb b/docs/cookbooks/agents_society.ipynbindex c3c047682..c2e2c77df 100644--- a/docs/cookbooks/agents_society.ipynb+++ b/docs/cookbooks/agents_society.ipynb@@ -192,7 +192,7 @@},"outputs": [],"source": [- "!pip install \"camel-ai==0.2.14\""+ "!pip install \"camel-ai==0.2.16\""]},{diff --git a/docs/cookbooks/agents_tracking.ipynb b/docs/cookbooks/agents_tracking.ipynbindex b327c21d4..afb373654 100644--- a/docs/cookbooks/agents_tracking.ipynb+++ b/docs/cookbooks/agents_tracking.ipynb@@ -64,7 +64,7 @@},"outputs": [],"source": [- "%pip install camel-ai[all]==0.2.14\n",+ "%pip install camel-ai[all]==0.2.16\n","%pip install agentops==0.3.10"]},diff --git a/docs/cookbooks/agents_with_memory.ipynb b/docs/cookbooks/agents_with_memory.ipynbindex e16c5ebc6..1feadf09a 100644--- a/docs/cookbooks/agents_with_memory.ipynb+++ b/docs/cookbooks/agents_with_memory.ipynb@@ -73,7 +73,7 @@},"outputs": [],"source": [- "!pip install \"camel-ai[all]==0.2.14\""+ "!pip install \"camel-ai[all]==0.2.16\""]},{diff --git a/docs/cookbooks/agents_with_rag.ipynb b/docs/cookbooks/agents_with_rag.ipynbindex 2e7048f90..0c3206ed6 100644--- a/docs/cookbooks/agents_with_rag.ipynb+++ b/docs/cookbooks/agents_with_rag.ipynb@@ -75,7 +75,7 @@},"outputs": [],"source": [- "!pip install \"camel-ai[all]==0.2.14\""+ "!pip install \"camel-ai[all]==0.2.16\""]},{diff --git a/docs/cookbooks/agents_with_tools.ipynb b/docs/cookbooks/agents_with_tools.ipynbindex d5440a238..f6449c704 100644--- a/docs/cookbooks/agents_with_tools.ipynb+++ b/docs/cookbooks/agents_with_tools.ipynb@@ -77,7 +77,7 @@},"outputs": [],"source": [- "!pip install \"camel-ai[all]==0.2.14\""+ "!pip install \"camel-ai[all]==0.2.16\""]},{diff --git a/docs/cookbooks/cot_data_gen_sft_qwen_unsolth_upload_huggingface.ipynb b/docs/cookbooks/cot_data_gen_sft_qwen_unsolth_upload_huggingface.ipynbindex 7df6958e9..eb3705c33 100644--- a/docs/cookbooks/cot_data_gen_sft_qwen_unsolth_upload_huggingface.ipynb+++ b/docs/cookbooks/cot_data_gen_sft_qwen_unsolth_upload_huggingface.ipynb@@ -71,7 +71,7 @@"outputs": [],"source": ["%%capture\n",- "!pip install camel-ai==0.2.15"+ "!pip install camel-ai==0.2.16"]},{diff --git a/docs/cookbooks/cot_data_gen_upload_to_huggingface.ipynb b/docs/cookbooks/cot_data_gen_upload_to_huggingface.ipynbindex c7647583d..caf758e21 100644--- a/docs/cookbooks/cot_data_gen_upload_to_huggingface.ipynb+++ b/docs/cookbooks/cot_data_gen_upload_to_huggingface.ipynb@@ -71,7 +71,7 @@"outputs": [],"source": ["%%capture\n",- "!pip install camel-ai==0.2.15"+ "!pip install camel-ai==0.2.16"]},{diff --git a/docs/cookbooks/create_your_first_agent.ipynb b/docs/cookbooks/create_your_first_agent.ipynbindex b7f21ab6f..963f1d603 100644--- a/docs/cookbooks/create_your_first_agent.ipynb+++ b/docs/cookbooks/create_your_first_agent.ipynb@@ -83,7 +83,7 @@{"cell_type": "code","source": [- "!pip install \"camel-ai[all]==0.2.14\""+ "!pip install \"camel-ai[all]==0.2.16\""],"metadata": {"id": "UtcC3c-KVZmU"diff --git a/docs/cookbooks/create_your_first_agents_society.ipynb b/docs/cookbooks/create_your_first_agents_society.ipynbindex 1aa88d04b..009a81b07 100644--- a/docs/cookbooks/create_your_first_agents_society.ipynb+++ b/docs/cookbooks/create_your_first_agents_society.ipynb@@ -77,7 +77,7 @@{"cell_type": "code","source": [- "!pip install \"camel-ai==0.2.14\""+ "!pip install \"camel-ai==0.2.16\""],"metadata": {"id": "RiwfwyyLYYxo"diff --git a/docs/cookbooks/critic_agents_and_tree_search.ipynb b/docs/cookbooks/critic_agents_and_tree_search.ipynbindex 97655b9ff..12c6564bf 100644--- a/docs/cookbooks/critic_agents_and_tree_search.ipynb+++ b/docs/cookbooks/critic_agents_and_tree_search.ipynb@@ -84,7 +84,7 @@{"cell_type": "code","source": [- "%pip install \"camel-ai==0.2.14\""+ "%pip install \"camel-ai==0.2.16\""],"metadata": {"id": "UtcC3c-KVZmU"diff --git a/docs/cookbooks/customer_service_Discord_bot_using_SambaNova_with_agentic_RAG.ipynb b/docs/cookbooks/customer_service_Discord_bot_using_SambaNova_with_agentic_RAG.ipynbindex fe91e97a1..98b465b5d 100644--- a/docs/cookbooks/customer_service_Discord_bot_using_SambaNova_with_agentic_RAG.ipynb+++ b/docs/cookbooks/customer_service_Discord_bot_using_SambaNova_with_agentic_RAG.ipynb@@ -50,7 +50,7 @@},"outputs": [],"source": [- "!pip install \"camel-ai[all]==0.2.14\"\n",+ "!pip install \"camel-ai[all]==0.2.16\"\n","!pip install starlette\n","!pip install nest_asyncio"]diff --git a/docs/cookbooks/customer_service_Discord_bot_using_local_model_with_agentic_RAG.ipynb b/docs/cookbooks/customer_service_Discord_bot_using_local_model_with_agentic_RAG.ipynbindex 55077340e..a564e9436 100644--- a/docs/cookbooks/customer_service_Discord_bot_using_local_model_with_agentic_RAG.ipynb+++ b/docs/cookbooks/customer_service_Discord_bot_using_local_model_with_agentic_RAG.ipynb@@ -51,7 +51,7 @@"outputId": "72f5cfe5-60ea-48ba-e1e1-a0cdc4eb87ec"},"source": [- "!pip install \"camel-ai[all]==0.2.15\"\n",+ "!pip install \"camel-ai[all]==0.2.16\"\n","!pip install starlette\n","!pip install nest_asyncio"],diff --git a/docs/cookbooks/customer_service_Discord_bot_with_agentic_RAG.ipynb b/docs/cookbooks/customer_service_Discord_bot_with_agentic_RAG.ipynbindex c4c26a3f5..99333ec1d 100644--- a/docs/cookbooks/customer_service_Discord_bot_with_agentic_RAG.ipynb+++ b/docs/cookbooks/customer_service_Discord_bot_with_agentic_RAG.ipynb@@ -59,7 +59,7 @@},"outputs": [],"source": [- "!pip install \"camel-ai[all]==0.2.14\"\n",+ "!pip install \"camel-ai[all]==0.2.16\"\n","!pip install starlette\n","!pip install nest_asyncio"]diff --git a/docs/cookbooks/embodied_agents.ipynb b/docs/cookbooks/embodied_agents.ipynbindex 7dce81e9b..1b3e3ec02 100644--- a/docs/cookbooks/embodied_agents.ipynb+++ b/docs/cookbooks/embodied_agents.ipynb@@ -67,7 +67,7 @@{"cell_type": "code","source": [- "%pip install \"camel-ai==0.2.14\""+ "%pip install \"camel-ai==0.2.16\""],"metadata": {"id": "UtcC3c-KVZmU"diff --git a/docs/cookbooks/ingest_data_from_websites_with_Firecrawl.ipynb b/docs/cookbooks/ingest_data_from_websites_with_Firecrawl.ipynbindex f4c33ef34..25e4dbad5 100644--- a/docs/cookbooks/ingest_data_from_websites_with_Firecrawl.ipynb+++ b/docs/cookbooks/ingest_data_from_websites_with_Firecrawl.ipynb@@ -81,7 +81,7 @@},"outputs": [],"source": [- "pip install \"camel-ai[all]==0.2.14\""+ "pip install \"camel-ai[all]==0.2.16\""]},{diff --git a/docs/cookbooks/knowledge_graph.ipynb b/docs/cookbooks/knowledge_graph.ipynbindex 2f8ebbbce..13b5d4fbe 100644--- a/docs/cookbooks/knowledge_graph.ipynb+++ b/docs/cookbooks/knowledge_graph.ipynb@@ -73,7 +73,7 @@},"outputs": [],"source": [- "pip install \"camel-ai[all]==0.2.14\""+ "pip install \"camel-ai[all]==0.2.16\""]},{diff --git a/docs/cookbooks/model_speed_comparison.ipynb b/docs/cookbooks/model_speed_comparison.ipynbindex 6b94b2327..13e7cfc46 100644--- a/docs/cookbooks/model_speed_comparison.ipynb+++ b/docs/cookbooks/model_speed_comparison.ipynb@@ -63,7 +63,7 @@{"cell_type": "code","source": [- "!pip install \"camel-ai==0.2.14\""+ "!pip install \"camel-ai==0.2.16\""],"metadata": {"id": "UtcC3c-KVZmU"diff --git a/docs/cookbooks/roleplaying_scraper.ipynb b/docs/cookbooks/roleplaying_scraper.ipynbindex 4f89892d2..c93f68ce5 100644--- a/docs/cookbooks/roleplaying_scraper.ipynb+++ b/docs/cookbooks/roleplaying_scraper.ipynb@@ -89,7 +89,7 @@},"outputs": [],"source": [- "!pip install \"camel-ai[all]==0.2.14\""+ "!pip install \"camel-ai[all]==0.2.16\""]},{diff --git a/docs/cookbooks/sft_data_generation_and_unsloth_finetuning_Qwen2_5_7B.ipynb b/docs/cookbooks/sft_data_generation_and_unsloth_finetuning_Qwen2_5_7B.ipynbindex 9f4bdf925..ebe37a083 100644--- a/docs/cookbooks/sft_data_generation_and_unsloth_finetuning_Qwen2_5_7B.ipynb+++ b/docs/cookbooks/sft_data_generation_and_unsloth_finetuning_Qwen2_5_7B.ipynb@@ -57,7 +57,7 @@"%%capture\n","!pip install unsloth\n","# Install CAMEL-AI with no optional dependencies\n",- "!pip install camel-ai==0.2.14\n",+ "!pip install camel-ai==0.2.16\n","# Get Unsloth latest unsloth nightly\n","!pip uninstall unsloth -y && pip install --upgrade --no-cache-dir --no-deps git+https://github.com/unslothai/unsloth.git\n","!pip install firecrawl"diff --git a/docs/cookbooks/sft_data_generation_and_unsloth_finetuning_mistral_7b_instruct.ipynb b/docs/cookbooks/sft_data_generation_and_unsloth_finetuning_mistral_7b_instruct.ipynbindex 7d1c0df37..58bcfe020 100644--- a/docs/cookbooks/sft_data_generation_and_unsloth_finetuning_mistral_7b_instruct.ipynb+++ b/docs/cookbooks/sft_data_generation_and_unsloth_finetuning_mistral_7b_instruct.ipynb@@ -57,7 +57,7 @@"%%capture\n","!pip install unsloth\n","# Install CAMEL-AI with no optional dependencies\n",- "!pip install camel-ai==0.2.14\n",+ "!pip install camel-ai==0.2.16\n","# Get Unsloth\n","!pip install --upgrade --no-deps \"unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git@0de54572525788d09a6a9ef1efc7611e65dd7547\"\n","!pip install firecrawl"diff --git a/docs/cookbooks/sft_data_generation_and_unsloth_finetuning_tinyllama.ipynb b/docs/cookbooks/sft_data_generation_and_unsloth_finetuning_tinyllama.ipynbindex a7e67a5ea..0ac729f98 100644--- a/docs/cookbooks/sft_data_generation_and_unsloth_finetuning_tinyllama.ipynb+++ b/docs/cookbooks/sft_data_generation_and_unsloth_finetuning_tinyllama.ipynb@@ -57,7 +57,7 @@"%%capture\n","!pip install unsloth\n","# Install CAMEL-AI with no optional dependencies\n",- "!pip install camel-ai==0.2.14\n",+ "!pip install camel-ai==0.2.16\n","# Get Unsloth\n","!pip install --upgrade --no-deps \"unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git@0de54572525788d09a6a9ef1efc7611e65dd7547\"\n","!pip install firecrawl"diff --git a/docs/cookbooks/task_generation.ipynb b/docs/cookbooks/task_generation.ipynbindex ff66e52fa..62b2e4bb2 100644--- a/docs/cookbooks/task_generation.ipynb+++ b/docs/cookbooks/task_generation.ipynb@@ -62,7 +62,7 @@},"outputs": [],"source": [- "!pip install \"camel-ai==0.2.14\""+ "!pip install \"camel-ai==0.2.16\""]},{diff --git a/docs/cookbooks/video_analysis.ipynb b/docs/cookbooks/video_analysis.ipynbindex fa9bb6e35..6fe5dfb86 100644--- a/docs/cookbooks/video_analysis.ipynb+++ b/docs/cookbooks/video_analysis.ipynb@@ -28,7 +28,7 @@},"outputs": [],"source": [- "%pip install \"camel-ai[all]==0.2.14\""+ "%pip install \"camel-ai[all]==0.2.16\""]},{diff --git a/docs/cookbooks/workforce_judge_committee.ipynb b/docs/cookbooks/workforce_judge_committee.ipynbindex 2371b3569..26c3bf06b 100644--- a/docs/cookbooks/workforce_judge_committee.ipynb+++ b/docs/cookbooks/workforce_judge_committee.ipynb@@ -28,7 +28,7 @@},"outputs": [],"source": [- "%pip install \"camel-ai[all]==0.2.14\""+ "%pip install \"camel-ai[all]==0.2.16\""]},{diff --git a/docs/get_started/installation.md b/docs/get_started/installation.mdindex 14fdac8f3..493eb4e22 100644--- a/docs/get_started/installation.md+++ b/docs/get_started/installation.md@@ -60,7 +60,7 @@ conda create --name camel python=3.10conda activate camel# Clone github repo-git clone -b v0.2.15 https://github.com/camel-ai/camel.git+git clone -b v0.2.16 https://github.com/camel-ai/camel.git# Change directory into project directorycd cameldiff --git a/docs/key_modules/loaders.md b/docs/key_modules/loaders.mdindex 67ebc08c6..a09ef7a72 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.14 documentation+>>>Welcome to CAMEL’s documentation! — CAMEL 0.2.16 documentation===============[Skip to main content](https://docs.camel-ai.org/#main-content)Back to top Ctrl+K- [ CAMEL 0.2.14](https://docs.camel-ai.org/#)+ [ CAMEL 0.2.16](https://docs.camel-ai.org/#)Search Ctrl+Kdiff --git a/pyproject.toml b/pyproject.tomlindex 9de508c05..ca2ea2e61 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"[tool.poetry]name = "camel-ai"-version = "0.2.15"+version = "0.2.16"authors = ["CAMEL-AI.org"]description = "Communicative Agents for AI Society Study"readme = "README.md"