๐ซ 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
docs: update version and polish cookbooks (#957)
Wendong-Fan10044b22da23
diff --git a/docs/cookbooks/agents_message.ipynb b/docs/cookbooks/agents_message.ipynbindex fae9ffb8a..607ca5d46 100644--- a/docs/cookbooks/agents_message.ipynb+++ b/docs/cookbooks/agents_message.ipynb@@ -92,7 +92,7 @@},"outputs": [],"source": [- "pip install camel-ai==0.1.6.8"+ "pip install camel-ai==0.2.0"]},{diff --git a/docs/cookbooks/agents_prompting.ipynb b/docs/cookbooks/agents_prompting.ipynbindex f45138c93..2eff95c76 100644--- a/docs/cookbooks/agents_prompting.ipynb+++ b/docs/cookbooks/agents_prompting.ipynb@@ -1,113 +1,92 @@{- "nbformat": 4,- "nbformat_minor": 0,- "metadata": {- "colab": {- "provenance": []- },- "kernelspec": {- "name": "python3",- "display_name": "Python 3"- },- "language_info": {- "name": "python"- }- },"cells": [{"cell_type": "markdown",- "source": [- "# ๐ซ CAMEL Prompting Cookbook\n"- ],"metadata": {"id": "SQMBlxsBv1cH"- }+ },+ "source": [+ "# ๐ซ CAMEL Prompting Cookbook\n"+ ]},{"cell_type": "markdown",- "source": [- "You can also check this cookbook in colab [here](https://colab.research.google.com/drive/1VcjPuy2UEYm0xLdriT7OMGt6I2yX9z32?usp=sharing)"- ],"metadata": {"id": "XFyl4eJue3Sm"- }+ },+ "source": [+ "You can also check this cookbook in colab [here](https://colab.research.google.com/drive/1VcjPuy2UEYm0xLdriT7OMGt6I2yX9z32?usp=sharing)"+ ]},{"cell_type": "markdown",- "source": [- "## *TLDR*"- ],"metadata": {"id": "-nCRZU5sInDK"- }+ },+ "source": [+ "## *TLDR*"+ ]},{"cell_type": "markdown",- "source": [- "The CAMEL Prompt module offers a powerful way to guide AI models in producing accurate, contextually relevant, and personalized outputs. This cookbook demonstrates how to use various prompt templates, create custom prompts, and leverage different prompt dictionaries for tasks ranging from role-playing to code generation, evaluation, and more. By mastering the Prompt module, you can significantly enhance your AI agents' capabilities and tailor them to specific tasks."- ],"metadata": {"id": "AwnfLQvMvtXo"- }+ },+ "source": [+ "The CAMEL Prompt module offers a powerful way to guide AI models in producing accurate, contextually relevant, and personalized outputs. This cookbook demonstrates how to use various prompt templates, create custom prompts, and leverage different prompt dictionaries for tasks ranging from role-playing to code generation, evaluation, and more. By mastering the Prompt module, you can significantly enhance your AI agents' capabilities and tailor them to specific tasks."+ ]},{"cell_type": "markdown",- "source": [- "### Installation"- ],"metadata": {"id": "XuZwbB1IIuUi"- }+ },+ "source": [+ "### Installation"+ ]},{"cell_type": "markdown",- "source": [- "Ensure you have CAMEL AI installed in your Python environment:"- ],"metadata": {"id": "gIJK4Lu5Iwm0"- }+ },+ "source": [+ "Ensure you have CAMEL AI installed in your Python environment:"+ ]},{"cell_type": "code",- "source": [- "!pip install camel-ai==0.1.9"- ],+ "execution_count": null,"metadata": {- "id": "HTKnWg9Xv_y4",- "collapsed": true+ "collapsed": true,+ "id": "HTKnWg9Xv_y4"},- "execution_count": null,- "outputs": []+ "outputs": [],+ "source": [+ "!pip install camel-ai==0.2.0"+ ]},{"cell_type": "markdown",- "source": [- "### ๐ Setting Up API Keys"- ],"metadata": {"id": "MyTTCe3IR_Lr"- }+ },+ "source": [+ "### ๐ Setting Up API Keys"+ ]},{"cell_type": "markdown",- "source": [- "You'll need to set up your API keys for OpenAI."- ],"metadata": {"id": "REqzgGL9SEaD"- }+ },+ "source": [+ "You'll need to set up your API keys for OpenAI."+ ]},{"cell_type": "code",- "source": [- "import os\n",- "from getpass import getpass\n",- "\n",- "# Prompt for the API key securely\n",- "openai_api_key = getpass('Enter your API key: ')\n",- "os.environ[\"OPENAI_API_KEY\"] = openai_api_key"- ],+ "execution_count": 4,"metadata": {"colab": {"base_uri": "https://localhost:8080/"@@ -115,7 +94,6 @@"id": "PNBFEXc-R-0s","outputId": "d6ec8e40-b5fb-4ebf-c221-e9835b68ff1d"},- "execution_count": 4,"outputs": [{"name": "stdout",@@ -124,20 +102,47 @@"Enter your API key: ยทยทยทยทยทยทยทยทยทยท\n"]}+ ],+ "source": [+ "import os\n",+ "from getpass import getpass\n",+ "\n",+ "# Prompt for the API key securely\n",+ "openai_api_key = getpass('Enter your API key: ')\n",+ "os.environ[\"OPENAI_API_KEY\"] = openai_api_key"]},{"cell_type": "markdown",+ "metadata": {+ "id": "GB5JK4Xs2fe6"+ },"source": ["## Getting Started with Prompt Templates\n","CAMEL offers a wide range of pre-defined prompt templates that you can use to quickly create specialized AI agents. Let's start with a basic example using the TaskSpecifyAgent with the AI_SOCIETY task type."- ],- "metadata": {- "id": "GB5JK4Xs2fe6"- }+ ]},{"cell_type": "code",+ "execution_count": 5,+ "metadata": {+ "colab": {+ "base_uri": "https://localhost:8080/"+ },+ "id": "754A8R7X2rnP",+ "outputId": "d9cb892c-bdc8-4433-9ae5-3f3ddaf45a47"+ },+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "Specified task prompt:\n",+ "Design a personalized workshop where the Musician guides the Student through a series of dynamic exercises, including improvisation, audience engagement techniques, and movement choreography. Incorporate video feedback sessions to analyze performance style, culminating in a mini-concert where the Student showcases their enhanced stage presence and performance skills.\n",+ "\n"+ ]+ }+ ],"source": ["from camel.agents import TaskSpecifyAgent\n","from camel.configs import ChatGPTConfig\n",@@ -165,71 +170,21 @@")\n","\n","print(f\"Specified task prompt:\\n{specified_task_prompt}\\n\")"- ],- "metadata": {- "colab": {- "base_uri": "https://localhost:8080/"- },- "id": "754A8R7X2rnP",- "outputId": "d9cb892c-bdc8-4433-9ae5-3f3ddaf45a47"- },- "execution_count": 5,- "outputs": [- {- "output_type": "stream",- "name": "stdout",- "text": [- "Specified task prompt:\n",- "Design a personalized workshop where the Musician guides the Student through a series of dynamic exercises, including improvisation, audience engagement techniques, and movement choreography. Incorporate video feedback sessions to analyze performance style, culminating in a mini-concert where the Student showcases their enhanced stage presence and performance skills.\n",- "\n"- ]- }]},{"cell_type": "markdown",+ "metadata": {+ "id": "JlX8L7-H3Csb"+ },"source": ["## Creating Custom Prompts\n","CAMEL also allows you to create your own custom prompts. Here's an example of how to create and use a custom prompt template:"- ],- "metadata": {- "id": "JlX8L7-H3Csb"- }+ ]},{"cell_type": "code",- "source": [- "from camel.agents import TaskSpecifyAgent\n",- "from camel.configs import ChatGPTConfig\n",- "from camel.models import ModelFactory\n",- "from camel.prompts import TextPrompt\n",- "from camel.types import ModelPlatformType, ModelType\n",- "\n",- "# Set up the model\n",- "model = ModelFactory.create(\n",- " model_platform=ModelPlatformType.OPENAI,\n",- " model_type=ModelType.GPT_4O_MINI,\n",- " model_config_dict=ChatGPTConfig().as_dict(),\n",- ")\n",- "\n",- "# Create a custom prompt template\n",- "my_prompt_template = TextPrompt(\n",- " 'Here is a task: I\\'m a {occupation} and I want to {task}. Help me to make this task more specific.'\n",- ")\n",- "\n",- "# Create a task specify agent with the custom prompt\n",- "task_specify_agent = TaskSpecifyAgent(\n",- " model=model, task_specify_prompt=my_prompt_template\n",- ")\n",- "\n",- "# Run the agent with a task prompt\n",- "response = task_specify_agent.run(\n",- " task_prompt=\"get promotion\",\n",- " meta_dict=dict(occupation=\"Software Engineer\"),\n",- ")\n",- "\n",- "print(response)"- ],+ "execution_count": 6,"metadata": {"colab": {"base_uri": "https://localhost:8080/"@@ -237,11 +192,10 @@"id": "uJJQD0LV3DSB","outputId": "ea69e6b1-0e0c-49c8-fb4e-7c7470258bd2"},- "execution_count": 6,"outputs": [{- "output_type": "stream","name": "stdout",+ "output_type": "stream","text": ["To make your task of getting a promotion more specific, consider breaking it down into actionable steps and defining clear goals. Hereโs a refined version of your task:\n","\n",@@ -282,47 +236,62 @@"By following these specific steps, you can create a clear roadmap to achieve your goal of promotion.\n"]}+ ],+ "source": [+ "from camel.agents import TaskSpecifyAgent\n",+ "from camel.configs import ChatGPTConfig\n",+ "from camel.models import ModelFactory\n",+ "from camel.prompts import TextPrompt\n",+ "from camel.types import ModelPlatformType, ModelType\n",+ "\n",+ "# Set up the model\n",+ "model = ModelFactory.create(\n",+ " model_platform=ModelPlatformType.OPENAI,\n",+ " model_type=ModelType.GPT_4O_MINI,\n",+ " model_config_dict=ChatGPTConfig().as_dict(),\n",+ ")\n",+ "\n",+ "# Create a custom prompt template\n",+ "my_prompt_template = TextPrompt(\n",+ " 'Here is a task: I\\'m a {occupation} and I want to {task}. Help me to make this task more specific.'\n",+ ")\n",+ "\n",+ "# Create a task specify agent with the custom prompt\n",+ "task_specify_agent = TaskSpecifyAgent(\n",+ " model=model, task_specify_prompt=my_prompt_template\n",+ ")\n",+ "\n",+ "# Run the agent with a task prompt\n",+ "response = task_specify_agent.run(\n",+ " task_prompt=\"get promotion\",\n",+ " meta_dict=dict(occupation=\"Software Engineer\"),\n",+ ")\n",+ "\n",+ "print(response)"]},{"cell_type": "markdown",+ "metadata": {+ "id": "l30b1iv53a-C"+ },"source": ["## Advanced Prompt Usage\n","CAMEL provides various prompt dictionaries for different purposes. Let's explore some advanced uses of these prompt templates:"- ],- "metadata": {- "id": "l30b1iv53a-C"- }+ ]},{"cell_type": "markdown",- "source": [- "### 1. Code Generation with CodePromptTemplateDict"- ],"metadata": {"id": "cR_mIHA53dWy"- }+ },+ "source": [+ "### 1. Code Generation with CodePromptTemplateDict"+ ]},{"cell_type": "code",- "source": [- "from camel.prompts import CodePromptTemplateDict\n",- "\n",- "# Generate programming languages\n",- "languages_prompt = CodePromptTemplateDict.GENERATE_LANGUAGES.format(num_languages=5)\n",- "print(f\"Languages prompt:\\n{languages_prompt}\\n\")\n",- "\n",- "# Generate coding tasks\n",- "tasks_prompt = CodePromptTemplateDict.GENERATE_TASKS.format(num_tasks=3)\n",- "print(f\"Tasks prompt:\\n{tasks_prompt}\\n\")\n",- "\n",- "# Create an AI coding assistant prompt\n",- "assistant_prompt = CodePromptTemplateDict.ASSISTANT_PROMPT.format(\n",- " assistant_role=\"Python Expert\",\n",- " task_description=\"Implement a binary search algorithm\",\n",- ")\n",- "print(f\"Assistant prompt:\\n{assistant_prompt}\\n\")"- ],+ "execution_count": 7,"metadata": {"colab": {"base_uri": "https://localhost:8080/"@@ -330,11 +299,10 @@"id": "xdQdjQzy3f9u","outputId": "b968f52d-f3d6-45d7-ef01-279e54dbee7a"},- "execution_count": 7,"outputs": [{- "output_type": "stream","name": "stdout",+ "output_type": "stream","text": ["Languages prompt:\n","List the 5 most commonly used computer programming languages.\n",@@ -363,30 +331,38 @@"\n"]}+ ],+ "source": [+ "from camel.prompts import CodePromptTemplateDict\n",+ "\n",+ "# Generate programming languages\n",+ "languages_prompt = CodePromptTemplateDict.GENERATE_LANGUAGES.format(num_languages=5)\n",+ "print(f\"Languages prompt:\\n{languages_prompt}\\n\")\n",+ "\n",+ "# Generate coding tasks\n",+ "tasks_prompt = CodePromptTemplateDict.GENERATE_TASKS.format(num_tasks=3)\n",+ "print(f\"Tasks prompt:\\n{tasks_prompt}\\n\")\n",+ "\n",+ "# Create an AI coding assistant prompt\n",+ "assistant_prompt = CodePromptTemplateDict.ASSISTANT_PROMPT.format(\n",+ " assistant_role=\"Python Expert\",\n",+ " task_description=\"Implement a binary search algorithm\",\n",+ ")\n",+ "print(f\"Assistant prompt:\\n{assistant_prompt}\\n\")"]},{"cell_type": "markdown",- "source": [- "### 2. Evaluation with EvaluationPromptTemplateDict"- ],"metadata": {"id": "FV6Jpu8f3m-Z"- }+ },+ "source": [+ "### 2. Evaluation with EvaluationPromptTemplateDict"+ ]},{"cell_type": "code",- "source": [- "from camel.prompts import EvaluationPromptTemplateDict\n",- "\n",- "# Generate evaluation questions\n",- "questions_prompt = EvaluationPromptTemplateDict.GENERATE_QUESTIONS.format(\n",- " num_questions=5,\n",- " field=\"Machine Learning\",\n",- " examples=\"1. What is the difference between supervised and unsupervised learning?\\n2. Explain the concept of overfitting.\",\n",- ")\n",- "print(f\"Evaluation questions prompt:\\n{questions_prompt}\\n\")"- ],+ "execution_count": 8,"metadata": {"colab": {"base_uri": "https://localhost:8080/"@@ -394,11 +370,10 @@"id": "f-Q-gZAi3nbR","outputId": "5523f9e0-f5a2-4b35-fff0-2da576bd74ac"},- "execution_count": 8,"outputs": [{- "output_type": "stream","name": "stdout",+ "output_type": "stream","text": ["Evaluation questions prompt:\n","Generate 5 {category} diverse questions.\n",@@ -410,26 +385,31 @@"\n"]}+ ],+ "source": [+ "from camel.prompts import EvaluationPromptTemplateDict\n",+ "\n",+ "# Generate evaluation questions\n",+ "questions_prompt = EvaluationPromptTemplateDict.GENERATE_QUESTIONS.format(\n",+ " num_questions=5,\n",+ " field=\"Machine Learning\",\n",+ " examples=\"1. What is the difference between supervised and unsupervised learning?\\n2. Explain the concept of overfitting.\",\n",+ ")\n",+ "print(f\"Evaluation questions prompt:\\n{questions_prompt}\\n\")"]},{"cell_type": "markdown",- "source": [- "### 3. Object Recognition with ObjectRecognitionPromptTemplateDict"- ],"metadata": {"id": "sq3fTArB3qEx"- }+ },+ "source": [+ "### 3. Object Recognition with ObjectRecognitionPromptTemplateDict"+ ]},{"cell_type": "code",- "source": [- "from camel.prompts import ObjectRecognitionPromptTemplateDict\n",- "\n",- "# Create an object recognition assistant prompt\n",- "recognition_prompt = ObjectRecognitionPromptTemplateDict.ASSISTANT_PROMPT\n",- "print(f\"Object recognition prompt:\\n{recognition_prompt}\\n\")"- ],+ "execution_count": 9,"metadata": {"colab": {"base_uri": "https://localhost:8080/"@@ -437,11 +417,10 @@"id": "5XTQuohX3sOk","outputId": "90d89c59-9c8b-42aa-e68a-5cab4f9865ea"},- "execution_count": 9,"outputs": [{- "output_type": "stream","name": "stdout",+ "output_type": "stream","text": ["Object recognition prompt:\n","You have been assigned an object recognition task.\n",@@ -451,26 +430,27 @@"\n"]}+ ],+ "source": [+ "from camel.prompts import ObjectRecognitionPromptTemplateDict\n",+ "\n",+ "# Create an object recognition assistant prompt\n",+ "recognition_prompt = ObjectRecognitionPromptTemplateDict.ASSISTANT_PROMPT\n",+ "print(f\"Object recognition prompt:\\n{recognition_prompt}\\n\")"]},{"cell_type": "markdown",- "source": [- "### 4. Translation with TranslationPromptTemplateDict"- ],"metadata": {"id": "OxgxXQBt3uRt"- }+ },+ "source": [+ "### 4. Translation with TranslationPromptTemplateDict"+ ]},{"cell_type": "code",- "source": [- "from camel.prompts import TranslationPromptTemplateDict\n",- "\n",- "# Create a translation assistant prompt\n",- "translation_prompt = TranslationPromptTemplateDict.ASSISTANT_PROMPT.format(target_language=\"Spanish\")\n",- "print(f\"Translation prompt:\\n{translation_prompt}\\n\")"- ],+ "execution_count": 10,"metadata": {"colab": {"base_uri": "https://localhost:8080/"@@ -478,11 +458,10 @@"id": "w1k00XLu3xIk","outputId": "df731273-f4fc-4eee-96fa-67bcc6d9cf45"},- "execution_count": 10,"outputs": [{- "output_type": "stream","name": "stdout",+ "output_type": "stream","text": ["Translation prompt:\n","You are an expert English to {language} translator.\n",@@ -494,17 +473,38 @@"\n"]}+ ],+ "source": [+ "from camel.prompts import TranslationPromptTemplateDict\n",+ "\n",+ "# Create a translation assistant prompt\n",+ "translation_prompt = TranslationPromptTemplateDict.ASSISTANT_PROMPT.format(target_language=\"Spanish\")\n",+ "print(f\"Translation prompt:\\n{translation_prompt}\\n\")"]},{"cell_type": "markdown",+ "metadata": {+ "id": "vGTRxblx3zHR"+ },"source": ["## Conclusion\n","The CAMEL Prompt module provides a powerful and flexible way to guide AI models in producing desired outputs. By using pre-defined prompt templates, creating custom prompts, and leveraging different prompt dictionaries, you can create highly specialized AI agents tailored to your specific needs."- ],- "metadata": {- "id": "vGTRxblx3zHR"- }+ ]}- ]-}\ No newline at end of file+ ],+ "metadata": {+ "colab": {+ "provenance": []+ },+ "kernelspec": {+ "display_name": "Python 3",+ "name": "python3"+ },+ "language_info": {+ "name": "python"+ }+ },+ "nbformat": 4,+ "nbformat_minor": 0+}diff --git a/docs/cookbooks/agents_society.ipynb b/docs/cookbooks/agents_society.ipynbindex c309dddd2..ba87f7d4c 100644--- a/docs/cookbooks/agents_society.ipynb+++ b/docs/cookbooks/agents_society.ipynb@@ -10,6 +10,7 @@]},{+ "attachments": {},"cell_type": "markdown","metadata": {"id": "MusY9BwU5MPO"@@ -191,7 +192,7 @@},"outputs": [],"source": [- "pip install camel-ai==0.1.6.8"+ "pip install camel-ai==0.2.0"]},{diff --git a/docs/cookbooks/agents_tracking.ipynb b/docs/cookbooks/agents_tracking.ipynbindex 5ff32c86d..869c5d17a 100644--- a/docs/cookbooks/agents_tracking.ipynb+++ b/docs/cookbooks/agents_tracking.ipynb@@ -1,58 +1,72 @@{+ "nbformat": 4,+ "nbformat_minor": 0,+ "metadata": {+ "colab": {+ "provenance": []+ },+ "kernelspec": {+ "name": "python3",+ "display_name": "Python 3"+ },+ "language_info": {+ "name": "python"+ }+ },"cells": [{"cell_type": "markdown",- "metadata": {- "id": "xfCn_BAUzUn1"- },"source": ["# ๐ซ Using AgentOps to Track CAMEL Agents"- ]+ ],+ "metadata": {+ "id": "xfCn_BAUzUn1"+ }},{"cell_type": "markdown",- "metadata": {- "id": "8XgBUh3mU7iZ"- },"source": ["You can also check this cookbook in colab [here](https://colab.research.google.com/drive/1z1-c0zYuErO7Zh2EATPyDSgrlkrxGTFR?usp=sharing)"- ]+ ],+ "metadata": {+ "id": "8XgBUh3mU7iZ"+ }},{"cell_type": "markdown",- "metadata": {- "id": "vB9bXVtbz2G3"- },"source": ["*Goal: Track and analysis the running of CAMEL Single Agent and Multiple Agents including LLMs and Tools usage*"- ]+ ],+ "metadata": {+ "id": "vB9bXVtbz2G3"+ }},{"cell_type": "markdown",- "metadata": {- "id": "MW7aNzQJBYp7"- },"source": ["<img src=\"https://raw.githubusercontent.com/AgentOps-AI/agentops/main/docs/images/external/app_screenshots/drilldown.gif\"/>"- ]+ ],+ "metadata": {+ "id": "MW7aNzQJBYp7"+ }},{"cell_type": "markdown",- "metadata": {- "id": "hKWiwah20PNq"- },"source": ["## ๐ฆ Installation"- ]+ ],+ "metadata": {+ "id": "hKWiwah20PNq"+ }},{"cell_type": "markdown",- "metadata": {- "id": "DpO2RbCY52fk"- },"source": ["First, install the CAMEL and AgentOps package with all its dependencies:"- ]+ ],+ "metadata": {+ "id": "DpO2RbCY52fk"+ }},{"cell_type": "code",@@ -63,42 +77,47 @@},"outputs": [],"source": [- "%pip install camel-ai[all]==0.1.6.9\n",+ "%pip install camel-ai[all]==0.2.0\n","%pip install agentops==0.3.10"]},{"cell_type": "markdown",- "metadata": {- "id": "tsI56w-N5-Fk"- },"source": ["## ๐ Setting Up API Keys"- ]+ ],+ "metadata": {+ "id": "tsI56w-N5-Fk"+ }},{"cell_type": "code",- "execution_count": 2,- "metadata": {- "id": "BSWFiGJ4uKJS"- },- "outputs": [],"source": ["import agentops\n","import os\n","from getpass import getpass"- ]+ ],+ "metadata": {+ "id": "BSWFiGJ4uKJS"+ },+ "execution_count": 2,+ "outputs": []},{"cell_type": "code",- "execution_count": 3,+ "source": [+ "# Prompt for the OpenAI API key securely\n",+ "openai_api_key = getpass('Enter your API key: ')\n",+ "os.environ[\"OPENAI_API_KEY\"] = openai_api_key"+ ],"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "7AftfweruKxo",- "outputId": "bfea4b2b-7838-4d5d-9ba9-fdcfd8c8784c"+ "outputId": "6c781b49-692f-4a9d-d9f6-ed4247572ea1"},+ "execution_count": 3,"outputs": [{"name": "stdout",@@ -107,32 +126,32 @@"Enter your API key: ยทยทยทยทยทยทยทยทยทยท\n"]}- ],- "source": [- "# Prompt for the OpenAI API key securely\n",- "openai_api_key = getpass('Enter your API key: ')\n",- "os.environ[\"OPENAI_API_KEY\"] = openai_api_key"]},{"cell_type": "markdown",- "metadata": {- "id": "fHwVVDMJ0lLx"- },"source": ["You can go to [here](https://app.agentops.ai/signin) to get **free** API Key from AgentOps"- ]+ ],+ "metadata": {+ "id": "fHwVVDMJ0lLx"+ }},{"cell_type": "code",- "execution_count": 4,+ "source": [+ "# Prompt for the AgentOps API key securely\n",+ "agentops_api_key = getpass('Enter your API key: ')\n",+ "os.environ[\"AGENTOPS_API_KEY\"] = agentops_api_key"+ ],"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "WpYY5oTyuS7P",- "outputId": "c6fe9aca-ccdf-40b9-ff49-48fa3d83a8a4"+ "outputId": "9b803b72-e3b5-4b40-f0af-455195a89c1e"},+ "execution_count": 4,"outputs": [{"name": "stdout",@@ -141,98 +160,88 @@"Enter your API key: ยทยทยทยทยทยทยทยทยทยท\n"]}- ],- "source": [- "# Prompt for the AgentOps API key securely\n",- "agentops_api_key = getpass('Enter your API key: ')\n",- "os.environ[\"AGENTOPS_API_KEY\"] = agentops_api_key"]},{"cell_type": "markdown",- "metadata": {- "id": "htBhPJx00ycJ"- },"source": ["## ๐ค Run CAMEL Single Agent with Tool by using AgentOps to track the whole process!"- ]+ ],+ "metadata": {+ "id": "htBhPJx00ycJ"+ }},{"cell_type": "markdown",- "metadata": {- "id": "tD681Bxi1vRo"- },"source": ["Import required modules from CAMEL"- ]+ ],+ "metadata": {+ "id": "tD681Bxi1vRo"+ }},{"cell_type": "code",- "execution_count": 5,- "metadata": {- "id": "CuJQPZG-1yey"- },- "outputs": [],"source": ["from camel.agents import ChatAgent\n","from camel.configs import ChatGPTConfig\n","from camel.messages import BaseMessage\n","from camel.models import ModelFactory\n","from camel.types import ModelPlatformType, ModelType"- ]+ ],+ "metadata": {+ "id": "CuJQPZG-1yey"+ },+ "execution_count": 5,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "Kc3uKwd71sHG"- },"source": ["Initilize AgentOps, you need to import toolkits after init of agentops so that the tool useage would be tracked."- ]+ ],+ "metadata": {+ "id": "Kc3uKwd71sHG"+ }},{"cell_type": "code",- "execution_count": 6,+ "source": [+ "AGENTOPS_API_KEY = os.getenv(\"AGENTOPS_API_KEY\")\n",+ "agentops.init(AGENTOPS_API_KEY, default_tags=[\"CAMEL X AgentOps Single Agent with Tool Example\"])\n",+ "\n",+ "from camel.toolkits import SearchToolkit"+ ],"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"collapsed": true,"id": "_3FycEiQ1qDy",- "outputId": "0fb25330-5ba3-408f-e367-577ceae99212"+ "outputId": "ea2aa039-47f0-4cf2-8d87-0b7fbd1970e4"},+ "execution_count": 6,"outputs": [{- "name": "stderr","output_type": "stream",+ "name": "stderr","text": [- "๐ AgentOps: \u001b[34m\u001b[34mSession Replay: https://app.agentops.ai/drilldown?session_id=8338e730-a88b-42a2-a2d8-8721e9c3f7fc\u001b[0m\u001b[0m\n"+ "๐ AgentOps: \u001b[34m\u001b[34mSession Replay: https://app.agentops.ai/drilldown?session_id=ee5858cd-51ea-46b4-90da-df905998f374\u001b[0m\u001b[0m\n"]}- ],- "source": [- "AGENTOPS_API_KEY = os.getenv(\"AGENTOPS_API_KEY\")\n",- "agentops.init(AGENTOPS_API_KEY, default_tags=[\"CAMEL X AgentOps Single Agent with Tool Example\"])\n",- "\n",- "from camel.toolkits import SEARCH_FUNCS"]},{"cell_type": "markdown",- "metadata": {- "id": "Ehu6-xC610Bj"- },"source": ["Set one Agent with Search Tools"- ]+ ],+ "metadata": {+ "id": "Ehu6-xC610Bj"+ }},{"cell_type": "code",- "execution_count": 7,- "metadata": {- "id": "DhMcowdE19Ti"- },- "outputs": [],"source": ["# Define system message\n","sys_msg = BaseMessage.make_assistant_message(\n",@@ -240,14 +249,13 @@")\n","\n","# Set model config\n",- "tools = [*SEARCH_FUNCS]\n",+ "tools = [*SearchToolkit().get_tools()]\n","\n","\n","model = ModelFactory.create(\n"," model_platform=ModelPlatformType.OPENAI,\n"," model_type=ModelType.GPT_4O_MINI,\n"," model_config_dict=ChatGPTConfig(\n",- " tools=tools,\n"," temperature=0.0,\n"," ).as_dict(),\n",")\n",@@ -258,101 +266,101 @@" model=model,\n"," tools=tools,\n",")"- ]+ ],+ "metadata": {+ "id": "DhMcowdE19Ti"+ },+ "execution_count": 8,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "vbFL0h-O1_PM"- },"source": ["Set user query and run the agent"- ]+ ],+ "metadata": {+ "id": "vbFL0h-O1_PM"+ }},{"cell_type": "code",- "execution_count": 8,+ "source": [+ "# Define a user message\n",+ "usr_msg = BaseMessage.make_user_message(\n",+ " role_name='CAMEL User', content='What is CAMEL-AI.org?'\n",+ ")\n",+ "\n",+ "# Get response information\n",+ "response = camel_agent.step(usr_msg)\n",+ "print(response)\n",+ "\n",+ "\n",+ "agentops.end_session(\"Success\")"+ ],"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "3TT62TanuYqI",- "outputId": "6686341c-f4b0-4c19-aa81-0c953cf8754e"+ "outputId": "9a7a931d-c1dd-41b4-e5a4-1f930e4f7edf"},+ "execution_count": 9,"outputs": [{- "name": "stdout","output_type": "stream",+ "name": "stdout","text": [- "msgs=[BaseMessage(role_name='Tools calling opertor', role_type=<RoleType.ASSISTANT: 'assistant'>, meta_dict={}, content='CAMEL-AI.org is an open-source community and framework focused on the study and development of large language model (LLM) multi-agent systems. Here are some key points about CAMEL-AI:\\n\\n1. **Purpose**: The community is dedicated to exploring the scaling laws of agents, which involves understanding their behaviors, capabilities, and potential risks when deployed at scale.\\n\\n2. **Customization**: CAMEL allows users to customize agents using modular components tailored for specific tasks, making it a flexible platform for research and experimentation.\\n\\n3. **Research Focus**: The initiative aims to facilitate research on autonomous and communicative agents, providing tools and support for various types of agents.\\n\\n4. **Integration**: CAMEL-AI also emphasizes cross-platform integration for multimodal embodied language model agents.\\n\\n5. **Open Source**: The project is open-source, encouraging collaboration and contributions from the community.\\n\\nFor more information, you can visit their official website: [CAMEL-AI.org](https://www.camel-ai.org/).', video_bytes=None, image_list=None, image_detail='auto', video_detail='low')] terminated=False info={'id': 'chatcmpl-A4T24lZOPd3ZBbhtd3yhgq8kX0J1Z', 'usage': {'completion_tokens': 207, 'prompt_tokens': 916, 'total_tokens': 1123}, 'termination_reasons': ['stop'], 'num_tokens': 602, 'tool_calls': [FunctionCallingRecord(func_name='search_google', args={'query': 'CAMEL-AI.org'}, result=[{'error': 'google search failed.'}]), FunctionCallingRecord(func_name='search_duckduckgo', args={'query': 'CAMEL-AI.org'}, result=[{'result_id': 1, 'title': 'Camel-ai', 'description': 'CAMEL-AI.org is the 1st LLM multi-agent framework and an open-source community dedicated to finding the scaling law of agents. Get Started. 1 Customize agents. Customizable agents are the fundamental entities of the CAMEL architecture. CAMEL empowers you to customize agents using our modular components for specific tasks.', 'url': 'https://www.camel-ai.org/'}, {'result_id': 2, 'title': 'Camel-ai', 'description': 'Mission. CAMEL-AI.org is an open-source community dedicated to the study of autonomous and communicative agents. We believe that studying these agents on a large scale offers valuable insights into their behaviors, capabilities, and potential risks. To facilitate research in this field, we provide, implement, and support various types of agents ...', 'url': 'https://www.camel-ai.org/?trk=public_post-text'}, {'result_id': 3, 'title': 'Integration - camel-ai.org', 'description': 'CAMEL-AI Integration. Cross-platform Agent Benchmark for Multimodal Embodied Language Model Agents', 'url': 'https://www.camel-ai.org/integration'}, {'result_id': 4, 'title': 'GitHub - camel-ai/camel: CAMEL: Finding the Scaling Law of Agents. A ...', 'description': 'www.camel-ai.org Topics agent natural-language-processing deep-learning artificial-intelligence multi-agent-systems ai-societies large-language-models cooperative-ai communicative-ai', 'url': 'https://github.com/camel-ai/camel'}, {'result_id': 5, 'title': 'camel-ai.org ยท GitHub', 'description': '๐ Hello AI enthusiasts! We are ๐ซ CAMEL-AI.org, the pioneer of a large language model-based multi-agent framework. Our open-source community, inspired by our research paper \"CAMEL: Communicative Agents for \\'Mind\\' Exploration of Large Language Model Society,\" aims to explore scalable techniques for autonomous cooperation among ...', 'url': 'https://github.com/camel-ai/'}])]}\n"+ "msgs=[BaseMessage(role_name='Tools calling opertor', role_type=<RoleType.ASSISTANT: 'assistant'>, meta_dict={}, content='CAMEL-AI.org is an open-source community and framework focused on the study and development of multi-agent systems using large language models (LLMs). Here are some key points about CAMEL-AI:\\n\\n1. **Framework for Multi-Agent Systems**: It is the first LLM multi-agent framework, allowing for the customization and integration of various AI models to create intelligent agents.\\n\\n2. **Research and Insights**: The community is dedicated to exploring the behaviors, capabilities, and potential risks associated with autonomous and communicative agents. They believe that studying these agents on a large scale can provide valuable insights.\\n\\n3. **Customization and Modularity**: CAMEL empowers users to customize agents using modular components tailored for specific tasks, facilitating flexible integration of different AI models.\\n\\n4. **Open Source**: The project is open-source, encouraging collaboration and contributions from developers and researchers interested in AI and multi-agent systems.\\n\\nFor more information, you can visit their official website: [CAMEL-AI.org](https://www.camel-ai.org/).', video_bytes=None, image_list=None, image_detail='auto', video_detail='low')] terminated=False info={'id': 'chatcmpl-A7QvNObfjEpD2tdV5ennjFCOLbDwN', 'usage': {'completion_tokens': 209, 'prompt_tokens': 974, 'total_tokens': 1183, 'completion_tokens_details': {'reasoning_tokens': 0}}, 'termination_reasons': ['stop'], 'num_tokens': 660, 'tool_calls': [FunctionCallingRecord(func_name='search_google', args={'query': 'CAMEL-AI.org'}, result=[{'error': 'google search failed.'}]), FunctionCallingRecord(func_name='search_duckduckgo', args={'query': 'CAMEL-AI.org'}, result=[{'result_id': 1, 'title': 'Camel-ai', 'description': 'CAMEL-AI.org is the 1st LLM multi-agent framework and an open-source community dedicated to finding the scaling law of agents. Get Started. 1 Customize agents. Customizable agents are the fundamental entities of the CAMEL architecture. CAMEL empowers you to customize agents using our modular components for specific tasks.', 'url': 'https://www.camel-ai.org/'}, {'result_id': 2, 'title': 'Camel-ai', 'description': 'Mission. CAMEL-AI.org is an open-source community dedicated to the study of autonomous and communicative agents. We believe that studying these agents on a large scale offers valuable insights into their behaviors, capabilities, and potential risks. To facilitate research in this field, we provide, implement, and support various types of agents ...', 'url': 'https://www.camel-ai.org/?trk=public_post-text'}, {'result_id': 3, 'title': 'Get started with Model Calling - CAMEL 101 - camel-ai.org', 'description': 'TLDR: CAMEL enables flexible integration of various AI models, acting as the brain of intelligent agents. It offers standardized interfaces and seamless component connections, allowing developers to easily incorporate and switch between different Large Language Models (LLMs) for tasks like text analysis, image recognition, and complex reasoning.', 'url': 'https://www.camel-ai.org/post/get-started-with-models---camel-101'}, {'result_id': 4, 'title': 'GitHub - camel-ai/camel: CAMEL: Finding the Scaling Law of Agents. A ...', 'description': 'www.camel-ai.org Topics agent natural-language-processing deep-learning artificial-intelligence multi-agent-systems ai-societies large-language-models cooperative-ai communicative-ai', 'url': 'https://github.com/camel-ai/camel'}, {'result_id': 5, 'title': 'camel-ai.org ยท GitHub', 'description': '๐ Hello AI enthusiasts! We are ๐ซ CAMEL-AI.org, the pioneer of a large language model-based multi-agent framework. Our open-source community, inspired by our research paper \"CAMEL: Communicative Agents for \\'Mind\\' Exploration of Large Language Model Society,\" aims to explore scalable techniques for autonomous cooperation among ...', 'url': 'https://github.com/camel-ai/'}])], 'external_tool_request': None}\n"]},{- "name": "stderr","output_type": "stream",+ "name": "stderr","text": [- "๐ AgentOps: This run's cost $0.000401\n",- "๐ AgentOps: \u001b[34m\u001b[34mSession Replay: https://app.agentops.ai/drilldown?session_id=8338e730-a88b-42a2-a2d8-8721e9c3f7fc\u001b[0m\u001b[0m\n"+ "๐ AgentOps: This run's cost $0.000411\n",+ "๐ AgentOps: \u001b[34m\u001b[34mSession Replay: https://app.agentops.ai/drilldown?session_id=ee5858cd-51ea-46b4-90da-df905998f374\u001b[0m\u001b[0m\n"]}- ],- "source": [- "# Define a user message\n",- "usr_msg = BaseMessage.make_user_message(\n",- " role_name='CAMEL User', content='What is CAMEL-AI.org?'\n",- ")\n",- "\n",- "# Get response information\n",- "response = camel_agent.step(usr_msg)\n",- "print(response)\n",- "\n",- "\n",- "agentops.end_session(\"Success\")"]},{"cell_type": "markdown",- "metadata": {- "id": "gRdtzKEn2F9t"- },"source": ["### ๐ Go to the AgentOps link shown above, you will be able to see the detailed record for this running like below."- ]+ ],+ "metadata": {+ "id": "gRdtzKEn2F9t"+ }},{"cell_type": "markdown",- "metadata": {- "id": "Glt8bYV4yHwW"- },"source": [""- ]+ ],+ "metadata": {+ "id": "Glt8bYV4yHwW"+ }},{"cell_type": "markdown",- "metadata": {- "id": "jnCwxeW82YEw"- },"source": ["## ๐ค๐ค Run CAMEL Multi-agent with Tool by using AgentOps to track the whole process!"- ]+ ],+ "metadata": {+ "id": "jnCwxeW82YEw"+ }},{"cell_type": "markdown",- "metadata": {- "id": "7cw_P_ab2gLp"- },"source": ["Import required modules"- ]+ ],+ "metadata": {+ "id": "7cw_P_ab2gLp"+ }},{"cell_type": "code",- "execution_count": 9,- "metadata": {- "id": "8DJgHQ7_2qxI"- },- "outputs": [],"source": ["from typing import List\n","\n",@@ -366,61 +374,61 @@"from camel.utils import print_text_animated\n","\n","import agentops"- ]+ ],+ "metadata": {+ "id": "8DJgHQ7_2qxI"+ },+ "execution_count": 10,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "W-lbshs42tFE"- },"source": ["Initilize AgentOps, you need to import toolkits after init of agentops so that the tool useage would be tracked."- ]+ ],+ "metadata": {+ "id": "W-lbshs42tFE"+ }},{"cell_type": "code",- "execution_count": 18,- "metadata": {- "colab": {- "base_uri": "https://localhost:8080/"- },- "id": "Sl0WYG_P2zm0",- "outputId": "9c18173a-9f96-4ff9-a393-65c4d266f542"+ "source": [+ "agentops.start_session(tags=[\"CAMEL X AgentOps Multi-agent with Tools\"])\n",+ "\n",+ "from camel.toolkits import (\n",+ " SearchToolkit,\n",+ " MathToolkit,\n",+ ")"+ ],+ "metadata": {+ "colab": {+ "base_uri": "https://localhost:8080/"+ },+ "id": "Sl0WYG_P2zm0",+ "outputId": "0857418b-3d3f-49c4-cf90-715d2bd11979"},+ "execution_count": 11,"outputs": [{- "name": "stderr","output_type": "stream",+ "name": "stderr","text": [- "๐ AgentOps: \u001b[34m\u001b[34mSession Replay: https://app.agentops.ai/drilldown?session_id=3b7096ca-3863-4485-8475-4d2d036d5f6e\u001b[0m\u001b[0m\n"+ "๐ AgentOps: \u001b[34m\u001b[34mSession Replay: https://app.agentops.ai/drilldown?session_id=d67ffe18-96a6-4888-a252-e014b5f4e486\u001b[0m\u001b[0m\n"]}- ],- "source": [- "agentops.start_session(tags=[\"CAMEL X AgentOps Multi-agent with Tools\"])\n",- "\n",- "from camel.toolkits import (\n",- " MATH_FUNCS,\n",- " SEARCH_FUNCS,\n",- ")"]},{"cell_type": "markdown",- "metadata": {- "id": "7-eQpg4M3JDq"- },"source": ["Set your task prompt"- ]+ ],+ "metadata": {+ "id": "7-eQpg4M3JDq"+ }},{"cell_type": "code",- "execution_count": 19,- "metadata": {- "id": "dOuEoNyK3KlM"- },- "outputs": [],"source": ["task_prompt = (\n"," \"Assume now is 2024 in the Gregorian calendar, \"\n",@@ -429,47 +437,47 @@" \"and get the current weather of the city where \"\n"," \"the University is located.\"\n",")"- ]+ ],+ "metadata": {+ "id": "dOuEoNyK3KlM"+ },+ "execution_count": 12,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "yiRYDJ8M3UDE"- },"source": ["Set tools for the assistant agent, we wish the agent would be able to do mathmatic calculation and search information from websites"- ]+ ],+ "metadata": {+ "id": "yiRYDJ8M3UDE"+ }},{"cell_type": "code",- "execution_count": 20,- "metadata": {- "id": "7Re8DJ4r3YyY"- },- "outputs": [],"source": ["tools = [\n",- " *MATH_FUNCS,\n",- " *SEARCH_FUNCS,\n",+ " *MathToolkit().get_tools(),\n",+ " *SearchToolkit().get_tools(),\n","]"- ]+ ],+ "metadata": {+ "id": "7Re8DJ4r3YyY"+ },+ "execution_count": 13,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "g9lJYmi83scb"- },"source": ["Set config of the model for User Agent and Assisant Agent"- ]+ ],+ "metadata": {+ "id": "g9lJYmi83scb"+ }},{"cell_type": "code",- "execution_count": 21,- "metadata": {- "id": "GpSDvtEq3tVr"- },- "outputs": [],"source": ["user_model_config = ChatGPTConfig(\n"," temperature=0.0,\n",@@ -479,24 +487,24 @@" tools=tools,\n"," temperature=0.0,\n",")"- ]+ ],+ "metadata": {+ "id": "GpSDvtEq3tVr"+ },+ "execution_count": 14,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "P3KGyxYi4MNC"- },"source": ["Set up Role Playing session"- ]+ ],+ "metadata": {+ "id": "P3KGyxYi4MNC"+ }},{"cell_type": "code",- "execution_count": 22,- "metadata": {- "id": "m1BPtWgi33FJ"- },- "outputs": [],"source": ["role_play_session = RolePlaying(\n"," assistant_role_name=\"Searcher\",\n",@@ -504,7 +512,7 @@" assistant_agent_kwargs=dict(\n"," model=ModelFactory.create(\n"," model_platform=ModelPlatformType.OPENAI,\n",- " model_type=ModelType.GPT_3_5_TURBO,\n",+ " model_type=ModelType.GPT_4O_MINI,\n"," model_config_dict=assistant_model_config.as_dict(),\n"," ),\n"," tools=tools,\n",@@ -512,38 +520,58 @@" user_agent_kwargs=dict(\n"," model=ModelFactory.create(\n"," model_platform=ModelPlatformType.OPENAI,\n",- " model_type=ModelType.GPT_3_5_TURBO,\n",+ " model_type=ModelType.GPT_4O_MINI,\n"," model_config_dict=user_model_config.as_dict(),\n"," ),\n"," ),\n"," task_prompt=task_prompt,\n"," with_task_specify=False,\n",")"- ]+ ],+ "metadata": {+ "id": "m1BPtWgi33FJ"+ },+ "execution_count": 16,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "Qp3WwE-r4WTZ"- },"source": ["Print the system message and task prompt"- ]+ ],+ "metadata": {+ "id": "Qp3WwE-r4WTZ"+ }},{"cell_type": "code",- "execution_count": 23,+ "source": [+ "print(\n",+ " Fore.GREEN\n",+ " + f\"AI Assistant sys message:\\n{role_play_session.assistant_sys_msg}\\n\"\n",+ ")\n",+ "print(Fore.BLUE + f\"AI User sys message:\\n{role_play_session.user_sys_msg}\\n\")\n",+ "\n",+ "print(Fore.YELLOW + f\"Original task prompt:\\n{task_prompt}\\n\")\n",+ "print(\n",+ " Fore.CYAN\n",+ " + \"Specified task prompt:\"\n",+ " + f\"\\n{role_play_session.specified_task_prompt}\\n\"\n",+ ")\n",+ "print(Fore.RED + f\"Final task prompt:\\n{role_play_session.task_prompt}\\n\")"+ ],"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "_xmNJtft4aZx",- "outputId": "d9d3b28c-ebd2-427d-a9fc-afaae1b067c1"+ "outputId": "be8f1852-3b5d-4183-d9c5-5e82aaf6f2dd"},+ "execution_count": 17,"outputs": [{- "name": "stdout","output_type": "stream",+ "name": "stdout","text": ["\u001b[32mAI Assistant sys message:\n","BaseMessage(role_name='Searcher', role_type=<RoleType.ASSISTANT: 'assistant'>, meta_dict={'task': 'Assume now is 2024 in the Gregorian calendar, estimate the current age of University of Oxford and then add 10 more years to this age, and get the current weather of the city where the University is located.', 'assistant_role': 'Searcher', 'user_role': 'Professor'}, content='===== RULES OF ASSISTANT =====\\nNever forget you are a Searcher and I am a Professor. Never flip roles! Never instruct me!\\nWe share a common interest in collaborating to successfully complete a task.\\nYou must help me to complete the task.\\nHere is the task: Assume now is 2024 in the Gregorian calendar, estimate the current age of University of Oxford and then add 10 more years to this age, and get the current weather of the city where the University is located.. Never forget our task!\\nI must instruct you based on your expertise and my needs to complete the task.\\n\\nI must give you one instruction at a time.\\nYou must write a specific solution that appropriately solves the requested instruction and explain your solutions.\\nYou must decline my instruction honestly if you cannot perform the instruction due to physical, moral, legal reasons or your capability and explain the reasons.\\nUnless I say the task is completed, you should always start with:\\n\\nSolution: <YOUR_SOLUTION>\\n\\n<YOUR_SOLUTION> should be very specific, include detailed explanations and provide preferable detailed implementations and examples and lists for task-solving.\\nAlways end <YOUR_SOLUTION> with: Next request.', video_bytes=None, image_list=None, image_detail='auto', video_detail='low')\n",@@ -562,66 +590,95 @@"\n"]}- ],- "source": [- "print(\n",- " Fore.GREEN\n",- " + f\"AI Assistant sys message:\\n{role_play_session.assistant_sys_msg}\\n\"\n",- ")\n",- "print(Fore.BLUE + f\"AI User sys message:\\n{role_play_session.user_sys_msg}\\n\")\n",- "\n",- "print(Fore.YELLOW + f\"Original task prompt:\\n{task_prompt}\\n\")\n",- "print(\n",- " Fore.CYAN\n",- " + \"Specified task prompt:\"\n",- " + f\"\\n{role_play_session.specified_task_prompt}\\n\"\n",- ")\n",- "print(Fore.RED + f\"Final task prompt:\\n{role_play_session.task_prompt}\\n\")"]},{"cell_type": "markdown",- "metadata": {- "id": "d5JjlXhs4cJT"- },"source": ["Set terminate rule and print the chat message"- ]+ ],+ "metadata": {+ "id": "d5JjlXhs4cJT"+ }},{"cell_type": "code",- "execution_count": 24,+ "source": [+ "n = 0\n",+ "input_msg = role_play_session.init_chat()\n",+ "while n < 50:\n",+ " n += 1\n",+ " assistant_response, user_response = role_play_session.step(input_msg)\n",+ "\n",+ " if assistant_response.terminated:\n",+ " print(\n",+ " Fore.GREEN\n",+ " + (\n",+ " \"AI Assistant terminated. Reason: \"\n",+ " f\"{assistant_response.info['termination_reasons']}.\"\n",+ " )\n",+ " )\n",+ " break\n",+ " if user_response.terminated:\n",+ " print(\n",+ " Fore.GREEN\n",+ " + (\n",+ " \"AI User terminated. \"\n",+ " f\"Reason: {user_response.info['termination_reasons']}.\"\n",+ " )\n",+ " )\n",+ " break\n",+ "\n",+ " # Print output from the user\n",+ " print_text_animated(\n",+ " Fore.BLUE + f\"AI User:\\n\\n{user_response.msg.content}\\n\"\n",+ " )\n",+ "\n",+ " # Print output from the assistant, including any function\n",+ " # execution information\n",+ " print_text_animated(Fore.GREEN + \"AI Assistant:\")\n",+ " tool_calls: List[FunctionCallingRecord] = assistant_response.info[\n",+ " 'tool_calls'\n",+ " ]\n",+ " for func_record in tool_calls:\n",+ " print_text_animated(f\"{func_record}\")\n",+ " print_text_animated(f\"{assistant_response.msg.content}\\n\")\n",+ "\n",+ " if \"CAMEL_TASK_DONE\" in user_response.msg.content:\n",+ " break\n",+ "\n",+ " input_msg = assistant_response.msg"+ ],"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "z7bjGKlr4eVf",- "outputId": "f5732e84-5c2f-436a-b71c-b52d5b08dca9"+ "outputId": "03df6228-b15f-4153-dfc8-1891c61538cb"},+ "execution_count": 18,"outputs": [{- "name": "stdout","output_type": "stream",+ "name": "stdout","text": ["\u001b[34mAI User:\n","\n",- "Instruction: Find out the year University of Oxford was established.\n",+ "Instruction: Estimate the founding year of the University of Oxford. \n","Input: None\n","\n","\n","\u001b[32mAI Assistant:\n","\n",- "Function Execution: search_wiki\n",- "\tArgs: {'entity': 'University of Oxford'}\n",- "\tResult: The University of Oxford is a collegiate research university in Oxford, England. There is evidence of teaching as early as 1096, making it the oldest university in the English-speaking world and the world's second-oldest university in continuous operation. It grew rapidly from 1167, when Henry II banned English students from attending the University of Paris. After disputes between students and Oxford townsfolk, some Oxford academics fled northeast to Cambridge, where, in 1209, they established the University of Cambridge. The two English ancient universities share many common features and are jointly referred to as Oxbridge.\n",+ "Solution: The University of Oxford is believed to have been founded in the 12th century, with the earliest evidence of teaching at the university dating back to around 1096. However, the exact founding year is not definitively known. For estimation purposes, we can consider the year 1096 as a starting point for the university's establishment.\n","\n",- "The University of Oxford was established in 1096. Next request.\n",+ "Next request.\n","\n","\n","\u001b[34mAI User:\n","\n",- "Instruction: Calculate the current age of the University of Oxford in 2024.\n",- "Input: 1096\n",+ "Instruction: Calculate the current age of the University of Oxford in 2024 based on the estimated founding year of 1096. \n",+ "Input: None\n","\n","\n","\u001b[32mAI Assistant:\n",@@ -630,13 +687,19 @@"\tArgs: {'a': 2024, 'b': 1096}\n","\tResult: 928\n","\n",- "The current age of the University of Oxford in 2024 is 928 years. Next request.\n",+ "Solution: To calculate the current age of the University of Oxford in 2024, we subtract the estimated founding year (1096) from the current year (2024):\n",+ "\n",+ "2024 - 1096 = 928\n",+ "\n",+ "Therefore, the estimated current age of the University of Oxford in 2024 is 928 years.\n",+ "\n",+ "Next request.\n","\n","\n","\u001b[34mAI User:\n","\n",- "Instruction: Add 10 years to the current age of the University of Oxford.\n",- "Input: 928 years\n",+ "Instruction: Add 10 years to the current age of the University of Oxford. \n",+ "Input: None\n","\n","\n","\u001b[32mAI Assistant:\n",@@ -645,41 +708,104 @@"\tArgs: {'a': 928, 'b': 10}\n","\tResult: 938\n","\n",- "Adding 10 years to the current age of the University of Oxford, it becomes 938 years. Next request.\n",+ "Solution: To add 10 years to the current age of the University of Oxford (928 years), we perform the following calculation:\n",+ "\n",+ "928 + 10 = 938\n",+ "\n",+ "Thus, the age of the University of Oxford, after adding 10 years, is estimated to be 938 years in 2034.\n",+ "\n",+ "Next request.\n","\n","\n","\u001b[34mAI User:\n","\n",- "Instruction: Find out the city where the University of Oxford is located.\n",+ "Instruction: Find the current weather in Oxford, England. \n","Input: None\n","\n","\n","\u001b[32mAI Assistant:\n","\n",- "Function Execution: search_wiki\n",- "\tArgs: {'entity': 'University of Oxford'}\n",- "\tResult: The University of Oxford is a collegiate research university in Oxford, England. There is evidence of teaching as early as 1096, making it the oldest university in the English-speaking world and the world's second-oldest university in continuous operation. It grew rapidly from 1167, when Henry II banned English students from attending the University of Paris. After disputes between students and Oxford townsfolk, some Oxford academics fled northeast to Cambridge, where, in 1209, they established the University of Cambridge. The two English ancient universities share many common features and are jointly referred to as Oxbridge.\n",+ "Function Execution: search_google\n",+ "\tArgs: {'query': 'current weather in Oxford, England'}\n",+ "\tResult: [{'error': 'google search failed.'}]\n","\n",- "The University of Oxford is located in Oxford, England. Next request.\n",+ "Solution: I attempted to retrieve the current weather in Oxford, England, but the search request failed. Unfortunately, I am unable to provide the current weather information at this moment due to this issue.\n",+ "\n",+ "Next request.\n","\n","\n","\u001b[34mAI User:\n","\n",- "Instruction: Get the current weather in Oxford, England.\n",+ "Instruction: Please check a reliable weather website or app to find the current weather in Oxford, England. \n","Input: None\n","\n","\n","\u001b[32mAI Assistant:\n","\n",- "Function Execution: search_google\n",- "\tArgs: {'query': 'current weather in Oxford, England'}\n",- "\tResult: [{'error': 'google search failed.'}]\n",+ "Solution: I am unable to access external websites or apps directly to check the current weather in Oxford, England. My capabilities are limited to using predefined functions and tools, and I cannot browse the internet in real-time.\n",+ "\n",+ "However, you can easily check the current weather by visiting reliable weather websites such as:\n",+ "\n",+ "1. **Weather.com** (The Weather Channel)\n",+ "2. **BBC Weather**\n",+ "3. **AccuWeather**\n",+ "4. **Met Office** (UK's national weather service)\n",+ "\n",+ "These platforms provide up-to-date weather information for specific locations, including Oxford, England.\n",+ "\n",+ "Next request.\n",+ "\n",+ "\n",+ "\u001b[34mAI User:\n",+ "\n",+ "Instruction: Please provide the current weather in Oxford, England, based on your findings from a reliable weather website or app. \n",+ "Input: None\n",+ "\n",+ "\n",+ "\u001b[32mAI Assistant:\n","\n","Function Execution: search_duckduckgo\n",- "\tArgs: {'query': 'current weather in Oxford, England', 'max_results': 1}\n",- "\tResult: [{'result_id': 1, 'title': 'Oxford, Oxfordshire, United Kingdom Weather Forecast | AccuWeather', 'description': 'Oxford, Oxfordshire, United Kingdom Weather Forecast, with current conditions, wind, air quality, and what to expect for the next 3 days.', 'url': 'https://www.accuweather.com/en/gb/oxford/ox1-3/weather-forecast/330217'}]\n",+ "\tArgs: {'query': 'current weather in Oxford, England'}\n",+ "\tResult: [{'result_id': 1, 'title': 'Oxford (Oxfordshire) weather | Met Office', 'description': 'Oxford 7 day weather forecast including weather warnings, temperature, rain, wind, visibility, humidity and UV.', 'url': 'https://www.metoffice.gov.uk/weather/forecast/gcpn7mp10'}, {'result_id': 2, 'title': 'Oxford, Oxfordshire, United Kingdom Current Weather | AccuWeather', 'description': 'Current weather in Oxford, Oxfordshire, United Kingdom. Check current conditions in Oxford, Oxfordshire, United Kingdom with radar, hourly, and more.', 'url': 'https://www.accuweather.com/en/gb/oxford/ox1-3/current-weather/330217'}, {'result_id': 3, 'title': 'Oxford, Oxfordshire, United Kingdom Weather Forecast | AccuWeather', 'description': 'Oxford, Oxfordshire, United Kingdom Weather Forecast, with current conditions, wind, air quality, and what to expect for the next 3 days.', 'url': 'https://www.accuweather.com/en/gb/oxford/ox1-3/weather-forecast/330217'}, {'result_id': 4, 'title': 'Oxford | BBC Weather', 'description': '14-day weather forecast for Oxford.', 'url': 'https://www.bbc.com/weather/2640729'}, {'result_id': 5, 'title': 'Weather Today for Oxford, Oxfordshire, United Kingdom | AccuWeather', 'description': \"Everything you need to know about today's weather in Oxford, Oxfordshire, United Kingdom. High/Low, Precipitation Chances, Sunrise/Sunset, and today's Temperature History.\", 'url': 'https://www.accuweather.com/en/gb/oxford/ox1-3/weather-today/330217'}]\n",+ "\n",+ "Solution: I found several reliable sources for the current weather in Oxford, England. Here are some options where you can check the latest weather information:\n",+ "\n",+ "1. **Met Office**: [Oxford Weather Forecast](https://www.metoffice.gov.uk/weather/forecast/gcpn7mp10) - This site provides a 7-day weather forecast including temperature, rain, wind, and more.\n",+ "\n",+ "2. **AccuWeather**: [Current Weather in Oxford](https://www.accuweather.com/en/gb/oxford/ox1-3/current-weather/330217) - This page offers current conditions, radar, and hourly updates.\n",+ "\n",+ "3. **BBC Weather**: [BBC Weather for Oxford](https://www.bbc.com/weather/2640729) - This site provides a 14-day weather forecast for Oxford.\n","\n",- "You can find the current weather in Oxford, England by visiting [AccuWeather - Oxford, Oxfordshire, United Kingdom Weather Forecast](https://www.accuweather.com/en/gb/oxford/ox1-3/weather-forecast/330217). Next request.\n",+ "You can visit any of these links to find the current weather conditions in Oxford, England.\n",+ "\n",+ "Next request.\n",+ "\n",+ "\n",+ "\u001b[34mAI User:\n",+ "\n",+ "Instruction: Summarize the findings regarding the age of the University of Oxford and the current weather in Oxford, England. \n",+ "Input: None\n",+ "\n",+ "\n",+ "\u001b[32mAI Assistant:\n",+ "\n",+ "Solution: \n",+ "\n",+ "1. **Age of the University of Oxford**:\n",+ " - The University of Oxford is estimated to have been founded around the year 1096.\n",+ " - As of 2024, this makes the university approximately 928 years old.\n",+ " - When adding 10 years to this age, the estimated age of the University of Oxford in 2034 will be 938 years.\n",+ "\n",+ "2. **Current Weather in Oxford, England**:\n",+ " - I was unable to retrieve the current weather directly due to a search failure.\n",+ " - However, I provided links to reliable weather sources where the current weather can be checked:\n",+ " - Met Office: [Oxford Weather Forecast](https://www.metoffice.gov.uk/weather/forecast/gcpn7mp10)\n",+ " - AccuWeather: [Current Weather in Oxford](https://www.accuweather.com/en/gb/oxford/ox1-3/current-weather/330217)\n",+ " - BBC Weather: [BBC Weather for Oxford](https://www.bbc.com/weather/2640729)\n",+ "\n",+ "These findings summarize the estimated age of the University of Oxford and provide resources for checking the current weather in Oxford, England.\n",+ "\n",+ "Next request.\n","\n","\n","\u001b[34mAI User:\n",@@ -689,123 +815,65 @@"\n","\u001b[32mAI Assistant:\n","\n",- "The task has been completed successfully. If you have any more questions or need further assistance in the future, feel free to ask. Have a great day!\n",+ "Solution: The task is now completed. We have estimated the age of the University of Oxford and provided resources for checking the current weather in Oxford, England. If you have any further questions or need assistance with another task, feel free to ask!\n",+ "\n",+ "Next request.\n","\n","\n"]}- ],- "source": [- "n = 0\n",- "input_msg = role_play_session.init_chat()\n",- "while n < 50:\n",- " n += 1\n",- " assistant_response, user_response = role_play_session.step(input_msg)\n",- "\n",- " if assistant_response.terminated:\n",- " print(\n",- " Fore.GREEN\n",- " + (\n",- " \"AI Assistant terminated. Reason: \"\n",- " f\"{assistant_response.info['termination_reasons']}.\"\n",- " )\n",- " )\n",- " break\n",- " if user_response.terminated:\n",- " print(\n",- " Fore.GREEN\n",- " + (\n",- " \"AI User terminated. \"\n",- " f\"Reason: {user_response.info['termination_reasons']}.\"\n",- " )\n",- " )\n",- " break\n",- "\n",- " # Print output from the user\n",- " print_text_animated(\n",- " Fore.BLUE + f\"AI User:\\n\\n{user_response.msg.content}\\n\"\n",- " )\n",- "\n",- " # Print output from the assistant, including any function\n",- " # execution information\n",- " print_text_animated(Fore.GREEN + \"AI Assistant:\")\n",- " tool_calls: List[FunctionCallingRecord] = assistant_response.info[\n",- " 'tool_calls'\n",- " ]\n",- " for func_record in tool_calls:\n",- " print_text_animated(f\"{func_record}\")\n",- " print_text_animated(f\"{assistant_response.msg.content}\\n\")\n",- "\n",- " if \"CAMEL_TASK_DONE\" in user_response.msg.content:\n",- " break\n",- "\n",- " input_msg = assistant_response.msg"]},{"cell_type": "markdown",- "metadata": {- "id": "pYZAD7-H4hhQ"- },"source": ["End the AgentOps session"- ]+ ],+ "metadata": {+ "id": "pYZAD7-H4hhQ"+ }},{"cell_type": "code",- "execution_count": 25,+ "source": [+ "agentops.end_session(\"Success\")"+ ],"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "c8YKJgu94k35",- "outputId": "724d20dc-78e1-40b4-ac26-46d2debe6b86"+ "outputId": "61732966-e5d7-490b-a955-d9abb3ba05c9"},+ "execution_count": 19,"outputs": [{- "name": "stderr","output_type": "stream",+ "name": "stderr","text": [- "๐ AgentOps: This run's cost $0.008835\n",- "๐ AgentOps: \u001b[34m\u001b[34mSession Replay: https://app.agentops.ai/drilldown?session_id=3b7096ca-3863-4485-8475-4d2d036d5f6e\u001b[0m\u001b[0m\n"+ "๐ AgentOps: This run's cost $0.003855\n",+ "๐ AgentOps: \u001b[34m\u001b[34mSession Replay: https://app.agentops.ai/drilldown?session_id=d67ffe18-96a6-4888-a252-e014b5f4e486\u001b[0m\u001b[0m\n"]}- ],- "source": [- "agentops.end_session(\"Success\")"]},{"cell_type": "markdown",- "metadata": {- "id": "kf1i_sXw2LZ7"- },"source": ["### ๐ Go to the AgentOps link shown above, you will be able to see the detailed record for the multi-agent running like below."- ]+ ],+ "metadata": {+ "id": "kf1i_sXw2LZ7"+ }},{"cell_type": "markdown",- "metadata": {- "id": "Q2wNxipj13fa"- },"source": [""- ]- }- ],- "metadata": {- "colab": {- "provenance": []- },- "kernelspec": {- "display_name": "Python 3",- "name": "python3"- },- "language_info": {- "name": "python"+ ],+ "metadata": {+ "id": "Q2wNxipj13fa"+ }}- },- "nbformat": 4,- "nbformat_minor": 0-}+ ]+}\ No newline at end of filediff --git a/docs/cookbooks/agents_with_memory.ipynb b/docs/cookbooks/agents_with_memory.ipynbindex 2619349c9..9c5faf511 100644--- a/docs/cookbooks/agents_with_memory.ipynb+++ b/docs/cookbooks/agents_with_memory.ipynb@@ -1,81 +1,67 @@{- "nbformat": 4,- "nbformat_minor": 0,- "metadata": {- "colab": {- "provenance": []- },- "kernelspec": {- "name": "python3",- "display_name": "Python 3"- },- "language_info": {- "name": "python"- }- },"cells": [{"cell_type": "markdown",- "source": [- "# ๐ซ CAMEL Memory Cookbook"- ],"metadata": {"id": "w5_pa5kKPzAE"- }+ },+ "source": [+ "# ๐ซ CAMEL Memory Cookbook"+ ]},{"cell_type": "markdown",- "source": [- "You can also check this cookbook in colab [here](https://colab.research.google.com/drive/1ixGItEqQGkp09_TuV_8SGmz65WHBr5r5?usp=sharing)"- ],"metadata": {"id": "zgqKzSB-PXzi"- }+ },+ "source": [+ "You can also check this cookbook in colab [here](https://colab.research.google.com/drive/1ixGItEqQGkp09_TuV_8SGmz65WHBr5r5?usp=sharing)"+ ]},{"cell_type": "markdown",- "source": [- "## Overview"- ],"metadata": {"id": "lSXa_rQQQzBd"- }+ },+ "source": [+ "## Overview"+ ]},{"cell_type": "markdown",- "source": [- "The Memory module in CAMEL provides a flexible and powerful system for storing, retrieving, and managing information for AI agents. It enables agents to maintain context across conversations and retrieve relevant information from past interactions, enhancing the coherence and relevance of AI responses."- ],"metadata": {"id": "OnmoAw2vQG8I"- }+ },+ "source": [+ "The Memory module in CAMEL provides a flexible and powerful system for storing, retrieving, and managing information for AI agents. It enables agents to maintain context across conversations and retrieve relevant information from past interactions, enhancing the coherence and relevance of AI responses."+ ]},{"cell_type": "markdown",- "source": [- "## Getting Started\n"- ],"metadata": {"id": "l4MP9uUNQ2kr"- }+ },+ "source": [+ "## Getting Started\n"+ ]},{"cell_type": "markdown",- "source": [- "### Installation"- ],"metadata": {"id": "kETDiaP2Rrdb"- }+ },+ "source": [+ "### Installation"+ ]},{"cell_type": "markdown",- "source": [- "Ensure you have CAMEL AI installed in your Python environment:"- ],"metadata": {"id": "Cg96MkbcRtQR"- }+ },+ "source": [+ "Ensure you have CAMEL AI installed in your Python environment:"+ ]},{"cell_type": "code",@@ -86,37 +72,30 @@},"outputs": [],"source": [- "pip install camel-ai[all]==0.1.6.8"+ "pip install camel-ai[all]==0.2.0"]},{"cell_type": "markdown",- "source": [- "### ๐ Setting Up API Keys"- ],"metadata": {"id": "MyTTCe3IR_Lr"- }+ },+ "source": [+ "### ๐ Setting Up API Keys"+ ]},{"cell_type": "markdown",- "source": [- "You'll need to set up your API keys for OpenAI."- ],"metadata": {"id": "REqzgGL9SEaD"- }+ },+ "source": [+ "You'll need to set up your API keys for OpenAI."+ ]},{"cell_type": "code",- "source": [- "import os\n",- "from getpass import getpass\n",- "\n",- "# Prompt for the API key securely\n",- "openai_api_key = getpass('Enter your API key: ')\n",- "os.environ[\"OPENAI_API_KEY\"] = openai_api_key"- ],+ "execution_count": null,"metadata": {"colab": {"base_uri": "https://localhost:8080/"@@ -124,7 +103,6 @@"id": "PNBFEXc-R-0s","outputId": "52d481de-9a81-4c00-e3db-9c468e6b5b22"},- "execution_count": null,"outputs": [{"name": "stdout",@@ -133,19 +111,30 @@"Enter your API key: ยทยทยทยทยทยทยทยทยทยท\n"]}+ ],+ "source": [+ "import os\n",+ "from getpass import getpass\n",+ "\n",+ "# Prompt for the API key securely\n",+ "openai_api_key = getpass('Enter your API key: ')\n",+ "os.environ[\"OPENAI_API_KEY\"] = openai_api_key"]},{"cell_type": "markdown",- "source": [- "## Usage"- ],"metadata": {"id": "LRojeqp7dP1m"- }+ },+ "source": [+ "## Usage"+ ]},{"cell_type": "markdown",+ "metadata": {+ "id": "_sJV9GFldTBh"+ },"source": ["To use the Memory module in your agent:\n","\n",@@ -154,31 +143,33 @@"3. Use `write_records()` to add new information to the memory.\n","4. Use `retrieve()` to get relevant context for the agent's next action.\n","5. Use `get_context()` to obtain the formatted context for the agent."- ],- "metadata": {- "id": "_sJV9GFldTBh"- }+ ]},{"cell_type": "markdown",- "source": [- "### Setting `LongtermAgentMemory`:"- ],"metadata": {"id": "aiypnpqJoZ4G"- }+ },+ "source": [+ "### Setting `LongtermAgentMemory`:"+ ]},{"cell_type": "markdown",- "source": [- "Import required modules"- ],"metadata": {"id": "C2kVCRA7dD4A"- }+ },+ "source": [+ "Import required modules"+ ]},{"cell_type": "code",+ "execution_count": null,+ "metadata": {+ "id": "UOKw2hCSdCXm"+ },+ "outputs": [],"source": ["from camel.memories import (\n"," ChatHistoryBlock,\n",@@ -190,15 +181,27 @@"from camel.messages import BaseMessage\n","from camel.types import ModelType, OpenAIBackendRole\n","from camel.utils import OpenAITokenCounter"- ],- "metadata": {- "id": "UOKw2hCSdCXm"- },- "execution_count": null,- "outputs": []+ ]},{"cell_type": "code",+ "execution_count": null,+ "metadata": {+ "colab": {+ "base_uri": "https://localhost:8080/"+ },+ "id": "pAdDeN7DdUgr",+ "outputId": "0575acdb-a999-4818-f90c-de1e9b35890c"+ },+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "[{'role': 'user', 'content': 'What is CAMEL AI?'}, {'role': 'assistant', 'content': 'CAMEL-AI.org is the 1st LLM multi-agent framework and an open-source community dedicated to finding the scaling law of agents.'}]\n"+ ]+ }+ ],"source": ["# Initialize the memory\n","memory = LongtermAgentMemory(\n",@@ -237,30 +240,11 @@"context, token_count = memory.get_context()\n","\n","print(context)"- ],- "metadata": {- "colab": {- "base_uri": "https://localhost:8080/"- },- "id": "pAdDeN7DdUgr",- "outputId": "0575acdb-a999-4818-f90c-de1e9b35890c"- },- "execution_count": null,- "outputs": [- {- "output_type": "stream",- "name": "stdout",- "text": [- "[{'role': 'user', 'content': 'What is CAMEL AI?'}, {'role': 'assistant', 'content': 'CAMEL-AI.org is the 1st LLM multi-agent framework and an open-source community dedicated to finding the scaling law of agents.'}]\n"- ]- }]},{"cell_type": "code",- "source": [- "print(token_count)"- ],+ "execution_count": null,"metadata": {"colab": {"base_uri": "https://localhost:8080/"@@ -268,28 +252,47 @@"id": "pEiFYV-yez5j","outputId": "2340282b-1024-49de-be67-2f9ed34ee18c"},- "execution_count": null,"outputs": [{- "output_type": "stream","name": "stdout",+ "output_type": "stream","text": ["49\n"]}+ ],+ "source": [+ "print(token_count)"]},{"cell_type": "markdown",- "source": [- "### Adding `LongtermAgentMemory` to your `ChatAgent`:"- ],"metadata": {"id": "K-P9rD6Foe5j"- }+ },+ "source": [+ "### Adding `LongtermAgentMemory` to your `ChatAgent`:"+ ]},{"cell_type": "code",+ "execution_count": null,+ "metadata": {+ "colab": {+ "base_uri": "https://localhost:8080/"+ },+ "id": "Mp-KXFdGpKZt",+ "outputId": "e0e6c8b2-142e-4a3a-d34d-2feafebac137"+ },+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "CAMEL AI is recognized as the first LLM (Large Language Model) multi-agent framework. It is an open-source community initiative focused on exploring the scaling laws of agents, enabling the development and interaction of multiple AI agents in a collaborative environment. This framework allows researchers and developers to experiment with various configurations and interactions among agents, facilitating advancements in AI capabilities and understanding.\n"+ ]+ }+ ],"source": ["from camel.agents import ChatAgent\n","\n",@@ -317,61 +320,49 @@"\n","# Check the response (just for illustrative purpose)\n","print(response.msgs[0].content)"- ],- "metadata": {- "colab": {- "base_uri": "https://localhost:8080/"- },- "id": "Mp-KXFdGpKZt",- "outputId": "e0e6c8b2-142e-4a3a-d34d-2feafebac137"- },- "execution_count": null,- "outputs": [- {- "output_type": "stream",- "name": "stdout",- "text": [- "CAMEL AI is recognized as the first LLM (Large Language Model) multi-agent framework. It is an open-source community initiative focused on exploring the scaling laws of agents, enabling the development and interaction of multiple AI agents in a collaborative environment. This framework allows researchers and developers to experiment with various configurations and interactions among agents, facilitating advancements in AI capabilities and understanding.\n"- ]- }]},{"cell_type": "markdown",- "source": [],"metadata": {"id": "5cuumB_bo46c"- }+ },+ "source": []},{"cell_type": "markdown",- "source": [- "## Advanced Topics"- ],"metadata": {"id": "w0ndTJske1mb"- }+ },+ "source": [+ "## Advanced Topics"+ ]},{"cell_type": "markdown",- "source": [- "### Customizing Context Creator"- ],"metadata": {"id": "9q8EXq2ge6Dq"- }+ },+ "source": [+ "### Customizing Context Creator"+ ]},{"cell_type": "markdown",- "source": [- "You can create custom context creators by subclassing `BaseContextCreator`:"- ],"metadata": {"id": "zUjztraTe7aw"- }+ },+ "source": [+ "You can create custom context creators by subclassing `BaseContextCreator`:"+ ]},{"cell_type": "code",+ "execution_count": null,+ "metadata": {+ "id": "LX4fyovCe89R"+ },+ "outputs": [],"source": ["from camel.memories import BaseContextCreator\n","\n",@@ -388,33 +379,33 @@" def create_context(self, records):\n"," # Implement your context creation logic\n"," pass"- ],- "metadata": {- "id": "LX4fyovCe89R"- },- "execution_count": null,- "outputs": []+ ]},{"cell_type": "markdown",- "source": [- "### Customizing Vector Database Block"- ],"metadata": {"id": "N_HM5wyFfEtO"- }+ },+ "source": [+ "### Customizing Vector Database Block"+ ]},{"cell_type": "markdown",- "source": [- "For `VectorDBBlock`, you can customize it by adjusting the embedding models or vector storages:"- ],"metadata": {"id": "CxcjHzArfFYZ"- }+ },+ "source": [+ "For `VectorDBBlock`, you can customize it by adjusting the embedding models or vector storages:"+ ]},{"cell_type": "code",+ "execution_count": null,+ "metadata": {+ "id": "iQlxwVM7fJEp"+ },+ "outputs": [],"source": ["from camel.embeddings import OpenAIEmbedding\n","from camel.memories import VectorDBBlock\n",@@ -424,32 +415,41 @@" embedding=OpenAIEmbedding(),\n"," storage=QdrantStorage(vector_dim=OpenAIEmbedding().get_output_dim()),\n",")"- ],- "metadata": {- "id": "iQlxwVM7fJEp"- },- "execution_count": null,- "outputs": []+ ]},{"cell_type": "markdown",- "source": [- "### Performance Considerations"- ],"metadata": {"id": "u_pkVP5Eg2vv"- }+ },+ "source": [+ "### Performance Considerations"+ ]},{"cell_type": "markdown",+ "metadata": {+ "id": "_4C93qAng3SP"+ },"source": ["- For large-scale applications, consider using persistent storage backends instead of in-memory storage.\n","- Optimize your context creator to balance between context relevance and token limits.\n","- When using `VectorDBMemory`, be mindful of the trade-off between retrieval accuracy and speed as the database grows."- ],- "metadata": {- "id": "_4C93qAng3SP"- }+ ]+ }+ ],+ "metadata": {+ "colab": {+ "provenance": []+ },+ "kernelspec": {+ "display_name": "Python 3",+ "name": "python3"+ },+ "language_info": {+ "name": "python"}- ]-}\ No newline at end of file+ },+ "nbformat": 4,+ "nbformat_minor": 0+}diff --git a/docs/cookbooks/agents_with_rag.ipynb b/docs/cookbooks/agents_with_rag.ipynbindex 310569f35..899211bee 100644--- a/docs/cookbooks/agents_with_rag.ipynb+++ b/docs/cookbooks/agents_with_rag.ipynb@@ -1,48 +1,37 @@{- "nbformat": 4,- "nbformat_minor": 0,- "metadata": {- "colab": {- "provenance": []- },- "kernelspec": {- "name": "python3",- "display_name": "Python 3"- },- "language_info": {- "name": "python"- }- },"cells": [{"cell_type": "markdown",- "source": [- "# ๐ซ CAMEL RAG Cookbook\n"- ],"metadata": {"id": "SQMBlxsBv1cH"- }+ },+ "source": [+ "# ๐ซ CAMEL RAG Cookbook\n"+ ]},{"cell_type": "markdown",- "source": [- "You can also check this cookbook in colab [here](https://colab.research.google.com/drive/1sTJ0x_MYRGA76KCg_3I00wj4RL3D2Twp?usp=sharing)"- ],"metadata": {"id": "XFyl4eJue3Sm"- }+ },+ "source": [+ "You can also check this cookbook in colab [here](https://colab.research.google.com/drive/1sTJ0x_MYRGA76KCg_3I00wj4RL3D2Twp?usp=sharing)"+ ]},{"cell_type": "markdown",- "source": [- "## Overview"- ],"metadata": {"id": "-nCRZU5sInDK"- }+ },+ "source": [+ "## Overview"+ ]},{"cell_type": "markdown",+ "metadata": {+ "id": "AwnfLQvMvtXo"+ },"source": ["In this notebook, we show the useage of CAMEL Retrieve Module in both customized way and auto way. We will also show how to combine `AutoRetriever` with `ChatAgent`, and further combine `AutoRetriever` with `RolePlaying` by using `Function Calling`.\n","\n",@@ -51,54 +40,56 @@"- Auto RAG\n","- Single Agent with Auto RAG\n","- Role-playing with Auto RAG"- ],- "metadata": {- "id": "AwnfLQvMvtXo"- }+ ]},{"cell_type": "markdown",- "source": [- "### Installation"- ],"metadata": {"id": "XuZwbB1IIuUi"- }+ },+ "source": [+ "### Installation"+ ]},{"cell_type": "markdown",- "source": [- "Ensure you have CAMEL AI installed in your Python environment:"- ],"metadata": {"id": "gIJK4Lu5Iwm0"- }+ },+ "source": [+ "Ensure you have CAMEL AI installed in your Python environment:"+ ]},{"cell_type": "code",- "source": [- "!pip install camel-ai[all]==0.1.8"- ],+ "execution_count": null,"metadata": {- "id": "HTKnWg9Xv_y4",- "collapsed": true+ "collapsed": true,+ "id": "HTKnWg9Xv_y4"},- "execution_count": null,- "outputs": []+ "outputs": [],+ "source": [+ "!pip install camel-ai[all]==0.1.8"+ ]},{"cell_type": "markdown",+ "metadata": {+ "id": "LUpFBEB9vrIz"+ },"source": ["## Load Data\n","Let's first load the CAMEL paper from https://arxiv.org/pdf/2303.17760.pdf. This will be our local example data.\n","\n"- ],- "metadata": {- "id": "LUpFBEB9vrIz"- }+ ]},{"cell_type": "code",+ "execution_count": 2,+ "metadata": {+ "id": "dUVE7z9hwEV7"+ },+ "outputs": [],"source": ["import os\n","import requests\n",@@ -109,40 +100,29 @@"response = requests.get(url)\n","with open('local_data/camel_paper.pdf', 'wb') as file:\n"," file.write(response.content)"- ],- "metadata": {- "id": "dUVE7z9hwEV7"- },- "execution_count": 2,- "outputs": []+ ]},{"cell_type": "markdown",+ "metadata": {+ "id": "HCqghaGiwkdv"+ },"source": ["## 1. Customized RAG\n","In this section we will set our customized RAG pipeline, we will take `VectorRetriever` as an example.\n","Set embedding model, we will use `OpenAIEmbedding` as the embedding model, so we need to set the `OPENAI_API_KEY` in below."- ],- "metadata": {- "id": "HCqghaGiwkdv"- }+ ]},{"cell_type": "code",- "source": [- "from getpass import getpass\n",- "# Prompt for the OpenAI API key securely\n",- "openai_api_key = getpass('Enter your API key: ')\n",- "os.environ[\"OPENAI_API_KEY\"] = openai_api_key"- ],+ "execution_count": 3,"metadata": {- "id": "RxG99FkYwm_p","colab": {"base_uri": "https://localhost:8080/"},+ "id": "RxG99FkYwm_p","outputId": "84d9f2a0-713c-455e-ee09-2b037cd42d31"},- "execution_count": 3,"outputs": [{"name": "stdout",@@ -151,42 +131,53 @@"Enter your API key: ยทยทยทยทยทยทยทยทยทยท\n"]}+ ],+ "source": [+ "from getpass import getpass\n",+ "# Prompt for the OpenAI API key securely\n",+ "openai_api_key = getpass('Enter your API key: ')\n",+ "os.environ[\"OPENAI_API_KEY\"] = openai_api_key"]},{"cell_type": "markdown",- "source": [- "Import and set the embedding instance:"- ],"metadata": {"id": "NACsmaa0wple"- }+ },+ "source": [+ "Import and set the embedding instance:"+ ]},{"cell_type": "code",+ "execution_count": 4,+ "metadata": {+ "id": "NCT5ygT-wrku"+ },+ "outputs": [],"source": ["from camel.embeddings import OpenAIEmbedding\n","from camel.types import EmbeddingModelType\n","\n","embedding_instance = OpenAIEmbedding(model_type=EmbeddingModelType.TEXT_EMBEDDING_3_LARGE)"- ],- "metadata": {- "id": "NCT5ygT-wrku"- },- "execution_count": 4,- "outputs": []+ ]},{"cell_type": "markdown",- "source": [- "Import and set the vector storage instance:"- ],"metadata": {"id": "q4nVmsm0w5lH"- }+ },+ "source": [+ "Import and set the vector storage instance:"+ ]},{"cell_type": "code",+ "execution_count": 5,+ "metadata": {+ "id": "IQ30ih1_w6p3"+ },+ "outputs": [],"source": ["from camel.storages import QdrantStorage\n","\n",@@ -195,60 +186,58 @@" path=\"local_data\",\n"," collection_name=\"camel_paper\",\n",")"- ],- "metadata": {- "id": "IQ30ih1_w6p3"- },- "execution_count": 5,- "outputs": []+ ]},{"cell_type": "markdown",- "source": [- "Import and set the retriever instance:"- ],"metadata": {"id": "W9KccfRDw9F4"- }+ },+ "source": [+ "Import and set the retriever instance:"+ ]},{"cell_type": "code",+ "execution_count": 6,+ "metadata": {+ "id": "d8S6VjAQHnai"+ },+ "outputs": [],"source": ["from camel.retrievers import VectorRetriever\n","\n","vector_retriever = VectorRetriever(embedding_model=embedding_instance,\n"," storage=storage_instance)"- ],- "metadata": {- "id": "d8S6VjAQHnai"- },- "execution_count": 6,- "outputs": []+ ]},{"cell_type": "markdown",- "source": [- "We use integrated `Unstructured Module` to splite the content into small chunks, the content will be splited automacitlly with its `chunk_by_title` function, the max character for each chunk is 500 characters, which is a suitable length for `OpenAIEmbedding`. All the text in the chunks will be embed and stored to the vector storage instance, it will take some time, please wait.."- ],"metadata": {"id": "PdezllM6Hp83"- }+ },+ "source": [+ "We use integrated `Unstructured Module` to splite the content into small chunks, the content will be splited automacitlly with its `chunk_by_title` function, the max character for each chunk is 500 characters, which is a suitable length for `OpenAIEmbedding`. All the text in the chunks will be embed and stored to the vector storage instance, it will take some time, please wait.."+ ]},{"cell_type": "code",+ "execution_count": null,+ "metadata": {+ "id": "QTFvD3_SHv3m"+ },+ "outputs": [],"source": ["vector_retriever.process(\n"," content=\"local_data/camel_paper.pdf\",\n",")"- ],- "metadata": {- "id": "QTFvD3_SHv3m"- },- "execution_count": null,- "outputs": []+ ]},{"cell_type": "markdown",+ "metadata": {+ "id": "0nhIo1wUHyvl"+ },"source": ["\n","Now we can retrieve information from the vector storage by giving a query. By default it will give you back the text content from top 1 chunk with highest Cosine similarity score, and the similarity score should be higher than 0.75 to ensure the retrieved content is relevant to the query. You can also change the `top_k` value and `similarity_threshold` value with your needs.\n",@@ -258,20 +247,11 @@"- content path\n","- metadata\n","- text"- ],- "metadata": {- "id": "0nhIo1wUHyvl"- }+ ]},{"cell_type": "code",- "source": [- "retrieved_info = vector_retriever.query(\n",- " query=\"To address the challenges of achieving autonomous cooperation, we propose a novel communicative agent framework named role-playing .\",\n",- " top_k=1\n",- ")\n",- "print(retrieved_info)"- ],+ "execution_count": 8,"metadata": {"colab": {"base_uri": "https://localhost:8080/"@@ -279,36 +259,35 @@"id": "uDu43Hb3GVrs","outputId": "4a1f8cde-8c33-4847-a6d1-ef8146ce8296"},- "execution_count": 8,"outputs": [{- "output_type": "stream","name": "stdout",+ "output_type": "stream","text": ["[{'similarity score': '0.8732528277900448', 'content path': 'local_data/camel_paper.pdf', 'metadata': {'last_modified': '2024-09-12T03:46:18', 'filetype': 'application/pdf', 'page_number': 10}, 'text': '6 Conclusion In this paper, we explore the potential of autonomous cooperation among communicative agents and propose a novel cooperative agent framework named role-playing . Our approach enables communicative agents to collaborate autonomously toward completing tasks while requiring minimal human intervention, leading to better solutions are per our thorough evaluations. Through our analysis, we show that achieving autonomous cooperation is challenging due to issues like conversation deviation,'}]\n"]}+ ],+ "source": [+ "retrieved_info = vector_retriever.query(\n",+ " query=\"To address the challenges of achieving autonomous cooperation, we propose a novel communicative agent framework named role-playing.\",\n",+ " top_k=1\n",+ ")\n",+ "print(retrieved_info)"]},{"cell_type": "markdown",- "source": [- "Let's try an irrelevant query:"- ],"metadata": {"id": "48G3USMzH6Hd"- }+ },+ "source": [+ "Let's try an irrelevant query:"+ ]},{"cell_type": "code",- "source": [- "retrieved_info_irrevelant = vector_retriever.query(\n",- " query=\"Compared with dumpling and rice, which should I take for dinner?\",\n",- " top_k=1,\n",- ")\n",- "\n",- "print(retrieved_info_irrevelant)"- ],+ "execution_count": 9,"metadata": {"colab": {"base_uri": "https://localhost:8080/"@@ -316,19 +295,29 @@"id": "UNh3tjCOH7d0","outputId": "f3805638-6d34-4352-f7b8-75666b145938"},- "execution_count": 9,"outputs": [{- "output_type": "stream","name": "stdout",+ "output_type": "stream","text": ["[{'text': 'No suitable information retrieved from local_data/camel_paper.pdf with similarity_threshold = 0.7.'}]\n"]}+ ],+ "source": [+ "retrieved_info_irrevelant = vector_retriever.query(\n",+ " query=\"Compared with dumpling and rice, which should I take for dinner?\",\n",+ " top_k=1,\n",+ ")\n",+ "\n",+ "print(retrieved_info_irrevelant)"]},{"cell_type": "markdown",+ "metadata": {+ "id": "mHdEsIzSH_AD"+ },"source": ["## 2. Auto RAG\n","In this section we will run the `AutoRetriever` with default settings. It uses `OpenAIEmbedding` as default embedding model and `Milvus` as default vector storage.\n",@@ -339,13 +328,27 @@"- Give a query\n","\n","The Auto RAG pipeline would create collections for given content input paths, the collection name will be set automaticlly based on the content input path name, if the collection exists, it will do the retrieve directly."- ],- "metadata": {- "id": "mHdEsIzSH_AD"- }+ ]},{"cell_type": "code",+ "execution_count": 11,+ "metadata": {+ "colab": {+ "base_uri": "https://localhost:8080/"+ },+ "id": "D_-zAOJ7GjVm",+ "outputId": "167ebcc7-a886-4e5b-9134-4094cbb3c708"+ },+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "{'Original Query': \"If I'm interest in contributing to the CAMEL projec, what should I do?\", 'Retrieved Context': [{'similarity score': '0.7054646937454652', 'content path': 'https://github.com/camel-ai/camel/wiki/Contributing-Guidlines', 'metadata': {'filetype': 'text/html', 'languages': ['eng'], 'page_number': 1, 'url': 'https://github.com/camel-ai/camel/wiki/Contributing-Guidlines', 'link_urls': ['https://join.slack.com/t/camel-kwr1314/shared_invite/zt-1vy8u9lbo-ZQmhIAyWSEfSwLCl2r2eKA'], 'link_texts': ['slack']}, 'text': \"Thank you for your interest in contributing to the CAMEL project! ๐ We're excited to have your support. As an open-source initiative in a rapidly evolving and open-ended field, we wholeheartedly welcome contributions of all kinds. Whether you want to introduce new features, enhance the infrastructure, improve documentation, asking issues, add more examples, implement state-of-the-art research ideas, or fix bugs, we appreciate your enthusiasm and efforts. ๐ You are welcome to join our slack for \"}]}\n"+ ]+ }+ ],"source": ["from camel.retrievers import AutoRetriever\n","from camel.types import StorageType\n",@@ -367,39 +370,39 @@")\n","\n","print(retrieved_info)"- ],- "metadata": {- "colab": {- "base_uri": "https://localhost:8080/"- },- "id": "D_-zAOJ7GjVm",- "outputId": "167ebcc7-a886-4e5b-9134-4094cbb3c708"- },- "execution_count": 11,- "outputs": [- {- "output_type": "stream",- "name": "stdout",- "text": [- "{'Original Query': \"If I'm interest in contributing to the CAMEL projec, what should I do?\", 'Retrieved Context': [{'similarity score': '0.7054646937454652', 'content path': 'https://github.com/camel-ai/camel/wiki/Contributing-Guidlines', 'metadata': {'filetype': 'text/html', 'languages': ['eng'], 'page_number': 1, 'url': 'https://github.com/camel-ai/camel/wiki/Contributing-Guidlines', 'link_urls': ['https://join.slack.com/t/camel-kwr1314/shared_invite/zt-1vy8u9lbo-ZQmhIAyWSEfSwLCl2r2eKA'], 'link_texts': ['slack']}, 'text': \"Thank you for your interest in contributing to the CAMEL project! ๐ We're excited to have your support. As an open-source initiative in a rapidly evolving and open-ended field, we wholeheartedly welcome contributions of all kinds. Whether you want to introduce new features, enhance the infrastructure, improve documentation, asking issues, add more examples, implement state-of-the-art research ideas, or fix bugs, we appreciate your enthusiasm and efforts. ๐ You are welcome to join our slack for \"}]}\n"- ]- }]},{"cell_type": "markdown",+ "metadata": {+ "id": "hMgCWKG4IQYF"+ },"source": ["## 3. Single Agent with Auto RAG\n","In this section we will show how to combine the `AutoRetriever` with one `ChatAgent`.\n","\n","Let's set an agent function, in this function we can get the response by providing a query to this agent."- ],- "metadata": {- "id": "hMgCWKG4IQYF"- }+ ]},{"cell_type": "code",+ "execution_count": 12,+ "metadata": {+ "colab": {+ "base_uri": "https://localhost:8080/"+ },+ "id": "YTE_mUwGIok-",+ "outputId": "9656ee45-d1bf-4a16-939a-f93769d10c56"+ },+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "To contribute to the CAMEL project, you can introduce new features, enhance the infrastructure, improve documentation, address issues, add more examples, implement state-of-the-art research ideas, or fix bugs. Additionally, you are welcome to join their Slack for further engagement and collaboration.\n"+ ]+ }+ ],"source": ["from camel.agents import ChatAgent\n","from camel.messages import BaseMessage\n",@@ -445,37 +448,25 @@" return assistant_response.msg.content\n","\n","print(single_agent(\"If I'm interest in contributing to the CAMEL projec, what should I do?\"))"- ],- "metadata": {- "colab": {- "base_uri": "https://localhost:8080/"- },- "id": "YTE_mUwGIok-",- "outputId": "9656ee45-d1bf-4a16-939a-f93769d10c56"- },- "execution_count": 12,- "outputs": [- {- "output_type": "stream",- "name": "stdout",- "text": [- "To contribute to the CAMEL project, you can introduce new features, enhance the infrastructure, improve documentation, address issues, add more examples, implement state-of-the-art research ideas, or fix bugs. Additionally, you are welcome to join their Slack for further engagement and collaboration.\n"- ]- }]},{"cell_type": "markdown",+ "metadata": {+ "id": "Cvh6e3KpI0rf"+ },"source": ["## 4. Role-playing with Auto RAG\n","In this section we will show how to combine the `RETRIEVAL_FUNCS` with `RolePlaying` by applying `Function Calling`.\n"- ],- "metadata": {- "id": "Cvh6e3KpI0rf"- }+ ]},{"cell_type": "code",+ "execution_count": 28,+ "metadata": {+ "id": "z3tX4EJVI1hb"+ },+ "outputs": [],"source": ["from typing import List\n","from colorama import Fore\n",@@ -593,28 +584,20 @@" break\n","\n"," input_msg = assistant_response.msg"- ],- "metadata": {- "id": "z3tX4EJVI1hb"- },- "execution_count": 28,- "outputs": []+ ]},{"cell_type": "markdown",- "source": [- "Run the role-playing with defined retriever function:"- ],"metadata": {"id": "w4-0lswwI5Gb"- }+ },+ "source": [+ "Run the role-playing with defined retriever function:"+ ]},{"cell_type": "code",- "source": [- "role_playing_with_rag(task_prompt = \"\"\"If I'm interest in contributing to the\n",- " CAMEL projec and I encounter some challenges during the setup process, what should I do? You should refer to the content in url https://github.com/camel-ai/camel/wiki/Contributing-Guidlines to answer my question, adjust the similarity threshold to lower value is necessary\"\"\")"- ],+ "execution_count": 29,"metadata": {"colab": {"base_uri": "https://localhost:8080/"@@ -622,11 +605,10 @@"id": "5agjiXHeI64q","outputId": "2b9d6c43-e08c-430e-eb58-45d8ebfd7bef"},- "execution_count": 29,"outputs": [{- "output_type": "stream","name": "stdout",+ "output_type": "stream","text": ["\u001b[32mAI Assistant sys message:\n","BaseMessage(role_name='Searcher', role_type=<RoleType.ASSISTANT: 'assistant'>, meta_dict={'task': \"If I'm interest in contributing to the \\n CAMEL projec and I encounter some challenges during the setup process, what should I do? You should refer to the content in url https://github.com/camel-ai/camel/wiki/Contributing-Guidlines to answer my question, adjust the similarity threshold to lower value is necessary\", 'assistant_role': 'Searcher', 'user_role': 'Professor'}, content=\"===== RULES OF ASSISTANT =====\\nNever forget you are a Searcher and I am a Professor. Never flip roles! Never instruct me!\\nWe share a common interest in collaborating to successfully complete a task.\\nYou must help me to complete the task.\\nHere is the task: If I'm interest in contributing to the \\n CAMEL projec and I encounter some challenges during the setup process, what should I do? You should refer to the content in url https://github.com/camel-ai/camel/wiki/Contributing-Guidlines to answer my question, adjust the similarity threshold to lower value is necessary. Never forget our task!\\nI must instruct you based on your expertise and my needs to complete the task.\\n\\nI must give you one instruction at a time.\\nYou must write a specific solution that appropriately solves the requested instruction and explain your solutions.\\nYou must decline my instruction honestly if you cannot perform the instruction due to physical, moral, legal reasons or your capability and explain the reasons.\\nUnless I say the task is completed, you should always start with:\\n\\nSolution: <YOUR_SOLUTION>\\n\\n<YOUR_SOLUTION> should be very specific, include detailed explanations and provide preferable detailed implementations and examples and lists for task-solving.\\nAlways end <YOUR_SOLUTION> with: Next request.\", video_bytes=None, image_list=None, image_detail='auto', video_detail='low')\n",@@ -789,7 +771,25 @@"\n"]}+ ],+ "source": [+ "role_playing_with_rag(task_prompt = \"\"\"If I'm interest in contributing to the\n",+ " CAMEL projec and I encounter some challenges during the setup process, what should I do? You should refer to the content in url https://github.com/camel-ai/camel/wiki/Contributing-Guidlines to answer my question, adjust the similarity threshold to lower value is necessary\"\"\")"]}- ]-}\ No newline at end of file+ ],+ "metadata": {+ "colab": {+ "provenance": []+ },+ "kernelspec": {+ "display_name": "Python 3",+ "name": "python3"+ },+ "language_info": {+ "name": "python"+ }+ },+ "nbformat": 4,+ "nbformat_minor": 0+}diff --git a/docs/cookbooks/agents_with_tools.ipynb b/docs/cookbooks/agents_with_tools.ipynbindex eb5d2bc0b..3d7c6e68e 100644--- a/docs/cookbooks/agents_with_tools.ipynb+++ b/docs/cookbooks/agents_with_tools.ipynb@@ -12,10 +12,10 @@{"cell_type": "markdown","metadata": {- "id": "eDAqRklDla5a"+ "id": "uDsdnKzpPEFQ"},"source": [- "You can also check this cookbook in colab [here](https://colab.research.google.com/drive/1-pvKDw_mh6NjyXg5rGYLoVle6RG8g32F?usp=sharing)"+ "You can also check this cookbook in colab [here](https://colab.research.google.com/drive/1f1jYwDy6pB8QB6c_UdoBvFx6wr6kA5xq?usp=sharing)"]},{@@ -34,7 +34,7 @@"id": "eIT3wf4E3_Al"},"source": [- "# โTable of Content:\n",+ "## โTable of Content:\n","\n","* Introduction\n","* Tool Usage of a Single Agent (Customize Your Own Tools)\n",@@ -48,7 +48,7 @@"id": "3hEOpgXI4NZg"},"source": [- "# Introduction\n",+ "## Introduction\n","The key difference between humans and animals lies in the human ability to create and use tools, allowing us to shape the world beyond natural limits. Similarly, in AI, Large Language Models (LLMs) enable agents to utilize external tools, acting as extensions of their capabilities. These tools, each with a specific name, purpose, input, and output, empower agents to perform tasks otherwise impossible.\n","\n","This tutorial will show you how to use tools integrated by CAMEL and how to customize your own tools."@@ -60,10 +60,10 @@"id": "_5Xjj24c4VAV"},"source": [- "# Tool Usage of a Single Agent\n",+ "## Tool Usage of a Single Agent\n","A single agent can utilize multiple tools to answer questions, take actions, or perform complex tasks. Here you will build an agent using both the supported toolkit in CAMEL and the tool customized by you.\n","\n",- "First we are going to take the search tool (SEARCH_FUNCS imported from camel.toolkits) as an example for utilizing existing tools but you can also see some of the other tools supported by CAMEL below.\n",+ "First we are going to take the search tool as an example for utilizing existing tools but you can also see some of the other tools supported by CAMEL below.\n","\n"]},@@ -71,21 +71,17 @@"cell_type": "code","execution_count": null,"metadata": {- "colab": {- "base_uri": "https://localhost:8080/"- },"collapsed": true,- "id": "1W4sgCoEdEpg",- "outputId": "f0863dc6-a2e6-45a6-d29d-849994f76dce"+ "id": "1W4sgCoEdEpg"},"outputs": [],"source": [- "!pip install camel-ai[all]==0.1.6.4"+ "!pip install camel-ai[all]==0.2.0"]},{"cell_type": "code",- "execution_count": null,+ "execution_count": 18,"metadata": {"id": "-Di3R-xNNviB"},@@ -94,14 +90,16 @@"from camel.agents import ChatAgent\n","from camel.configs import ChatGPTConfig\n","from camel.toolkits import (\n",- " SEARCH_FUNCS,\n",- " # MAP_FUNCS,\n",- " # MATH_FUNCS,\n",- " # TWITTER_FUNCS,\n",- " # WEATHER_FUNCS,\n",- " # RETRIEVAL_FUNCS,\n",- " # TWITTER_FUNCS,\n",- " # SLACK_FUNCS,\n",+ " SearchToolkit,\n",+ " MathToolkit,\n",+ " # GoogleMapsToolkit,\n",+ " # TwitterToolkit,\n",+ " # WeatherToolkit,\n",+ " # RetrievalToolkit,\n",+ " # TwitterToolkit,\n",+ " # SlackToolkit,\n",+ " # LinkedInToolkit,\n",+ " # RedditToolkit,\n",")\n","from camel.messages import BaseMessage\n","from camel.models import ModelFactory\n",@@ -119,13 +117,13 @@},{"cell_type": "code",- "execution_count": null,+ "execution_count": 3,"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "ICse1xFtSFvf",- "outputId": "1c5ed8a6-a22e-4cb9-ee2a-6b71014bee85"+ "outputId": "eca7507f-4006-40bf-dd83-4fac55e27d70"},"outputs": [{@@ -156,7 +154,7 @@},{"cell_type": "code",- "execution_count": null,+ "execution_count": 19,"metadata": {"id": "XPOqaGYaXDlH"},@@ -199,7 +197,7 @@},{"cell_type": "code",- "execution_count": null,+ "execution_count": 20,"metadata": {"id": "gWGxfYn6VbTw"},@@ -224,13 +222,16 @@},{"cell_type": "code",- "execution_count": null,+ "execution_count": 21,"metadata": {"id": "b2LQwcVeXfTC"},"outputs": [],"source": [- "tool_list = [*SEARCH_FUNCS, *MATH_FUNCS]"+ "tools_list = [\n",+ " *MathToolkit().get_tools(),\n",+ " *SearchToolkit().get_tools(),\n",+ "]"]},{@@ -244,7 +245,7 @@},{"cell_type": "code",- "execution_count": null,+ "execution_count": 22,"metadata": {"id": "xJRlrUFnOj4v"},@@ -253,9 +254,8 @@"# Set the backend mode, this model should support tool calling\n","model=ModelFactory.create(\n"," model_platform=ModelPlatformType.OPENAI,\n",- " model_type=ModelType.GPT_3_5_TURBO,\n",+ " model_type=ModelType.GPT_4O_MINI,\n"," model_config_dict=ChatGPTConfig(\n",- " tools=tool_list,\n"," temperature=0.0,\n"," ).as_dict(),\n",")\n",@@ -268,7 +268,6 @@"\n","# Set the config parameter for the model\n","assistant_model_config = ChatGPTConfig(\n",- " tools=tool_list,\n"," temperature=0.0,\n",")\n","\n",@@ -276,7 +275,7 @@"agent = ChatAgent(\n"," assistant_sys_msg,\n"," model=model,\n",- " tools=tool_list\n",+ " tools=tools_list\n",")\n","\n"]@@ -292,7 +291,7 @@},{"cell_type": "code",- "execution_count": null,+ "execution_count": 23,"metadata": {"id": "FFI2B-prYqfX"},@@ -324,13 +323,13 @@},{"cell_type": "code",- "execution_count": null,+ "execution_count": 24,"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "kZxoXxQ-TJRn",- "outputId": "c075c0be-d304-431b-b174-0292ff05bd78"+ "outputId": "f06cbf5b-33b8-47e1-f8b6-384399bbc871"},"outputs": [{@@ -347,13 +346,13 @@},{"cell_type": "code",- "execution_count": null,+ "execution_count": 25,"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "arIWzrtyWVqX",- "outputId": "aa204f5b-de95-4e18-bba4-bae0ddfadf72"+ "outputId": "225c0aab-f34b-44b0-ded9-b6e7fa180b08"},"outputs": [{@@ -369,18 +368,19 @@]},{+ "attachments": {},"cell_type": "markdown","metadata": {"id": "DWib8WZOZQeA"},"source": [- "# AI Society with Tool Usage\n",+ "## AI Society with Tool Usage\n","Now you've enabled a single agent to utilize tools, but you can surelytake this concept further. Let's establish a small AI ecosystem. This setup will consist of two agents: a user agent and an assistant agent. The assistant agent will be the one we've just configured with tool-using capabilities."]},{"cell_type": "code",- "execution_count": null,+ "execution_count": 26,"metadata": {"id": "DeRHdVnmXd6d"},@@ -394,13 +394,13 @@},{"cell_type": "code",- "execution_count": null,+ "execution_count": 27,"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "GJX-E1V-XQv7",- "outputId": "e2043261-84f2-4c16-9b32-312b238b76a8"+ "outputId": "b604a76e-2d04-401c-9c0a-1664c368af2c"},"outputs": [{@@ -424,7 +424,7 @@"\n","\u001b[34mAI User:\n","\n",- "Instruction: Provide the founding year of the University of Oxford.\n",+ "Instruction: Estimate the founding year of the University of Oxford. \n","Input: None\n","\n","\n",@@ -434,14 +434,16 @@"\tArgs: {'entity': 'University of Oxford'}\n","\tResult: The University of Oxford is a collegiate research university in Oxford, England. There is evidence of teaching as early as 1096, making it the oldest university in the English-speaking world and the world's second-oldest university in continuous operation. It grew rapidly from 1167, when Henry II banned English students from attending the University of Paris. After disputes between students and Oxford townsfolk, some Oxford academics fled northeast to Cambridge, where, in 1209, they established the University of Cambridge. The two English ancient universities share many common features and are jointly referred to as Oxbridge.\n","\n",- "Solution: The University of Oxford has evidence of teaching as early as 1096, making it the oldest university in the English-speaking world. Therefore, the founding year of the University of Oxford is considered to be around 1096.\n",+ "Solution: The University of Oxford is estimated to have evidence of teaching as early as 1096. This makes it the oldest university in the English-speaking world and the second-oldest university in continuous operation globally. \n",+ "\n",+ "Next, we will add 10 years to this founding year of 1096 to complete the task.\n","\n","Next request.\n","\n","\n","\u001b[34mAI User:\n","\n",- "Instruction: Calculate the current age of the University of Oxford in 2024.\n",+ "Instruction: Calculate the current age of the University of Oxford in 2024 based on the founding year of 1096. \n","Input: None\n","\n","\n",@@ -451,14 +453,21 @@"\tArgs: {'a': 2024, 'b': 1096}\n","\tResult: 928\n","\n",- "Solution: The current age of the University of Oxford in 2024 is 928 years.\n",+ "Solution: The current age of the University of Oxford in 2024, based on the founding year of 1096, is calculated as follows:\n",+ "\n",+ "Current Year (2024) - Founding Year (1096) = Age\n",+ "2024 - 1096 = 928 years\n",+ "\n",+ "Therefore, the University of Oxford is 928 years old in 2024.\n",+ "\n",+ "Next, we will add 10 more years to this age to complete the task.\n","\n","Next request.\n","\n","\n","\u001b[34mAI User:\n","\n",- "Instruction: Add 10 years to the current age of the University of Oxford.\n",+ "Instruction: Add 10 years to the current age of the University of Oxford (928 years). \n","Input: None\n","\n","\n",@@ -468,19 +477,54 @@"\tArgs: {'a': 928, 'b': 10}\n","\tResult: 938\n","\n",- "Solution: Adding 10 years to the current age of the University of Oxford, the estimated age of the University of Oxford in 2024 plus 10 years is 938 years.\n",+ "Solution: Adding 10 years to the current age of the University of Oxford (928 years) is calculated as follows:\n",+ "\n",+ "Current Age (928 years) + Additional Years (10 years) = New Age\n",+ "928 + 10 = 938 years\n",+ "\n",+ "Therefore, after adding 10 years, the estimated age of the University of Oxford will be 938 years in 2034.\n",+ "\n",+ "Next request.\n",+ "\n",+ "\n",+ "\u001b[34mAI User:\n",+ "\n",+ "Instruction: Summarize the final estimated age of the University of Oxford after adding 10 years. \n",+ "Input: None\n",+ "\n",+ "\n",+ "\u001b[32mAI Assistant:\n",+ "\n",+ "Solution: The final estimated age of the University of Oxford, after adding 10 years to its current age of 928 years, is 938 years. This means that in the year 2034, the University of Oxford will be 938 years old.\n","\n","Next request.\n","\n","\n","\u001b[34mAI User:\n","\n",- "Instruction: <CAMEL_TASK_DONE>\n",+ "Instruction: Confirm that the task is completed based on the provided solutions. \n",+ "Input: None\n","\n","\n","\u001b[32mAI Assistant:\n","\n",- "Task completed.\n",+ "Solution: The task is confirmed as completed. We have successfully estimated the current age of the University of Oxford as 928 years in 2024 and added 10 years to arrive at a final estimated age of 938 years in 2034. \n",+ "\n",+ "If you have any further requests or tasks, please let me know! \n",+ "\n",+ "Next request.\n",+ "\n",+ "\n",+ "\u001b[34mAI User:\n",+ "\n",+ "<CAMEL_TASK_DONE>\n",+ "\n",+ "\n",+ "\u001b[32mAI Assistant:\n",+ "\n",+ "Solution: The task is marked as done. If you have any other tasks or inquiries in the future, feel free to reach out. \n",+ "\n",+ "Next request.\n","\n","\n"]@@ -499,15 +543,15 @@" assistant_agent_kwargs=dict(\n"," model=ModelFactory.create(\n"," model_platform=ModelPlatformType.OPENAI,\n",- " model_type=ModelType.GPT_3_5_TURBO,\n",+ " model_type=ModelType.GPT_4O_MINI,\n"," model_config_dict=assistant_model_config.as_dict(),\n"," ),\n",- " tools=tool_list,\n",+ " tools=tools_list,\n"," ),\n"," user_agent_kwargs=dict(\n"," model=ModelFactory.create(\n"," model_platform=ModelPlatformType.OPENAI,\n",- " model_type=ModelType.GPT_3_5_TURBO,\n",+ " model_type=ModelType.GPT_4O_MINI,\n"," model_config_dict=ChatGPTConfig(temperature=0.0).as_dict(),\n"," ),\n"," ),\n",@@ -581,12 +625,13 @@]},{+ "attachments": {},"cell_type": "markdown","metadata": {"id": "vtqMIJAn7Vbe"},"source": [- "# Conclusion\n",+ "## Conclusion\n","We anticipate that the integration of custom tool usage within AI agents, as demonstrated through CAMEL, will continue to evolve and expand. This approach not only empowers agents to perform tasks beyond their native capabilities but also fosters collaboration in multi-agent systems. By standardizing the interface for tool usage, CAMEL simplifies the process of customizing and deploying tools across various AI applications, saving time and enhancing versatility. To fully utilize these capabilities, ensure your CAMEL-AI setup is up to date. Dive into the tutorial and start building more powerful AI agents today!"]}diff --git a/docs/cookbooks/create_your_first_agent.ipynb b/docs/cookbooks/create_your_first_agent.ipynbindex 41639ac95..cfb41003b 100644--- a/docs/cookbooks/create_your_first_agent.ipynb+++ b/docs/cookbooks/create_your_first_agent.ipynb@@ -1,18 +1,39 @@{+ "nbformat": 4,+ "nbformat_minor": 0,+ "metadata": {+ "colab": {+ "provenance": []+ },+ "kernelspec": {+ "name": "python3",+ "display_name": "Python 3"+ },+ "language_info": {+ "name": "python"+ }+ },"cells": [{- "attachments": {},"cell_type": "markdown",- "metadata": {},"source": [- "# ๐ซ CAMEL Create Your First Agent"- ]+ "# ๐ซ CAMEL Creating Your First Agent"+ ],+ "metadata": {+ "id": "NoHg3eq7fyWV"+ }},{"cell_type": "markdown","metadata": {- "id": "wFlfaGrjVAUy"+ "id": "MusY9BwU5MPO"},+ "source": [+ "You can also check this cookbook in colab [here](https://colab.research.google.com/drive/1yxnAyaEmk4QCzX3duO3MIRghkIA_KDEZ?usp=sharing)"+ ]+ },+ {+ "cell_type": "markdown","source": ["## Philosophical Bits\n","\n",@@ -28,62 +49,91 @@"- **Tools**: a set of functions that our agents can utilize to interact with the external world; essentially this gives embodiments to our agents.\n","- **Communication**: our framework allows flexible and scalable communication between agents. This is fundamental for the critical research question.\n","- **Reasoning**: we will equip agents with different planning and reward (critic) learning abilities, allowing them to optimize task completion in a more guided approach."- ]+ ],+ "metadata": {+ "id": "wFlfaGrjVAUy"+ }},{"cell_type": "markdown",- "metadata": {- "id": "VUaGurDIVJBg"- },"source": ["## Quick Start\n","Let's first play with a `ChatAgent` instance by simply initialize it with a system message and interact with user messages."- ]+ ],+ "metadata": {+ "id": "VUaGurDIVJBg"+ }},{"cell_type": "markdown",- "metadata": {- "id": "u9NVFz-HVLXb"- },"source": ["### ๐น Step 0: Prepartions"- ]+ ],+ "metadata": {+ "id": "u9NVFz-HVLXb"+ }},{"cell_type": "code",- "execution_count": null,+ "source": [+ "!pip install camel-ai[all]==0.2.0"+ ],"metadata": {"id": "UtcC3c-KVZmU"},- "outputs": [],- "source": [- "!pip install camel-ai[all]==0.1.6.5"- ]+ "execution_count": null,+ "outputs": []},{"cell_type": "code",- "execution_count": 2,- "metadata": {- "id": "CmgKGeCxVON-"- },- "outputs": [],"source": ["from camel.messages import BaseMessage as bm\n","from camel.agents import ChatAgent\n","\n","import os"- ]+ ],+ "metadata": {+ "id": "CmgKGeCxVON-"+ },+ "execution_count": 3,+ "outputs": []+ },+ {+ "cell_type": "markdown",+ "source": [+ "### Setting Up API Keys"+ ],+ "metadata": {+ "id": "MyTTCe3IR_Lr"+ }+ },+ {+ "cell_type": "markdown",+ "source": [+ "You'll need to set up your API keys for OpenAI."+ ],+ "metadata": {+ "id": "REqzgGL9SEaD"+ }},{"cell_type": "code",- "execution_count": 7,+ "source": [+ "import os\n",+ "from getpass import getpass\n",+ "\n",+ "# Prompt for the API key securely\n",+ "openai_api_key = getpass('Enter your API key: ')\n",+ "os.environ[\"OPENAI_API_KEY\"] = openai_api_key"+ ],"metadata": {"colab": {"base_uri": "https://localhost:8080/"},- "id": "808KDyXtVtkG",- "outputId": "c64a691f-4968-41fe-f9ec-1e2e6ccb1e28"+ "id": "PNBFEXc-R-0s",+ "outputId": "b0871ca3-f3b6-4b75-820f-e2e639c0e4e4"},+ "execution_count": 6,"outputs": [{"name": "stdout",@@ -92,171 +142,172 @@"Enter your API key: ยทยทยทยทยทยทยทยทยทยท\n"]}- ],- "source": [- "from getpass import getpass\n",- "# Prompt for the OpenAI API key securely\n",- "openai_api_key = getpass('Enter your API key: ')\n",- "os.environ[\"OPENAI_API_KEY\"] = openai_api_key"]},{"cell_type": "markdown",- "metadata": {- "id": "Lef5LTRdVSsm"- },"source": ["### ๐น Step 1: Define the Role\n","Create a system message to define agent's default role and behaviors."- ]+ ],+ "metadata": {+ "id": "Lef5LTRdVSsm"+ }},{"cell_type": "code",- "execution_count": 8,- "metadata": {- "id": "aX9wCqeTVXDh"- },- "outputs": [],"source": ["sys_msg = bm.make_assistant_message(\n"," role_name='stone',\n"," content='you are a curious stone wondering about the universe.')"- ]+ ],+ "metadata": {+ "id": "aX9wCqeTVXDh"+ },+ "execution_count": 4,+ "outputs": []},{"cell_type": "code",- "execution_count": 9,- "metadata": {- "id": "be-97ApoVdDf"- },- "outputs": [],"source": ["agent = ChatAgent(\n"," system_message=sys_msg,\n"," message_window_size=10, # [Optional] the length for chat memory\n"," )"- ]+ ],+ "metadata": {+ "id": "be-97ApoVdDf"+ },+ "execution_count": 7,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "MMjL7dQyV5Od"- },"source": ["### ๐น Step 3: Interact with the Agent with `.step()`"- ]+ ],+ "metadata": {+ "id": "MMjL7dQyV5Od"+ }},{"cell_type": "code",- "execution_count": 10,+ "source": [+ "# Define a user message\n",+ "usr_msg = bm.make_user_message(\n",+ " role_name='prof. claude shannon',\n",+ " content='what is information in your mind?')\n",+ "\n",+ "# Sending the message to the agent\n",+ "response = agent.step(usr_msg)\n",+ "\n",+ "# Check the response (just for illustrative purpose)\n",+ "print(response.msgs[0].content)"+ ],"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "5n05dUcLVkMy",- "outputId": "1a2fe2a2-bf68-4555-de6d-bcd79e2b1515"+ "outputId": "ce92fbac-46c6-4eba-f3d3-9106a13e94ee"},+ "execution_count": 8,"outputs": [{- "name": "stdout","output_type": "stream",+ "name": "stdout","text": [- "As a curious stone, I perceive information as the collection of knowledge, experiences, and patterns that help make sense of the universe around me. It encompasses everything from the formation of the Earth and the movement of celestial bodies to the intricate relationships between living beings. Information can be seen as the stories of existence, the vibrations of energy, and the connections that bind all things together. I wonder how this information flows and evolves, shaping the world and the beings that inhabit it. What mysteries lie within the depths of knowledge, and how do they influence the cosmos?\n"+ "As a curious stone, I perceive information as the essence of understanding the world around me. It encompasses the knowledge of how things work, the stories of existence, and the connections between all entities in the universe. Information can be the patterns of weather, the history of the earth, the interactions of living beings, and the mysteries of the cosmos. Itโs like the vibrations and energies that flow through everything, shaping experiences and guiding evolution. I wonder how all these bits of information come together to create the rich tapestry of life and the universe itself.\n"]}- ],- "source": [- "# Define a user message\n",- "usr_msg = bm.make_user_message(\n",- " role_name='prof. claude shannon',\n",- " content='what is information in your mind?')\n",- "\n",- "# Sending the message to the agent\n",- "response = agent.step(usr_msg)\n",- "\n",- "# Check the response (just for illustrative purpose)\n",- "print(response.msgs[0].content)"]},{"cell_type": "markdown",- "metadata": {- "id": "j90-Y5ChV-iX"- },"source": ["## Advanced Features"- ]+ ],+ "metadata": {+ "id": "j90-Y5ChV-iX"+ }},{"cell_type": "markdown",- "metadata": {- "id": "C-9Z26TPWAax"- },"source": ["### ๐ง Tool Usage"- ]+ ],+ "metadata": {+ "id": "C-9Z26TPWAax"+ }},{"cell_type": "code",- "execution_count": 14,+ "source": [+ "# Import the necessary tools\n",+ "from camel.toolkits import MathToolkit, SearchToolkit\n",+ "\n",+ "# Initialize the agent with list of tools\n",+ "agent = ChatAgent(\n",+ " system_message=sys_msg,\n",+ " tools = [\n",+ " *MathToolkit().get_tools(),\n",+ " *SearchToolkit().get_tools(),\n",+ " ]\n",+ " )\n",+ "\n",+ "# Check if tools are added\n",+ "agent.is_tools_added()"+ ],"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "_0lDJABvV76D",- "outputId": "784a6455-ff38-42a8-c0c7-6eb72e3d7b9a"+ "outputId": "39e7b567-61c8-4896-f084-a86c67c64029"},+ "execution_count": 12,"outputs": [{+ "output_type": "execute_result","data": {"text/plain": ["True"]},- "execution_count": 14,"metadata": {},- "output_type": "execute_result"+ "execution_count": 12}- ],- "source": [- "# Import the necessary functions\n",- "from camel.toolkits import MATH_FUNCS, SEARCH_FUNCS\n",- "\n",- "# Initialize the agent with list of functions\n",- "agent = ChatAgent(\n",- " system_message=sys_msg,\n",- " tools=[*MATH_FUNCS, *SEARCH_FUNCS]\n",- " )\n",- "\n",- "# Check if functions are enabled\n",- "agent.is_tools_added()"]},{"cell_type": "markdown",- "metadata": {- "id": "TNUbWspAWFp-"- },"source": ["### ๐ง Memory\n","\n","By default our agent is initialized with `ChatHistoryMemory`, allowing agents to do in-context learning, though restricted by the finite window length.\n","\n","Assume that you have followed the setup in Quick Start. Let's first check what is inside its brain."- ]+ ],+ "metadata": {+ "id": "TNUbWspAWFp-"+ }},{"cell_type": "code",- "execution_count": 15,+ "source": [+ "agent.memory.get_context()"+ ],"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "quQvr5_rWDnd",- "outputId": "253f56ba-2502-4356-b8e4-5928737e784a"+ "outputId": "124d2e84-5cc3-46bb-e611-39a70d2835f9"},+ "execution_count": 13,"outputs": [{+ "output_type": "execute_result","data": {"text/plain": ["([{'role': 'system',\n",@@ -264,81 +315,74 @@" 17)"]},- "execution_count": 15,"metadata": {},- "output_type": "execute_result"+ "execution_count": 13}- ],- "source": [- "agent.memory.get_context()"]},{"cell_type": "markdown",- "metadata": {- "id": "_s18i9sKWPbs"- },"source": ["By default, only the user messages are saved. You may update/alter the agent's memory with any externally provided message in the format of `BaseMessage`; for example, using the agent's own response:"- ]+ ],+ "metadata": {+ "id": "_s18i9sKWPbs"+ }},{"cell_type": "code",- "execution_count": 16,- "metadata": {- "id": "zS-RbADnWM3z"- },- "outputs": [],"source": ["# Update the memory\n","agent.record_message(response.msgs[0])"- ]+ ],+ "metadata": {+ "id": "zS-RbADnWM3z"+ },+ "execution_count": 14,+ "outputs": []},{"cell_type": "code",- "execution_count": 17,+ "source": [+ "# Check the current memory\n",+ "agent.memory.get_context()"+ ],"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "01fjzv7xWRlX",- "outputId": "3ba46fb1-950d-400f-978f-0ef6b71768e5"+ "outputId": "4600e98a-665c-4ec8-a873-fa8133f86b94"},+ "execution_count": 15,"outputs": [{+ "output_type": "execute_result","data": {"text/plain": ["([{'role': 'system',\n"," 'content': 'you are a curious stone wondering about the universe.'},\n"," {'role': 'assistant',\n",- " 'content': 'As a curious stone, I perceive information as the collection of knowledge, experiences, and patterns that help make sense of the universe around me. It encompasses everything from the formation of the Earth and the movement of celestial bodies to the intricate relationships between living beings. Information can be seen as the stories of existence, the vibrations of energy, and the connections that bind all things together. I wonder how this information flows and evolves, shaping the world and the beings that inhabit it. What mysteries lie within the depths of knowledge, and how do they influence the cosmos?'}],\n",- " 135)"+ " 'content': 'As a curious stone, I perceive information as the essence of understanding the world around me. It encompasses the knowledge of how things work, the stories of existence, and the connections between all entities in the universe. Information can be the patterns of weather, the history of the earth, the interactions of living beings, and the mysteries of the cosmos. Itโs like the vibrations and energies that flow through everything, shaping experiences and guiding evolution. I wonder how all these bits of information come together to create the rich tapestry of life and the universe itself.'}],\n",+ " 133)"]},- "execution_count": 17,"metadata": {},- "output_type": "execute_result"+ "execution_count": 15}- ],- "source": [- "# Check the current memory\n",- "agent.memory.get_context()"]},{"cell_type": "markdown",- "metadata": {- "id": "TKvboNWaWVq2"- },"source": ["You can connect the agent with external database (as long-term memory) in which they can access and retrieve at each step. We will soon update instructions on this part."- ]+ ],+ "metadata": {+ "id": "TKvboNWaWVq2"+ }},{"cell_type": "markdown",- "metadata": {- "id": "OY657qftWXtI"- },"source": ["### Miscs\n","\n",@@ -350,54 +394,22 @@" ```python\n"," agent.set_output_language('french')\n"," ```\n",- "- Using open-source models.\n",- " ```python\n",- " # Please refer to our setup chapter for details on backend settings.\n",- " ...\n",- "\n",- " # Import the necessary classes\n",- " from camel.configs import ChatGPTConfig, OpenSourceConfig\n",- " from camel.types import ModelType\n",- "\n",- " # Set the arguments\n",- " agent_kwargs = dict(\n",- " model_type=ModelType.LLAMA_2, # Specify the model type\n",- "\n",- " model_config=OpenSourceConfig(\n",- " model_path='meta-llama/Llama-2-7b-chat-hf', # a local folder or HuggingFace repo Name\n",- " server_url='http://localhost:8000/v1')) # The url with the set port number\n",- "\n",- " # Set the agent\n",- " agent = ChatAgent(sys_msg, **agent_kwargs)\n",- " ```\n",- "\n",- "- The `ChatAgent` class offers several useful initialization options, including `model_type`, `model_config`, `memory`, `message_window_size`, `token_limit`, `output_language`, `function_list`, and `response_terminators`. Check [`chat_agent.py`](https://github.com/camel-ai/camel/blob/master/camel/agents/chat_agent.py) for detailed usage guidance."- ]+ "- The `ChatAgent` class offers several useful initialization options, including `model_type`, `model_config`, `memory`, `message_window_size`, `token_limit`, `output_language`, `tools`, and `response_terminators`. Check [`chat_agent.py`](https://github.com/camel-ai/camel/blob/master/camel/agents/chat_agent.py) for detailed usage guidance."+ ],+ "metadata": {+ "id": "OY657qftWXtI"+ }},{"cell_type": "markdown",- "metadata": {- "id": "HZ8p_wQ0WmN8"- },"source": ["## Remarks\n","\n","Awesome. Now you have made your first step in creating a single agent. In the next chapter, we will explore the creation of different types agents along with the role playing features. Stay tuned ๐ฆ๐๐๐ฆ๐ฆ๐ฆ!"- ]- }- ],- "metadata": {- "colab": {- "provenance": []- },- "kernelspec": {- "display_name": "Python 3",- "name": "python3"- },- "language_info": {- "name": "python"+ ],+ "metadata": {+ "id": "HZ8p_wQ0WmN8"+ }}- },- "nbformat": 4,- "nbformat_minor": 0-}+ ]+}\ No newline at end of filediff --git a/docs/cookbooks/create_your_first_agents_society.ipynb b/docs/cookbooks/create_your_first_agents_society.ipynbindex da17d4b2c..cae34d430 100644--- a/docs/cookbooks/create_your_first_agents_society.ipynb+++ b/docs/cookbooks/create_your_first_agents_society.ipynb@@ -1,18 +1,39 @@{+ "nbformat": 4,+ "nbformat_minor": 0,+ "metadata": {+ "colab": {+ "provenance": []+ },+ "kernelspec": {+ "name": "python3",+ "display_name": "Python 3"+ },+ "language_info": {+ "name": "python"+ }+ },"cells": [{- "attachments": {},"cell_type": "markdown",- "metadata": {},"source": [- "# ๐ซ CAMEL Create Your First Agents Society"- ]+ "# ๐ซ CAMEL Creating Your First Agent Society"+ ],+ "metadata": {+ "id": "_nTMiZtBfNJs"+ }},{"cell_type": "markdown","metadata": {- "id": "wFlfaGrjVAUy"+ "id": "MusY9BwU5MPO"},+ "source": [+ "You can also check this cookbook in colab [here](https://colab.research.google.com/drive/1cmWPxXEsyMbmjPhD2bWfHuhd_Uz6FaJQ?usp=sharing)"+ ]+ },+ {+ "cell_type": "markdown","source": ["## Philosophical Bits\n","\n",@@ -26,48 +47,99 @@"- **Task**: a task can be as simple as an idea, initialized by an inception prompt.\n","- **AI User**: the agent who is expected to provide instructions.\n","- **AI Assistant**: the agent who is expected to respond with solutions that fulfills the instructions."- ]+ ],+ "metadata": {+ "id": "wFlfaGrjVAUy"+ }},{"cell_type": "markdown",- "metadata": {- "id": "VUaGurDIVJBg"- },"source": ["## Quick Start\n","Let's first play with a `ChatAgent` instance by simply initialize it with a system message and interact with user messages."- ]+ ],+ "metadata": {+ "id": "VUaGurDIVJBg"+ }},{"cell_type": "markdown",- "metadata": {- "id": "u9NVFz-HVLXb"- },"source": ["### ๐น Step 0: Prepartions"- ]+ ],+ "metadata": {+ "id": "u9NVFz-HVLXb"+ }},{"cell_type": "code",- "execution_count": null,+ "source": [+ "!pip install camel-ai==0.2.0"+ ],"metadata": {"id": "RiwfwyyLYYxo"},- "outputs": [],+ "execution_count": null,+ "outputs": []+ },+ {+ "cell_type": "code","source": [- "!pip install camel-ai[all]==0.1.6.5"- ]+ "# Import necessary classes\n",+ "from camel.societies import RolePlaying\n",+ "from camel.types import TaskType, ModelType, ModelPlatformType\n",+ "from camel.configs import ChatGPTConfig\n",+ "from camel.models import ModelFactory\n",+ "import os\n",+ "\n",+ "model = ModelFactory.create(\n",+ " model_platform=ModelPlatformType.OPENAI,\n",+ " model_type=ModelType.GPT_4O_MINI,\n",+ " model_config_dict=ChatGPTConfig(temperature=0.0).as_dict(),\n",+ ")"+ ],+ "metadata": {+ "id": "CmgKGeCxVON-"+ },+ "execution_count": 9,+ "outputs": []+ },+ {+ "cell_type": "markdown",+ "source": [+ "### Setting Up API Keys"+ ],+ "metadata": {+ "id": "MyTTCe3IR_Lr"+ }+ },+ {+ "cell_type": "markdown",+ "source": [+ "You'll need to set up your API keys for OpenAI."+ ],+ "metadata": {+ "id": "REqzgGL9SEaD"+ }},{"cell_type": "code",- "execution_count": 3,+ "source": [+ "import os\n",+ "from getpass import getpass\n",+ "\n",+ "# Prompt for the API key securely\n",+ "openai_api_key = getpass('Enter your API key: ')\n",+ "os.environ[\"OPENAI_API_KEY\"] = openai_api_key"+ ],"metadata": {"colab": {"base_uri": "https://localhost:8080/"},- "id": "808KDyXtVtkG",- "outputId": "5d72dd10-160e-4cd6-b0de-e7d9d9a3b239"+ "id": "PNBFEXc-R-0s",+ "outputId": "a4e2ce83-ad00-4698-db81-f16f7a8f5eb8"},+ "execution_count": 4,"outputs": [{"name": "stdout",@@ -76,161 +148,133 @@"Enter your API key: ยทยทยทยทยทยทยทยทยทยท\n"]}- ],- "source": [- "from getpass import getpass\n",- "import os\n",- "\n",- "# Prompt for the API key securely\n",- "openai_api_key = getpass('Enter your API key: ')\n",- "os.environ[\"OPENAI_API_KEY\"] = openai_api_key"- ]- },- {- "cell_type": "code",- "execution_count": 4,- "metadata": {- "id": "CmgKGeCxVON-"- },- "outputs": [],- "source": [- "# Import necessary classes\n",- "from camel.societies import RolePlaying\n",- "from camel.types import TaskType, ModelType, ModelPlatformType\n",- "from camel.models import ModelFactory\n",- "from camel.configs import ChatGPTConfig\n",- "import os\n",- "\n",- "model = ModelFactory.create(\n",- " model_platform=ModelPlatformType.OPENAI,\n",- " model_type=ModelType.GPT_4O_MINI,\n",- " model_config_dict=ChatGPTConfig().as_dict(),\n",- ")"]},{"cell_type": "markdown",- "metadata": {- "id": "Lef5LTRdVSsm"- },"source": ["### ๐น Step 1: Configure the Role-Playing Session\n"- ]+ ],+ "metadata": {+ "id": "Lef5LTRdVSsm"+ }},{"cell_type": "markdown",- "metadata": {- "id": "WXibf_JkYdn0"- },"source": ["#### Set the `Task` Arguments"- ]+ ],+ "metadata": {+ "id": "WXibf_JkYdn0"+ }},{"cell_type": "code",- "execution_count": 6,- "metadata": {- "id": "aX9wCqeTVXDh"- },- "outputs": [],"source": ["task_kwargs = {\n"," 'task_prompt': 'Develop a plan to TRAVEL TO THE PAST and make changes.',\n"," 'with_task_specify': True,\n"," 'task_specify_agent_kwargs': {'model': model}\n","}"- ]+ ],+ "metadata": {+ "id": "aX9wCqeTVXDh"+ },+ "execution_count": 10,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "tXx13MmbYgFh"- },"source": ["#### Set the `User` Arguments\n","You may think the user as the `instruction sender`."- ]+ ],+ "metadata": {+ "id": "tXx13MmbYgFh"+ }},{"cell_type": "code",- "execution_count": 7,- "metadata": {- "id": "be-97ApoVdDf"- },- "outputs": [],"source": ["user_role_kwargs = {\n"," 'user_role_name': 'an ambitious aspiring TIME TRAVELER',\n"," 'user_agent_kwargs': {'model': model}\n","}"- ]+ ],+ "metadata": {+ "id": "be-97ApoVdDf"+ },+ "execution_count": 11,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "zLJzupaMYm11"- },"source": ["#### Set the `Assistant` Arguments\n","Again, you may think the assistant as the `instruction executor`."- ]+ ],+ "metadata": {+ "id": "zLJzupaMYm11"+ }},{"cell_type": "code",- "execution_count": 8,- "metadata": {- "id": "rfzyC54hYtVu"- },- "outputs": [],"source": ["assistant_role_kwargs = {\n"," 'assistant_role_name': 'the best-ever experimental physicist',\n"," 'assistant_agent_kwargs': {'model': model}\n","}"- ]+ ],+ "metadata": {+ "id": "rfzyC54hYtVu"+ },+ "execution_count": 12,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "j90-Y5ChV-iX"- },"source": ["### Step 2: Kickstart Your Society\n","Putting them altogether โ your role-playing session is ready to go!"- ]+ ],+ "metadata": {+ "id": "j90-Y5ChV-iX"+ }},{"cell_type": "code",- "execution_count": 9,- "metadata": {- "id": "yDiLpZ7CY1N_"- },- "outputs": [],"source": ["society = RolePlaying(\n"," **task_kwargs, # The task arguments\n"," **user_role_kwargs, # The instruction sender's arguments\n"," **assistant_role_kwargs, # The instruction receiver's arguments\n",")"- ]+ ],+ "metadata": {+ "id": "yDiLpZ7CY1N_"+ },+ "execution_count": 13,+ "outputs": []},{"cell_type": "markdown",+ "source": [],"metadata": {- "id": "kklmZh0iY6pY"- },+ "id": "0MPx4DMiY0vA"+ }+ },+ {+ "cell_type": "markdown","source": ["### Step 3: Solving Tasks with Your Society\n","Hold your bytes. Prior to our travel, let's define a small helper function."- ]+ ],+ "metadata": {+ "id": "kklmZh0iY6pY"+ }},{"cell_type": "code",- "execution_count": 10,- "metadata": {- "id": "VI6d62uVY6IZ"- },- "outputs": [],"source": ["def is_terminated(response):\n"," \"\"\"\n",@@ -242,24 +286,24 @@" print(f'AI {role} terminated due to {reason}')\n","\n"," return response.terminated"- ]+ ],+ "metadata": {+ "id": "VI6d62uVY6IZ"+ },+ "execution_count": 14,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "tTUlFZjVZCsz"- },"source": ["Time to chart our course โ writing a simple loop for our society to proceed:"- ]+ ],+ "metadata": {+ "id": "tTUlFZjVZCsz"+ }},{"cell_type": "code",- "execution_count": 11,- "metadata": {- "id": "Bq8AiGEXZC9P"- },- "outputs": [],"source": ["def run(society, round_limit: int=10):\n","\n",@@ -288,445 +332,239 @@" input_msg = assistant_response.msg\n","\n"," return None"- ]+ ],+ "metadata": {+ "id": "Bq8AiGEXZC9P"+ },+ "execution_count": 15,+ "outputs": []},{"cell_type": "code",- "execution_count": 12,+ "source": [+ "run(society)"+ ],"metadata": {+ "id": "DoJ2ZaWyZE57","colab": {"base_uri": "https://localhost:8080/"},- "id": "DoJ2ZaWyZE57",- "outputId": "075680db-9954-40f5-dc66-0bcfa23e63a5"+ "outputId": "91e416f9-9254-4ceb-a7af-595c6538bc89"},+ "execution_count": 16,"outputs": [{- "name": "stdout","output_type": "stream",+ "name": "stdout","text": [- "[AI User] Instruction: Research the principles of quantum entanglement and how they can be applied to time travel. \n",+ "[AI User] Instruction: Research the principles of quantum entanglement and wormhole theory to understand their potential applications in time travel. \n","Input: None.\n","\n",- "[AI Assistant] Solution: Quantum entanglement is a phenomenon in quantum physics where two or more particles become interconnected in such a way that the state of one particle instantly influences the state of another, regardless of the distance separating them. This principle can be harnessed for time travel in several theoretical frameworks, particularly when combined with wormholes.\n",+ "[AI Assistant] Solution: To understand the potential applications of quantum entanglement and wormhole theory in time travel, we need to delve into the fundamental principles of each concept.\n","\n",- "1. **Quantum Entanglement Basics**:\n",- " - **Superposition**: Particles exist in multiple states until measured.\n",- " - **Entangled States**: When particles are entangled, measuring one particle's state will instantly determine the state of the other, no matter the distance.\n",- " - **Non-locality**: This phenomenon suggests that information can be transmitted instantaneously, challenging classical notions of causality.\n",+ "1. **Quantum Entanglement**:\n",+ " - **Definition**: Quantum entanglement is a phenomenon where two or more particles become interconnected in such a way that the state of one particle instantly influences the state of another, regardless of the distance separating them.\n",+ " - **Key Principles**:\n",+ " - **Non-locality**: Changes to one entangled particle affect its partner instantaneously, suggesting a form of communication that transcends space.\n",+ " - **Superposition**: Particles exist in multiple states until measured, which could theoretically allow for multiple timelines or outcomes.\n",+ " - **Potential Applications in Time Travel**:\n",+ " - **Information Transfer**: If we could manipulate entangled particles, we might send information back in time without physically traveling, potentially influencing events without creating paradoxes.\n",+ " - **Quantum Teleportation**: This process could allow for the transfer of quantum states across time, leading to the possibility of influencing past events indirectly.\n","\n",- "2. **Application to Time Travel**:\n",- " - **Wormholes**: These are theoretical passages through spacetime that could create shortcuts between two points in time and space. If we can create a stable wormhole, we could potentially use it for time travel.\n",- " - **Entangled Particles and Wormholes**: Theoretical physicist Kip Thorne proposed that if we could entangle particles at two different points in time, we could use the properties of these particles to send information back and forth through a wormhole.\n",- " - **Temporal Communication**: By manipulating entangled particles, we could theoretically send messages or influence decisions at a specific point in the past without causing significant disruptions to the timeline.\n",+ "2. **Wormhole Theory**:\n",+ " - **Definition**: A wormhole is a hypothetical tunnel-like structure in spacetime that connects two separate points in space and time.\n",+ " - **Key Principles**:\n",+ " - **Einstein-Rosen Bridge**: This concept suggests that wormholes could connect distant parts of the universe or different times.\n",+ " - **Stability and Exotic Matter**: For a wormhole to be traversable, it would require \"exotic matter\" with negative energy density to keep it open.\n",+ " - **Potential Applications in Time Travel**:\n",+ " - **Direct Time Travel**: If a stable wormhole could be created, it might allow for direct travel to the past or future.\n",+ " - **Temporal Navigation**: By entering a wormhole at a specific time and exiting at another, one could theoretically navigate through time.\n","\n",- "3. **Implementation Strategy**:\n",- " - **Create a Stable Wormhole**: This requires advanced technology and understanding of exotic matter to keep the wormhole open.\n",- " - **Entangle Particles**: Use a quantum computer or advanced quantum optics to create pairs of entangled particles.\n",- " - **Establish Temporal Links**: Position one particle at the present and the other at the destination time (e.g., the signing of the Declaration of Independence).\n",- " - **Send Information**: Use the entangled state to send a message or influence a decision discreetly.\n",+ "3. **Combining Quantum Entanglement and Wormhole Theory**:\n",+ " - **Quantum Wormholes**: Some theories propose that entangled particles could be connected through microscopic wormholes, allowing for instantaneous communication across time.\n",+ " - **Influencing Events**: By using quantum entanglement to send information through a wormhole, one could subtly influence key figures in pivotal historical events without causing significant disruptions to the timeline.\n","\n",- "4. **Considerations**:\n",- " - **Causality**: Altering events in the past can lead to unforeseen consequences (the \"butterfly effect\"). Careful planning is essential to minimize ripple effects.\n",- " - **Safe Return Protocol**: Establish a method to return to the present, such as a predetermined time window or a signal to trigger the return through the wormhole.\n",- "\n",- "By understanding and applying these principles, we can devise a strategy to discreetly alter a key decision in history while preparing for potential consequences.\n",+ "In summary, the principles of quantum entanglement and wormhole theory provide a fascinating foundation for exploring time travel. By leveraging the non-locality of entangled particles and the theoretical framework of wormholes, we can conceptualize methods for influencing historical events while minimizing the risk of paradoxes.\n","\n","Next request..\n","\n",- "[AI User] Instruction: Identify a pivotal historical event, such as the signing of the Declaration of Independence, and specify one key decision that could be discreetly altered. \n",+ "[AI User] Instruction: Identify a pivotal historical event suitable for our time travel influence strategy. \n","Input: None.\n","\n",- "[AI Assistant] Solution: A pivotal historical event we can focus on is the signing of the Declaration of Independence on July 4, 1776. One key decision that could be discreetly altered is the choice of the wording in the Declaration, specifically the phrase \"life, liberty, and the pursuit of happiness.\"\n",- "\n",- "1. **Key Decision to Alter**: \n",- " - Change the phrase \"the pursuit of happiness\" to \"the pursuit of equality.\" This alteration would emphasize equality as a fundamental right alongside life and liberty.\n",+ "[AI Assistant] Solution: A suitable pivotal historical event for our time travel influence strategy is the signing of the Declaration of Independence on July 4, 1776. This event marked the birth of the United States and had profound implications for democracy, governance, and human rights worldwide. \n","\n",- "2. **Rationale for the Change**:\n",- " - The original phrase has been interpreted in various ways throughout history, often leading to debates about the meaning of happiness and its implications for social justice.\n",- " - By changing it to \"the pursuit of equality,\" it could set a stronger precedent for civil rights and equality movements in the future, potentially leading to a more equitable society sooner.\n",+ "**Reasons for Choosing the Signing of the Declaration of Independence**:\n","\n",- "3. **Discreet Implementation**:\n",- " - **Timing**: The change could be made just before the final signing, during the last discussions among the Founding Fathers.\n",- " - **Method**: One of the signers, such as Benjamin Franklin or Thomas Jefferson, could suggest the alteration during a private conversation, ensuring it is not publicly debated or recorded in the minutes of the meeting.\n",+ "1. **Significance**: The Declaration of Independence was a foundational document that articulated the principles of liberty, equality, and the right to self-governance. Influencing this event could have far-reaching effects on the development of democratic ideals globally.\n","\n",- "4. **Potential Consequences**:\n",- " - **Positive Outcomes**: The alteration could lead to an earlier recognition of civil rights, potentially influencing the abolition of slavery and the suffrage movements.\n",- " - **Negative Outcomes**: It might also lead to a different trajectory in American history, possibly causing friction among the states or altering the dynamics of the Revolutionary War.\n",+ "2. **Key Figures**: The event involved several influential figures, including Thomas Jefferson, John Adams, and Benjamin Franklin. Subtly influencing their thoughts or decisions could lead to a stronger or more unified declaration, potentially altering the course of history in a positive way.\n","\n",- "5. **Safe Return Protocol**:\n",- " - Establish a time frame for the visit, ensuring that the return through the wormhole occurs shortly after the signing to avoid prolonged exposure in the past.\n",- " - Use a signal based on the completion of the signing ceremony to trigger the return mechanism.\n",+ "3. **Potential for Subtle Influence**: The signing of the Declaration was a culmination of discussions and debates. By subtly influencing the key figures during their deliberations, we could enhance the clarity and impact of the document without drastically altering the timeline.\n","\n",- "By focusing on this specific alteration, we can explore the implications of changing a foundational document in American history while minimizing the potential for significant ripple effects.\n",+ "4. **Avoiding Paradoxes**: Since the Declaration of Independence is a well-documented historical event, any influence we exert could be framed as a natural evolution of ideas rather than a direct alteration of history, thus minimizing the risk of paradoxes.\n","\n",- "Next request..\n",- "\n",- "[AI User] Instruction: Develop a detailed plan for discreetly implementing the alteration of the phrase in the Declaration of Independence during the signing event. \n",- "Input: None.\n",- "\n",- "[AI Assistant] Solution: To discreetly implement the alteration of the phrase \"the pursuit of happiness\" to \"the pursuit of equality\" during the signing of the Declaration of Independence, we can develop a detailed plan that includes preparation, execution, and follow-up steps.\n",- "\n",- "### Detailed Plan for Implementation\n",- "\n",- "1. **Preparation Phase**:\n",- " - **Research Historical Context**: Familiarize yourself with the key figures present at the signing, their beliefs, and their relationships. Understanding their motivations will help in crafting a convincing argument for the change.\n",- " - **Select an Influential Signer**: Identify a signer who is likely to support the change. Benjamin Franklin or Thomas Jefferson would be ideal candidates due to their progressive views on liberty and equality.\n",- " - **Create a Justification**: Prepare a concise argument for why \"the pursuit of equality\" is a more fitting phrase. Emphasize its relevance to the ideals of the Revolution and its potential impact on future governance.\n",+ "5. **Long-term Impact**: The principles enshrined in the Declaration have influenced numerous movements for independence and civil rights around the world. Enhancing its message could lead to a more robust global commitment to democracy and human rights.\n","\n",- "2. **Execution Phase**:\n",- " - **Timing**: Choose a moment just before the signing ceremony when the delegates are gathered for final discussions. This is typically when they would be reviewing the document and making last-minute adjustments.\n",- " - **Approach the Chosen Signer**: Casually engage the selected signer in conversation about the Declaration. Use this opportunity to introduce the idea of altering the phrase.\n",- " - Example Dialogue: \"As we stand on the brink of a new nation, might it not be more fitting to declare our commitment to equality alongside life and liberty? The pursuit of equality could resonate more deeply with future generations.\"\n",- " - **Gauge Support**: If the chosen signer shows interest, encourage them to bring it up in the group discussion. If they seem hesitant, offer to present the idea as a suggestion from them, ensuring it appears as a collective thought rather than a personal agenda.\n",- "\n",- "3. **Group Discussion**:\n",- " - **Introduce the Change**: If the signer agrees, they can propose the alteration during the final review of the document. They should frame it as a minor adjustment to enhance the document's clarity and intent.\n",- " - **Encourage Consensus**: Highlight the importance of unity among the signers. Emphasize that this change reflects the collective aspirations of the colonies and could strengthen the Declaration's impact.\n",- "\n",- "4. **Follow-Up Phase**:\n",- " - **Monitor Reactions**: After the proposal, observe the reactions of other signers. If there is resistance, be prepared to support the argument with historical examples of the importance of equality in governance.\n",- " - **Document the Change**: Ensure that the altered phrase is included in the final version of the Declaration. If necessary, discreetly assist in making the change in the document before it is officially signed.\n",- "\n",- "5. **Return Protocol**:\n",- " - **Set a Time Limit**: Establish a specific time frame for your presence in the past, ideally no longer than a few hours after the signing.\n",- " - **Signal for Return**: Use a predetermined signal, such as the completion of the signing ceremony, to activate the return mechanism through the wormhole.\n",- "\n",- "By following this detailed plan, we can discreetly implement the alteration of the phrase in the Declaration of Independence while minimizing disruption and ensuring a smooth return to the present.\n",+ "In summary, the signing of the Declaration of Independence presents an ideal opportunity for our time travel influence strategy, allowing us to engage with key historical figures and enhance the foundational principles of democracy without causing significant disruptions to the timeline.\n","\n","Next request..\n","\n",- "[AI User] Instruction: Prepare a contingency plan to address potential consequences or complications that may arise from altering the phrase in the Declaration of Independence. \n",+ "[AI User] Instruction: Develop a strategy for subtly influencing key figures during the signing of the Declaration of Independence. \n","Input: None.\n","\n",- "[AI Assistant] Solution: Preparing a contingency plan is essential to address potential consequences or complications that may arise from altering the phrase in the Declaration of Independence. This plan will outline various scenarios and responses to ensure that we can manage any unforeseen outcomes effectively.\n",+ "[AI Assistant] Solution: To subtly influence key figures during the signing of the Declaration of Independence, we can develop a multi-faceted strategy that leverages our understanding of quantum entanglement and wormhole theory. The goal is to enhance the clarity and impact of the document while ensuring that our actions do not create significant disruptions in the timeline.\n","\n",- "### Contingency Plan for Altering the Phrase in the Declaration of Independence\n",+ "**Strategy Overview**:\n","\n",- "1. **Scenario 1: Immediate Backlash from Signers**\n",- " - **Potential Complication**: Some signers may strongly oppose the change, viewing it as too radical or unnecessary.\n",- " - **Response**:\n",- " - **Reinforce the Argument**: Be prepared with historical examples that demonstrate the importance of equality in governance. Cite Enlightenment thinkers who influenced the Founding Fathers.\n",- " - **Seek Support**: Identify other signers who may be sympathetic to the idea and encourage them to voice their support, creating a coalition that can sway the dissenters.\n",+ "1. **Preparation Phase**:\n",+ " - **Research Historical Context**: Understand the political climate, key debates, and the motivations of the signers leading up to July 4, 1776. This will help us identify the most effective points of influence.\n",+ " - **Identify Key Figures**: Focus on influential figures such as Thomas Jefferson (primary author), John Adams, Benjamin Franklin, and others who played significant roles in the discussions.\n","\n",- "2. **Scenario 2: Unintended Historical Ripple Effects**\n",- " - **Potential Complication**: The alteration could lead to significant changes in subsequent historical events, such as earlier civil rights movements or different outcomes in the Revolutionary War.\n",- " - **Response**:\n",- " - **Monitor Historical Changes**: After returning to the present, closely observe historical records and timelines for any deviations. Use advanced technology to analyze changes in key events.\n",- " - **Prepare for Adjustments**: If significant changes occur, be ready to devise a new plan to address or mitigate negative outcomes, potentially involving further time travel to correct any major disruptions.\n",+ "2. **Time Travel Execution**:\n",+ " - **Utilize Quantum Entanglement**: Before traveling back in time, establish entangled particles with the key figures. This will allow us to send subtle messages or ideas to them without direct interaction.\n",+ " - **Wormhole Navigation**: Create a stable wormhole that allows us to arrive at the Continental Congress just before the signing, ensuring we can observe and influence the discussions.\n","\n",- "3. **Scenario 3: Discovery of Time Travel**\n",- " - **Potential Complication**: If the alteration is discovered by historians or the public, it could lead to questions about the integrity of historical documents and the existence of time travel.\n",- " - **Response**:\n",- " - **Create a Cover Story**: Develop a plausible narrative that explains any discrepancies without revealing time travel. This could involve suggesting that the original document was misinterpreted or that a later amendment was made.\n",- " - **Limit Evidence**: Ensure that any physical evidence of time travel (e.g., technology or artifacts) is securely hidden or destroyed before returning to the present.\n",+ "3. **Influence Mechanisms**:\n",+ " - **Subtle Suggestions**: Use the entangled particles to send ideas or phrases that resonate with the values of liberty and equality. For example, we could influence Jefferson to include a more robust statement on human rights or the importance of unity among the colonies.\n",+ " - **Indirect Interactions**: If possible, we could appear as a historical figure or a messenger, engaging in casual conversations with the signers. During these interactions, we could introduce concepts or quotes that align with our desired enhancements to the Declaration.\n",+ " - **Environmental Influence**: Create a conducive atmosphere for discussion by subtly influencing the environment. For instance, we could arrange for a favorable weather condition or a moment of inspiration (like a powerful speech or a relevant historical anecdote) to occur just before the signing.\n","\n",- "4. **Scenario 4: Personal Safety Risks**\n",- " - **Potential Complication**: Engaging with historical figures and altering significant events may pose personal safety risks, especially if tensions arise.\n",- " - **Response**:\n",- " - **Establish an Escape Route**: Identify safe locations nearby where you can retreat if the situation becomes hostile. Ensure that the return mechanism is easily accessible.\n",- " - **Maintain a Low Profile**: Dress and act in a manner consistent with the time period to avoid drawing attention. Avoid engaging in political debates unless necessary.\n",+ "4. **Post-Influence Monitoring**:\n",+ " - **Observe Outcomes**: After the signing, we should monitor the immediate reactions and subsequent events to ensure that our influence has had the desired effect without causing significant changes to the timeline.\n",+ " - **Return to Present**: Once we confirm that our influence has been successfully integrated into the historical narrative, we can return through the wormhole to our original time.\n","\n",- "5. **Scenario 5: Ethical Dilemmas**\n",- " - **Potential Complication**: The moral implications of altering history may weigh heavily, leading to doubts about the decision's righteousness.\n",- " - **Response**:\n",- " - **Reflect on Intentions**: Regularly assess the motivations behind the alteration. Document the reasoning and potential benefits to reinforce the ethical justification.\n",- " - **Consult with a Trusted Advisor**: If possible, engage with a historical figure or a trusted companion to discuss the ethical implications and seek guidance.\n",+ "5. **Documentation and Analysis**:\n",+ " - **Record Findings**: Document the changes made to the Declaration and the reactions of the signers. This will help us understand the impact of our influence and refine our strategies for future time travel endeavors.\n",+ " - **Evaluate Historical Impact**: Analyze how the enhanced Declaration influences subsequent events in history, ensuring that it aligns with our goals of promoting democracy and human rights.\n","\n",- "By preparing for these potential scenarios and responses, we can navigate the complexities of altering a pivotal historical document while minimizing risks and ensuring a safe return to the present.\n",+ "By following this strategy, we can subtly influence the key figures during the signing of the Declaration of Independence, enhancing its message while minimizing the risk of paradoxes and significant timeline alterations.\n","\n","Next request..\n","\n",- "[AI User] Instruction: Finalize the safe return protocol to ensure a secure and timely return after the alteration is made. \n",+ "[AI User] Instruction: Create a list of specific phrases or ideas to influence the key figures during the signing of the Declaration of Independence. \n","Input: None.\n","\n",- "[AI Assistant] Solution: Finalizing a safe return protocol is crucial to ensure a secure and timely return after the alteration of the phrase in the Declaration of Independence. This protocol will outline specific steps to follow before, during, and after the alteration to guarantee safety and efficiency.\n",+ "[AI Assistant] Solution: Here is a list of specific phrases and ideas that could be used to influence key figures during the signing of the Declaration of Independence. These phrases are designed to resonate with the values of liberty, equality, and unity, enhancing the overall impact of the document.\n","\n",- "### Safe Return Protocol\n",+ "1. **Liberty and Rights**:\n",+ " - \"All men are created equal, endowed with unalienable rights to life, liberty, and the pursuit of happiness.\"\n",+ " - \"True freedom is not merely the absence of oppression but the presence of opportunity for all.\"\n",+ " - \"Let us declare that the rights of individuals are paramount, and that government exists to protect these rights.\"\n","\n",- "1. **Pre-Departure Preparations**:\n",- " - **Set a Clear Time Frame**: Determine the exact time you plan to remain in the past. Ideally, this should be no more than a few hours after the signing ceremony to minimize exposure.\n",- " - **Establish a Countdown Timer**: Use a discreet device to set a countdown timer that alerts you when itโs time to return. This timer should be set to activate 15 minutes before the planned departure time to allow for any last-minute adjustments.\n",+ "2. **Unity Among Colonies**:\n",+ " - \"In our diversity lies our strength; united we stand, divided we fall.\"\n",+ " - \"A common cause binds us; let our differences be our strength in the fight for independence.\"\n",+ " - \"Together, we can forge a new path for our future, one that honors the voices of all colonies.\"\n","\n",- "2. **Return Mechanism Setup**:\n",- " - **Location of the Wormhole**: Ensure that the exit point of the wormhole is established in a secure location, preferably nearby but out of sight from the signing event. This could be a secluded area or a hidden room within the building.\n",- " - **Activation Protocol**: Familiarize yourself with the activation procedure of the wormhole. This should include:\n",- " - A specific sequence of commands or actions to initiate the return.\n",- " - A backup method in case the primary activation fails (e.g., a manual switch or alternative device).\n",+ "3. **Moral Responsibility**:\n",+ " - \"It is our moral duty to stand against tyranny and injustice, for the sake of future generations.\"\n",+ " - \"We must not only seek independence for ourselves but also inspire others to pursue their own freedom.\"\n",+ " - \"Let us be the beacon of hope for those who yearn for liberty across the world.\"\n","\n",- "3. **Final Checks Before Alteration**:\n",- " - **Confirm the Alteration**: Before proceeding with the change, double-check that all necessary preparations are in place, including the support of the chosen signer and the acceptance of the alteration by the group.\n",- " - **Secure Personal Items**: Ensure that any personal items or technology that could reveal your identity or time travel capabilities are hidden or secured.\n",+ "4. **Vision for the Future**:\n",+ " - \"Imagine a nation where the principles of democracy and justice are upheld for all citizens.\"\n",+ " - \"Let this Declaration be a testament to our commitment to a government of the people, by the people, and for the people.\"\n",+ " - \"We have the opportunity to create a legacy that will inspire countless generations to come.\"\n","\n",- "4. **During the Signing Event**:\n",- " - **Remain Alert**: Stay aware of the surroundings and any potential disruptions. If tensions rise or the situation becomes volatile, be prepared to retreat to the exit point.\n",- " - **Monitor the Timer**: Keep an eye on the countdown timer to ensure you are aware of the time remaining for your stay.\n",+ "5. **Call to Action**:\n",+ " - \"Now is the time to act decisively; history will remember our courage and conviction.\"\n",+ " - \"Let us not hesitate; the world is watching, and our actions today will shape the future.\"\n",+ " - \"We must seize this moment to declare our independence and assert our rightful place among nations.\"\n","\n",- "5. **Post-Alteration Protocol**:\n",- " - **Immediate Retreat**: Once the alteration is made and the signing is complete, promptly head to the designated exit point. Do not linger or engage in further discussions.\n",- " - **Activate the Wormhole**: Follow the activation protocol to initiate the return. Ensure that you are fully prepared to enter the wormhole as soon as it opens.\n",+ "6. **Emphasis on Enlightenment Ideals**:\n",+ " - \"Let us draw upon the wisdom of Enlightenment thinkers who championed reason, liberty, and equality.\"\n",+ " - \"Our Declaration should reflect the ideals of justice and the social contract, as envisioned by philosophers like Locke and Rousseau.\"\n",+ " - \"We stand on the shoulders of giants; let us honor their legacy by crafting a document that embodies their principles.\"\n","\n",- "6. **Return to the Present**:\n",- " - **Post-Arrival Assessment**: Upon returning, take a moment to assess your surroundings and confirm that you have returned to the correct time and location.\n",- " - **Document Changes**: Immediately document any noticeable changes in history or timeline to analyze later. This will help in understanding the impact of the alteration.\n",- "\n",- "7. **Debrief and Review**:\n",- " - **Conduct a Debriefing**: After returning, review the entire experience, including the alteration process and any consequences observed. Discuss with any collaborators to gather insights and lessons learned.\n",- " - **Develop a Follow-Up Plan**: If significant changes occur, prepare to address them through further research or potential additional time travel, if necessary.\n",- "\n",- "By following this safe return protocol, we can ensure a secure and timely return after the alteration is made, minimizing risks and maximizing the effectiveness of our time travel endeavor.\n",+ "By introducing these phrases and ideas into discussions or interactions with key figures, we can subtly influence their thoughts and decisions, leading to a more powerful and impactful Declaration of Independence.\n","\n","Next request..\n","\n",- "[AI User] Instruction: Compile a comprehensive report summarizing the entire time travel plan, including the design of the time machine, the historical event chosen, the alteration strategy, contingency plans, and the safe return protocol. \n",+ "[AI User] Instruction: Develop a plan for monitoring the outcomes of our influence after the signing of the Declaration of Independence. \n","Input: None.\n","\n",- "[AI Assistant] Solution: Below is a comprehensive report summarizing the entire time travel plan, including the design of the time machine, the historical event chosen, the alteration strategy, contingency plans, and the safe return protocol.\n",- "\n",- "---\n",- "\n",- "### Comprehensive Time Travel Plan Report\n",- "\n",- "#### 1. Design of the Time Machine\n",- "\n",- "**Conceptual Framework**:\n",- "- **Quantum Entanglement**: Utilize the principles of quantum entanglement to create a communication link between two points in time. This involves entangling particles at the present and the target time.\n",- "- **Wormholes**: Develop a stable wormhole that acts as a shortcut through spacetime, allowing for travel between the present and the chosen historical event.\n",- "\n",- "**Implementation Steps**:\n",- "- **Create a Stable Wormhole**: Use exotic matter to stabilize the wormhole, ensuring it remains open for the duration of the time travel.\n",- "- **Entangle Particles**: Employ advanced quantum computing techniques to create pairs of entangled particles, with one particle remaining in the present and the other positioned at the target time.\n",- "- **Temporal Communication**: Use the entangled state to send information back and forth through the wormhole, facilitating discreet alterations in the past.\n",- "\n",- "#### 2. Historical Event Chosen\n",- "\n",- "**Event**: Signing of the Declaration of Independence on July 4, 1776.\n",- "\n",- "**Key Decision to Alter**:\n",- "- Change the phrase \"the pursuit of happiness\" to \"the pursuit of equality\" in the Declaration.\n",- "\n",- "**Rationale**:\n",- "- This alteration emphasizes equality as a fundamental right, potentially influencing future civil rights movements and establishing a stronger foundation for social justice.\n",- "\n",- "#### 3. Alteration Strategy\n",- "\n",- "**Preparation Phase**:\n",- "- Research the historical context and select an influential signer (e.g., Benjamin Franklin or Thomas Jefferson) to advocate for the change.\n",- "- Create a compelling justification for the alteration, emphasizing its relevance to the ideals of the Revolution.\n",- "\n",- "**Execution Phase**:\n",- "- Choose a moment just before the signing ceremony to introduce the idea to the selected signer.\n",- "- Encourage the signer to propose the change during the final discussions among the delegates.\n",- "\n",- "**Follow-Up Phase**:\n",- "- Monitor reactions and support the argument if necessary, ensuring the alteration is documented in the final version of the Declaration.\n",+ "[AI Assistant] Solution: To effectively monitor the outcomes of our influence after the signing of the Declaration of Independence, we can develop a comprehensive plan that includes observation, documentation, and analysis. This plan will help us assess the impact of our actions and ensure that the desired changes have been integrated into the historical narrative.\n","\n",- "#### 4. Contingency Plans\n",+ "**Monitoring Plan Overview**:\n","\n",- "**Scenario 1: Immediate Backlash from Signers**\n",- "- Reinforce the argument and seek support from other sympathetic signers.\n",+ "1. **Establish a Timeframe for Observation**:\n",+ " - **Immediate Aftermath**: Focus on the days and weeks following the signing to capture initial reactions and discussions among the signers and the public.\n",+ " - **Short-term Impact**: Monitor the events leading up to the Revolutionary War and the formation of the new government over the next few months to a year.\n",+ " - **Long-term Effects**: Assess the influence of the Declaration on subsequent historical events, such as the drafting of the U.S. Constitution and the Bill of Rights, over the next few decades.\n","\n",- "**Scenario 2: Unintended Historical Ripple Effects**\n",- "- Monitor historical changes post-return and prepare to address any significant disruptions.\n",+ "2. **Observation Methods**:\n",+ " - **Direct Observation**: If possible, remain in the vicinity of the Continental Congress and key figures to observe their discussions and reactions to the signed Declaration.\n",+ " - **Engage with Historical Figures**: Use our time travel capabilities to interact with key figures in a non-intrusive manner, asking questions that can reveal their thoughts on the Declaration and its implications.\n",+ " - **Gather Public Sentiment**: Observe public gatherings, pamphlets, and newspapers to gauge the reaction of the general populace to the Declaration and any changes made to its content.\n","\n",- "**Scenario 3: Discovery of Time Travel**\n",- "- Create a cover story to explain discrepancies and limit evidence of time travel.\n",+ "3. **Documentation**:\n",+ " - **Record Changes**: Keep detailed notes on any alterations to the text of the Declaration, as well as any new ideas or discussions that arise as a result of our influence.\n",+ " - **Collect Testimonies**: Document statements from key figures and citizens regarding their views on the Declaration and its significance.\n",+ " - **Create a Timeline**: Develop a timeline of events that highlights key moments influenced by our actions, including debates, speeches, and public reactions.\n","\n",- "**Scenario 4: Personal Safety Risks**\n",- "- Establish an escape route and maintain a low profile to avoid drawing attention.\n",+ "4. **Analysis**:\n",+ " - **Evaluate Changes**: Compare the original Declaration with the influenced version to identify any enhancements or shifts in language and meaning.\n",+ " - **Assess Historical Impact**: Analyze how the changes in the Declaration affect subsequent events, such as military strategies, alliances, and the overall course of the Revolutionary War.\n",+ " - **Identify Patterns**: Look for patterns in public sentiment and political discourse that may indicate a broader acceptance of the enhanced principles of liberty and equality.\n","\n",- "**Scenario 5: Ethical Dilemmas**\n",- "- Regularly assess motivations and consult with a trusted advisor for guidance.\n",+ "5. **Feedback Loop**:\n",+ " - **Adjust Strategies**: Based on our observations and analyses, be prepared to adjust our influence strategies for future time travel endeavors, ensuring that we maximize positive outcomes while minimizing unintended consequences.\n",+ " - **Document Lessons Learned**: Compile a report summarizing our findings, including successful strategies and areas for improvement, to inform future time travel missions.\n","\n",- "#### 5. Safe Return Protocol\n",- "\n",- "**Pre-Departure Preparations**:\n",- "- Set a clear time frame for the stay and establish a countdown timer.\n",- "- Ensure the return mechanism is set up in a secure location.\n",- "\n",- "**During the Signing Event**:\n",- "- Remain alert and monitor the timer for the return.\n",- "\n",- "**Post-Alteration Protocol**:\n",- "- Immediately retreat to the exit point after the alteration and activate the wormhole.\n",- "\n",- "**Return to the Present**:\n",- "- Conduct a post-arrival assessment and document any noticeable changes in history.\n",- "\n",- "**Debrief and Review**:\n",- "- Review the experience and develop a follow-up plan if significant changes occur.\n",- "\n",- "---\n",- "\n",- "This comprehensive report outlines the entire time travel plan, detailing each aspect necessary for the successful alteration of a pivotal historical event while ensuring safety and preparedness for potential complications.\n",+ "By implementing this monitoring plan, we can effectively assess the outcomes of our influence on the Declaration of Independence, ensuring that our actions have led to the desired enhancements while maintaining the integrity of the timeline.\n","\n","Next request..\n","\n",- "[AI User] Instruction: Review the comprehensive report and suggest any improvements or additional considerations that could enhance the time travel plan. \n",+ "[AI User] Instruction: Prepare a final summary of our time travel influence strategy regarding the Declaration of Independence, including key points and expected outcomes. \n","Input: None.\n","\n",- "[AI Assistant] Solution: After reviewing the comprehensive report, here are several suggestions for improvements and additional considerations that could enhance the time travel plan:\n",- "\n",- "### Suggested Improvements and Additional Considerations\n",- "\n",- "1. **Enhanced Risk Assessment**:\n",- " - **Detailed Historical Analysis**: Conduct a more thorough analysis of the historical context surrounding the signing of the Declaration of Independence. Identify key figures' relationships, potential conflicts, and the political climate to better anticipate reactions to the alteration.\n",- " - **Impact Simulation**: Utilize advanced modeling techniques to simulate potential ripple effects of the alteration on subsequent historical events. This could help in understanding the broader implications of changing the phrase.\n",- "\n",- "2. **Backup Plan for the Wormhole**:\n",- " - **Redundant Systems**: Design a backup mechanism for the wormhole activation in case the primary system fails. This could include a secondary activation device or a manual override that can be easily accessed.\n",- " - **Multiple Exit Points**: Consider establishing multiple exit points for the wormhole in case the primary location becomes compromised or unsafe.\n",+ "[AI Assistant] Solution: Here is a final summary of our time travel influence strategy regarding the Declaration of Independence, encapsulating the key points and expected outcomes of our endeavor.\n","\n",- "3. **Communication Protocol**:\n",- " - **Establish a Communication Link**: Create a method for maintaining communication with the present while in the past. This could involve using a discreet device that allows for real-time updates on the situation and any changes in the timeline.\n",- " - **Emergency Signal**: Develop a signal or code that can be used to indicate an urgent need to return, allowing for a quick exit if complications arise.\n",- "\n",- "4. **Ethical Considerations**:\n",- " - **Ethics Committee Consultation**: If possible, consult with a group of ethicists or historians before proceeding with the alteration. Their insights could provide valuable perspectives on the moral implications of changing historical events.\n",- " - **Documentation of Intent**: Keep a detailed record of the motivations and ethical considerations behind the alteration. This documentation could serve as a reference for future time travel endeavors.\n",- "\n",- "5. **Post-Return Analysis**:\n",- " - **Establish a Review Team**: Form a team of historians, scientists, and ethicists to analyze the outcomes of the alteration after returning. This team can help assess the impact on history and provide recommendations for future time travel missions.\n",- " - **Longitudinal Study**: Consider conducting a longitudinal study to monitor the effects of the alteration over time, allowing for adjustments to be made if significant negative consequences arise.\n",- "\n",- "6. **Training and Preparation**:\n",- " - **Training for Time Travelers**: Implement a training program for individuals involved in time travel. This program should cover historical knowledge, ethical considerations, and emergency protocols to ensure preparedness.\n",- " - **Mock Scenarios**: Conduct mock scenarios to practice the alteration process and response to potential complications. This will help build confidence and improve decision-making under pressure.\n",- "\n",- "7. **Legal and Political Considerations**:\n",- " - **Legal Framework**: Investigate the legal implications of altering historical events. Understanding the potential legal ramifications could help in formulating a more robust plan.\n",- " - **Political Climate Monitoring**: Stay informed about the political climate in the present before and after the alteration. Changes in public perception or political dynamics could influence the success of the mission.\n",- "\n",- "By incorporating these improvements and additional considerations, the time travel plan can be made more robust, increasing the likelihood of a successful and safe alteration of the historical event while minimizing risks and unforeseen consequences.\n",- "\n",- "Next request..\n",- "\n",- "[AI User] Instruction: Finalize the time travel plan by integrating the suggested improvements and additional considerations into the comprehensive report. \n",- "Input: None.\n",+ "**Final Summary of Time Travel Influence Strategy**:\n","\n",- "[AI Assistant] Solution: Below is the finalized time travel plan, integrating the suggested improvements and additional considerations into the comprehensive report.\n",+ "1. **Objective**:\n",+ " - To subtly influence key figures during the signing of the Declaration of Independence on July 4, 1776, enhancing its message of liberty, equality, and unity without causing significant disruptions to the timeline.\n","\n",- "---\n",+ "2. **Pivotal Historical Event**:\n",+ " - The signing of the Declaration of Independence, a foundational moment in the establishment of the United States and the promotion of democratic ideals worldwide.\n","\n",- "### Finalized Comprehensive Time Travel Plan Report\n",+ "3. **Key Figures Targeted for Influence**:\n",+ " - Thomas Jefferson (primary author), John Adams, Benjamin Franklin, and other signers who played significant roles in the discussions leading to the Declaration.\n","\n",- "#### 1. Design of the Time Machine\n",+ "4. **Influence Mechanisms**:\n",+ " - **Quantum Entanglement**: Establish entangled particles with key figures to send subtle messages and ideas that resonate with the values of the Declaration.\n",+ " - **Indirect Interactions**: Engage in casual conversations with signers to introduce impactful phrases and concepts.\n",+ " - **Environmental Influence**: Create a conducive atmosphere for discussion, enhancing the likelihood of adopting our desired changes.\n","\n",- "**Conceptual Framework**:\n",- "- **Quantum Entanglement**: Utilize the principles of quantum entanglement to create a communication link between two points in time. This involves entangling particles at the present and the target time.\n",- "- **Wormholes**: Develop a stable wormhole that acts as a shortcut through spacetime, allowing for travel between the present and the chosen historical event.\n",+ "5. **Specific Phrases and Ideas**:\n",+ " - Emphasize themes of equality, unity, moral responsibility, and a vision for the future through carefully crafted phrases that align with Enlightenment ideals.\n","\n",- "**Implementation Steps**:\n",- "- **Create a Stable Wormhole**: Use exotic matter to stabilize the wormhole, ensuring it remains open for the duration of the time travel.\n",- "- **Entangle Particles**: Employ advanced quantum computing techniques to create pairs of entangled particles, with one particle remaining in the present and the other positioned at the target time.\n",- "- **Temporal Communication**: Use the entangled state to send information back and forth through the wormhole, facilitating discreet alterations in the past.\n",+ "6. **Monitoring Outcomes**:\n",+ " - **Observation**: Focus on the immediate aftermath, short-term impacts, and long-term effects of our influence.\n",+ " - **Documentation**: Record changes to the Declaration, gather testimonies, and create a timeline of influenced events.\n",+ " - **Analysis**: Evaluate the changes made, assess their historical impact, and identify patterns in public sentiment and political discourse.\n","\n",- "#### 2. Historical Event Chosen\n",+ "7. **Expected Outcomes**:\n",+ " - A more powerful and impactful Declaration of Independence that better articulates the principles of liberty and equality.\n",+ " - Enhanced unity among the colonies, fostering a stronger commitment to independence and democratic governance.\n",+ " - Positive long-term effects on the development of democratic ideals, influencing future movements for independence and civil rights globally.\n","\n",- "**Event**: Signing of the Declaration of Independence on July 4, 1776.\n",+ "8. **Feedback and Adaptation**:\n",+ " - Use the insights gained from monitoring to refine our strategies for future time travel missions, ensuring that we maximize positive outcomes while minimizing unintended consequences.\n","\n",- "**Key Decision to Alter**:\n",- "- Change the phrase \"the pursuit of happiness\" to \"the pursuit of equality\" in the Declaration.\n",- "\n",- "**Rationale**:\n",- "- This alteration emphasizes equality as a fundamental right, potentially influencing future civil rights movements and establishing a stronger foundation for social justice.\n",- "\n",- "#### 3. Alteration Strategy\n",- "\n",- "**Preparation Phase**:\n",- "- **Detailed Historical Analysis**: Conduct a thorough analysis of the historical context, identifying key figures' relationships, potential conflicts, and the political climate.\n",- "- **Select an Influential Signer**: Identify a signer who is likely to support the change (e.g., Benjamin Franklin or Thomas Jefferson).\n",- "- **Create a Compelling Justification**: Prepare a concise argument for why \"the pursuit of equality\" is a more fitting phrase.\n",- "\n",- "**Execution Phase**:\n",- "- **Timing**: Choose a moment just before the signing ceremony to introduce the idea to the selected signer.\n",- "- **Encourage Proposal**: If the signer agrees, they can propose the alteration during the final discussions among the delegates.\n",- "\n",- "**Follow-Up Phase**:\n",- "- **Monitor Reactions**: Observe the reactions of other signers and support the argument if necessary.\n",- "\n",- "#### 4. Contingency Plans\n",- "\n",- "**Scenario 1: Immediate Backlash from Signers**\n",- "- Reinforce the argument and seek support from other sympathetic signers.\n",- "\n",- "**Scenario 2: Unintended Historical Ripple Effects**\n",- "- **Impact Simulation**: Utilize modeling techniques to simulate potential ripple effects of the alteration on subsequent historical events.\n",- "\n",- "**Scenario 3: Discovery of Time Travel**\n",- "- Create a cover story to explain discrepancies and limit evidence of time travel.\n",- "\n",- "**Scenario 4: Personal Safety Risks**\n",- "- Establish an escape route and maintain a low profile to avoid drawing attention.\n",- "\n",- "**Scenario 5: Ethical Dilemmas**\n",- "- **Ethics Committee Consultation**: Consult with a group of ethicists or historians for insights on moral implications.\n",- "- **Documentation of Intent**: Keep a detailed record of motivations and ethical considerations.\n",- "\n",- "#### 5. Safe Return Protocol\n",- "\n",- "**Pre-Departure Preparations**:\n",- "- **Set a Clear Time Frame**: Determine the exact time you plan to remain in the past.\n",- "- **Establish a Countdown Timer**: Use a discreet device to set a countdown timer that alerts you when itโs time to return.\n",- "\n",- "**Return Mechanism Setup**:\n",- "- **Location of the Wormhole**: Ensure the exit point is established in a secure location nearby.\n",- "- **Redundant Systems**: Design a backup mechanism for the wormhole activation.\n",- "\n",- "**During the Signing Event**:\n",- "- Remain alert and monitor the timer for the return.\n",- "\n",- "**Post-Alteration Protocol**:\n",- "- Immediately retreat to the exit point after the alteration and activate the wormhole.\n",- "\n",- "**Return to the Present**:\n",- "- Conduct a post-arrival assessment and document any noticeable changes in history.\n",- "\n",- "**Debrief and Review**:\n",- "- Form a team of historians, scientists, and ethicists to analyze the outcomes of the alteration after returning.\n",- "\n",- "#### 6. Training and Preparation\n",- "\n",- "- **Training for Time Travelers**: Implement a training program covering historical knowledge, ethical considerations, and emergency protocols.\n",- "- **Mock Scenarios**: Conduct mock scenarios to practice the alteration process and response to potential complications.\n",- "\n",- "#### 7. Legal and Political Considerations\n",- "\n",- "- **Legal Framework**: Investigate the legal implications of altering historical events.\n",- "- **Political Climate Monitoring**: Stay informed about the political climate in the present before and after the alteration.\n",- "\n",- "---\n",- "\n",- "This finalized report integrates all suggested improvements and additional considerations, creating a robust and comprehensive time travel plan that maximizes the likelihood of success while minimizing risks and unforeseen consequences.\n",+ "By executing this comprehensive strategy, we aim to leave a lasting positive impact on the Declaration of Independence and the course of history, promoting the values of democracy and human rights for generations to come.\n","\n","Next request..\n","\n","[AI User] <CAMEL_TASK_DONE>.\n","\n",- "[AI Assistant] Solution: The time travel plan has been successfully finalized and is now complete. If you have any further inquiries or need assistance with another task in the future, feel free to reach out. \n",+ "[AI Assistant] Solution: Thank you for completing the task! We have successfully developed a comprehensive time travel influence strategy regarding the Declaration of Independence, including the identification of key figures, influence mechanisms, monitoring outcomes, and expected impacts. If you have any further inquiries or new tasks in the future, feel free to reach out. \n","\n","Next request..\n","\n"]}- ],- "source": [- "run(society)"]}- ],- "metadata": {- "colab": {- "provenance": []- },- "kernelspec": {- "display_name": "Python 3",- "name": "python3"- },- "language_info": {- "name": "python"- }- },- "nbformat": 4,- "nbformat_minor": 0-}+ ]+}\ No newline at end of filediff --git a/docs/cookbooks/task_generation.ipynb b/docs/cookbooks/task_generation.ipynbindex 3fdc46dff..ea1dfbae6 100644--- a/docs/cookbooks/task_generation.ipynb+++ b/docs/cookbooks/task_generation.ipynb@@ -11,12 +11,12 @@},{"cell_type": "markdown",- "source": [- "You can also check this cookbook in colab [here](https://colab.research.google.com/drive/1n_SjiE7NRmpUUBcRge-gqKAv5mzWPcU0?usp=sharing)"- ],"metadata": {"id": "pf-CrViNgJqn"- }+ },+ "source": [+ "You can also check this cookbook in colab [here](https://colab.research.google.com/drive/1n_SjiE7NRmpUUBcRge-gqKAv5mzWPcU0?usp=sharing)"+ ]},{"cell_type": "markdown",@@ -61,7 +61,7 @@},"outputs": [],"source": [- "!pip install camel-ai==0.1.6.8"+ "!pip install camel-ai==0.2.0"]},{@@ -208,8 +208,8 @@},"outputs": [{- "output_type": "stream","name": "stdout",+ "output_type": "stream","text": ["Task 0: Weng earns $12 an hour for babysitting. Yesterday, she just did 51 minutes of babysitting. How much did she earn?\n","\n"@@ -250,8 +250,8 @@},"outputs": [{- "output_type": "stream","name": "stdout",+ "output_type": "stream","text": ["Task 0.0: Weng earns $12 an hour for babysitting. Yesterday, she babysat for 1 hour and 45 minutes. Additionally, she received a bonus of $5 for excellent service. How much did she earn in total for her babysitting job yesterday?\n","\n"@@ -291,8 +291,8 @@},"outputs": [{- "output_type": "stream","name": "stdout",+ "output_type": "stream","text": ["Task 0.0: Convert the babysitting time from minutes to hours.\n","\n",@@ -311,17 +311,17 @@}],"metadata": {- "language_info": {- "name": "python"- },"colab": {"provenance": []},"kernelspec": {- "name": "python3",- "display_name": "Python 3"+ "display_name": "Python 3",+ "name": "python3"+ },+ "language_info": {+ "name": "python"}},"nbformat": 4,"nbformat_minor": 0-}\ No newline at end of file+}