๐ซ 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: Reward model cookbook (#1332)
Asher-hss31c9c86a083e
diff --git a/README.md b/README.mdindex d9f6f1877..b7eff8a01 100644--- a/README.md+++ b/README.md@@ -270,13 +270,14 @@ Practical guides and tutorials for implementing specific functionalities in CAME| **[Graph RAG Cookbook](https://docs.camel-ai.org/cookbooks/advanced_features/agents_with_graph_rag.html)** | Leveraging knowledge graphs with RAG. || **[Track CAMEL Agents with AgentOps](https://docs.camel-ai.org/cookbooks/advanced_features/agents_tracking.html)** | Tools for tracking and managing agents in operations. |-### Model Training & Data Generation+### Data Generation & Model Training| Cookbook | Description ||:---|:---|| **[Data Generation with CAMEL and Finetuning with Unsloth](https://docs.camel-ai.org/cookbooks/data_generation/sft_data_generation_and_unsloth_finetuning_Qwen2_5_7B.html)** | Learn how to generate data with CAMEL and fine-tune models effectively with Unsloth. || **[Data Gen with Real Function Calls and Hermes Format](https://docs.camel-ai.org/cookbooks/data_generation/data_gen_with_real_function_calls_and_hermes_format.html)** | Explore how to generate data with real function calls and the Hermes format. || **[Self-instruct Data Generation](https://docs.camel-ai.org/cookbooks/data_generation/self_instruct_data_generation.html)** | Explore comprehensive guidelines and best practices for generating self-instructional data, enabling robust model training and improved performance. || **[CoT Data Generation and SFT Qwen with Unsolth](https://docs.camel-ai.org/cookbooks/data_generation/cot_data_gen_sft_qwen_unsolth_upload_huggingface.html)** | Discover how to generate CoT data using CAMEL and SFT Qwen with Unsolth, and seamlessly upload your data and model to Huggingface. |+| **[Agentic Data Generation, Evaluation & Filtering with Reward Models](https://docs.camel-ai.org/cookbooks/data_generation/synthetic_dataevaluation&filter_with_reward_model.html)** | Discover methods for generating, evaluating, and filtering agentic data using reward models to enhance the quality and efficiency of your synthetic data pipelines. |### Multi-Agent Systems & Applications| Cookbook | Description |diff --git a/docs/cookbooks/applications/dynamic_travel_planner.ipynb b/docs/cookbooks/applications/dynamic_travel_planner.ipynbindex 1dc088f44..3febe3a27 100644--- a/docs/cookbooks/applications/dynamic_travel_planner.ipynb+++ b/docs/cookbooks/applications/dynamic_travel_planner.ipynb@@ -1,28 +1,39 @@{+ "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 Dynamic Travel Planner Role-Playing: Multi-Agent System with Real-Time Weather Insights from Dappier Real time RAG model\n"+ ],"metadata": {"id": "ymsq1Lw0VEqT"- },- "source": [- "# Dynamic Travel Planner Role-Playing: Multi-Agent System with Real-Time Insights Powered by Dappier\n"- ]+ }},{"cell_type": "markdown",- "metadata": {- "id": "7V3aV16AmY0K"- },"source": ["You can also check this cookbook in colab [here](https://colab.research.google.com/drive/1yYFcgQ0rdAvepTclqLvZR8icqsW4uc-P?usp=sharing)"- ]+ ],+ "metadata": {+ "id": "7V3aV16AmY0K"+ }},{"cell_type": "markdown",- "metadata": {- "id": "ghsM5AMMzKeE"- },"source": ["<div class=\"align-center\">\n"," <a href=\"https://www.camel-ai.org/\"><img src=\"https://i.postimg.cc/KzQ5rfBC/button.png\"width=\"150\"></a>\n",@@ -30,53 +41,56 @@" \n","โญ <i>Star us on [*Github*](https://github.com/camel-ai/camel), join our [*Discord*](https://discord.camel-ai.org) or follow our [*X*](https://x.com/camelaiorg)\n","</div>"- ]+ ],+ "metadata": {+ "id": "ghsM5AMMzKeE"+ }},{"cell_type": "markdown",- "metadata": {- "id": "G5gE04UuPUWj"- },"source": [- "This notebook demonstrates how to set up and leverage CAMEL's multi-agent combined with Dappier for dynamic travel planning. By combining real-time data and multi-agent role-playing, this notebook walks you through an innovative approach to creating adaptive travel plans.\n",+ "This notebook demonstrates how to set up and leverage CAMEL's Retrieval-Augmented Generation (RAG) combined with Dappier for dynamic travel planning. By combining real-time weather data and multi-agent role-playing, this notebook walks you through an innovative approach to creating adaptive travel plans.\n","\n","In this notebook, you'll explore:\n","\n",- "* **CAMEL**: A powerful multi-agent framework that enables multi-agent role-playing scenarios, allowing for sophisticated AI-driven tasks.\n",+ "* **CAMEL**: A powerful multi-agent framework that enables Retrieval-Augmented Generation and multi-agent role-playing scenarios, allowing for sophisticated AI-driven tasks.\n","* **Dappier**: A platform connecting LLMs and Agentic AI agents to real-time, rights-cleared data from trusted sources, specializing in domains like web search, finance, and news. It delivers enriched, prompt-ready data, empowering AI with verified and up-to-date information for diverse applications.\n","* **OpenAI**: A leading provider of advanced AI models capable of natural language understanding, contextual reasoning, and content generation. It enables intelligent, human-like interactions and supports a wide range of applications across various domains.\n","* **AgentOps**: Track and analysis the running of CAMEL Agents.\n","\n","\n",- "This setup not only demonstrates a practical application of AI-driven dynamic travel planning but also provides a flexible framework that can be adapted to other real-world scenarios requiring real-time data integration from Dappier, multi-agent collaboration, and contextual reasoning."- ]+ "This setup not only demonstrates a practical application of AI-driven dynamic travel planning but also provides a flexible framework that can be adapted to other real-world scenarios requiring real-time data integration from Dappier RAG models, multi-agent collaboration, and contextual reasoning."+ ],+ "metadata": {+ "id": "G5gE04UuPUWj"+ }},{"cell_type": "markdown",- "metadata": {- "id": "Eonup3GwicXL"- },"source": [- ""- ]+ ""+ ],+ "metadata": {+ "id": "mLMyy-F1zZq0"+ }},{"cell_type": "markdown",- "metadata": {- "id": "0J0_iW-YVcq2"- },"source": ["## ๐ฆ Installation"- ]+ ],+ "metadata": {+ "id": "0J0_iW-YVcq2"+ }},{"cell_type": "markdown",- "metadata": {- "id": "7p-JjpyNVcCT"- },"source": ["First, install the CAMEL package with all its dependencies:"- ]+ ],+ "metadata": {+ "id": "7p-JjpyNVcCT"+ }},{"cell_type": "code",@@ -91,42 +105,50 @@},{"cell_type": "markdown",- "metadata": {- "id": "lfNvFbhD6o8B"- },"source": ["## ๐ Setting Up API Keys"- ]+ ],+ "metadata": {+ "id": "lfNvFbhD6o8B"+ }},{"cell_type": "markdown",- "metadata": {- "id": "jqV12oQfQTyl"- },"source": ["You'll need to set up your API keys for OpenAI, Dappier and AgentOps.\n","This ensures that the tools can interact with external services securely."- ]+ ],+ "metadata": {+ "id": "jqV12oQfQTyl"+ }},{"cell_type": "markdown",+ "source": [+ "You can go to [here](https://platform.dappier.com/profile/api-keys) to get API Key from Dappier with **free** credits."+ ],"metadata": {"id": "wlNTpfRUxzis"- },- "source": [- "You can go to [here](https://platform.dappier.com/profile/api-keys) to get API Key from Dappier with **free** credits. The API Key could be found under Settings -> Profile."- ]+ }},{"cell_type": "code",- "execution_count": null,+ "source": [+ "import os\n",+ "from getpass import getpass\n",+ "\n",+ "# Prompt for the Dappier API key securely\n",+ "dappier_api_key = getpass('Enter your API key: ')\n",+ "os.environ[\"DAPPIER_API_KEY\"] = dappier_api_key"+ ],"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "Y8CJmIVEyGok",- "outputId": "3ed32ea9-ef17-48f2-f530-e3d6297392e2"+ "outputId": "f6518528-49ef-4966-cced-670ec9b9cb47"},+ "execution_count": 3,"outputs": [{"name": "stdout",@@ -135,35 +157,32 @@"Enter your API key: ยทยทยทยทยทยทยทยทยทยท\n"]}- ],- "source": [- "import os\n",- "from getpass import getpass\n",- "\n",- "# Prompt for the Dappier API key securely\n",- "dappier_api_key = getpass('Enter your API key: ')\n",- "os.environ[\"DAPPIER_API_KEY\"] = dappier_api_key"]},{"cell_type": "markdown",- "metadata": {- "id": "czxWvnvnAimt"- },"source": ["Your can go to [here](https://platform.openai.com/settings/organization/api-keys) to get API Key from Open AI."- ]+ ],+ "metadata": {+ "id": "czxWvnvnAimt"+ }},{"cell_type": "code",- "execution_count": null,+ "source": [+ "# 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": {+ "id": "T0FBl1WF6jFs","colab": {"base_uri": "https://localhost:8080/"},- "id": "T0FBl1WF6jFs",- "outputId": "c0481aa9-c7e8-4fe9-e9ec-874fd220accd"+ "outputId": "486c1a66-7dce-484a-f372-d3df083e482a"},+ "execution_count": 4,"outputs": [{"name": "stdout",@@ -172,32 +191,32 @@"Enter your API key: ยทยทยทยทยทยทยทยทยทยท\n"]}- ],- "source": [- "# 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": "Sc3MAQwiH9Pd"- },"source": ["You can go to [here](https://app.agentops.ai/signin) to get **free** API Key from AgentOps\n"- ]+ ],+ "metadata": {+ "id": "Sc3MAQwiH9Pd"+ }},{"cell_type": "code",- "execution_count": null,+ "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": {+ "id": "HQ_yOT5_Hyt4","colab": {"base_uri": "https://localhost:8080/"},- "id": "HQ_yOT5_Hyt4",- "outputId": "581e7b77-fc4d-49e1-dfee-8a4b57b4cb12"+ "outputId": "ee16079b-9e9c-4c39-dc3b-64ab3f22a312"},+ "execution_count": 5,"outputs": [{"name": "stdout",@@ -206,29 +225,19 @@"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": "lij5h45Yw6R1"- },"source": ["Set up the OpenAI GPT4o-mini using the CAMEL ModelFactory. You can also configure other models as needed."- ]+ ],+ "metadata": {+ "id": "lij5h45Yw6R1"+ }},{"cell_type": "code",- "execution_count": null,- "metadata": {- "id": "oqW0e7dKxHrq"- },- "outputs": [],"source": ["from camel.models import ModelFactory\n","from camel.types import ModelPlatformType, ModelType\n",@@ -240,141 +249,140 @@" model_type=ModelType.GPT_4O_MINI,\n"," model_config_dict=ChatGPTConfig(temperature=0.2).as_dict(),\n",")"- ]+ ],+ "metadata": {+ "id": "oqW0e7dKxHrq"+ },+ "execution_count": 6,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "Lek7QJfI9DpK"- },"source": ["## ๐น Monitoring AI Agents with AgentOps"- ]+ ],+ "metadata": {+ "id": "Lek7QJfI9DpK"+ }},{"cell_type": "code",- "execution_count": null,+ "source": [+ "import agentops\n",+ "agentops.init(default_tags=[\"CAMEL cookbook\"])"+ ],"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "l2outw9Q9H27",- "outputId": "71ff9338-2d5d-4782-8e4c-eced6338ea24"+ "outputId": "3456ea06-3a90-4440-cfd2-1cef6a4f1ea0"},+ "execution_count": 7,"outputs": [{- "name": "stderr","output_type": "stream",+ "name": "stderr","text": [- "๐ AgentOps: \u001b[34mSession Replay: https://app.agentops.ai/drilldown?session_id=e1d4ca98-f21d-4f65-b4b1-2004faa385c1\u001b[0m\n"+ "๐ AgentOps: \u001b[34m\u001b[34mSession Replay: https://app.agentops.ai/drilldown?session_id=c31e4378-a022-4272-adba-0e75792c87cd\u001b[0m\u001b[0m\n"]},{+ "output_type": "execute_result","data": {"text/plain": [- "<agentops.session.Session at 0x7abe5582dcc0>"+ "<agentops.session.Session at 0x7c514a3eca00>"]},- "execution_count": 6,"metadata": {},- "output_type": "execute_result"+ "execution_count": 7}- ],- "source": [- "import agentops\n",- "agentops.init(default_tags=[\"CAMEL cookbook\"])"]},{"cell_type": "markdown",- "metadata": {- "id": "NEUciNquON9_"- },"source": ["## ๐ฐ๏ธ Access Real Time Data with Dappier"- ]+ ],+ "metadata": {+ "id": "NEUciNquON9_"+ }},{"cell_type": "markdown",- "metadata": {- "id": "6f64VOMMP93d"- },"source": ["Dappier is a powerful tool that connects LLMs to real-time, rights-cleared data from trusted sources, specializing in domains like web search, finance, and news. It delivers enriched, prompt-ready data, empowering AI with verified and up-to-date information for diverse applications. In this section, we will search for the latest news related to CAMEL AI as an example."- ]+ ],+ "metadata": {+ "id": "6f64VOMMP93d"+ }},{"cell_type": "code",- "execution_count": null,+ "source": [+ "from camel.toolkits import DappierToolkit\n",+ "\n",+ "# Search for real time data from a given user query.\n",+ "response = DappierToolkit().search_real_time_data(\n",+ " query=\"latest news on CAMEL AI\"\n",+ ")\n",+ "\n",+ "print(response)"+ ],"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "fXgapEEE3oW3",- "outputId": "a504ce38-02f5-40db-d189-480536171e25"+ "outputId": "693fe479-883c-4717-eb95-b84b741563d8"},+ "execution_count": 8,"outputs": [{- "name": "stdout","output_type": "stream",+ "name": "stdout","text": [- "Hereโs the latest buzz on CAMEL AI! ๐ซโจ\n",+ "Here's the latest on CAMEL AI:\n","\n",- "- At **AdventureX2024**, CAMEL AI clinched **first prize** in the Graph Track! ๐ \n",- "- Theyโve launched some cool new tools, including a **Discord bot** with RAG, **Redis cache storage**, and **Docker support** for code execution! ๐ ๏ธ\n",- "- CAMEL AI has open-sourced **OASIS**, a next-gen simulator that can handle realistic social media dynamics with up to **one million agents**! ๐\n",- "- Theyโve integrated **OpenAI's o1 models** into their framework, enhancing multi-agent capabilities. ๐ค\n",- "- Plus, they introduced a **Multi-Agent Collaboration Workforce** module, boosting cooperation among agents! ๐ค\n",+ "- **New Integrations:** CAMEL AI has rolled out new AI integrations and tools aimed at improving functionality and collaboration. ๐\n",+ "- **OASIS Simulator:** They've open-sourced OASIS, a next-gen simulator for realistic social media dynamics, capable of handling one million agents! ๐\n",+ "- **NeurIPS 2024:** Exciting news as three papers from CAMEL AI will be featured at NeurIPS 2024, focusing on enhancing autonomous cooperation among communicative agents. ๐\n",+ "- **Data Analyst Tool:** CAMEL AI is also making waves as an AI-powered data analyst for business intelligence, allowing users to connect various data sources and ask complex questions. ๐\n","\n",- "For more updates, check out their Discord: [CAMEL AI Discord](http://discord.camel-ai.org). Exciting stuff happening! ๐\n"+ "Stay tuned for more updates!\n"]}- ],- "source": [- "from camel.toolkits import DappierToolkit\n",- "\n",- "# Search for real time data from a given user query.\n",- "response = DappierToolkit().search_real_time_data(\n",- " query=\"latest news on CAMEL AI\"\n",- ")\n",- "\n",- "print(response)"]},{"cell_type": "markdown",- "metadata": {- "id": "PRn-hsCQ7cHv"- },"source": ["๐ **Dappier effortlessly retrieves the latest news on CAMEL AI, providing valuable data for AI integration!**"- ]+ ],+ "metadata": {+ "id": "PRn-hsCQ7cHv"+ }},{"cell_type": "markdown",- "metadata": {- "id": "9NZobuj6-LFx"- },"source": ["## ๐ค๐ค Multi-Agent Role-Playing with CAMEL"- ]+ ],+ "metadata": {+ "id": "9NZobuj6-LFx"+ }},{"cell_type": "markdown",- "metadata": {- "id": "DFs8i4DJ-PqN"- },"source": ["*This section sets up a role-playing session where AI agents interact to accomplish a task using Dappier tool. We will guide the assistant agent in creating a dynamic travel plan by leveraging real-time weather data.*"- ]+ ],+ "metadata": {+ "id": "DFs8i4DJ-PqN"+ }},{"cell_type": "code",- "execution_count": null,- "metadata": {- "id": "mOSZuWYs_dDR"- },- "outputs": [],"source": ["from typing import List\n","\n",@@ -384,51 +392,60 @@"from camel.societies import RolePlaying\n","from camel.toolkits import FunctionTool\n","from camel.utils import print_text_animated"- ]+ ],+ "metadata": {+ "id": "mOSZuWYs_dDR"+ },+ "execution_count": 9,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "C8hxNGZW_p2R"- },"source": ["Defining the Task Prompt"- ]+ ],+ "metadata": {+ "id": "C8hxNGZW_p2R"+ }},{"cell_type": "code",- "execution_count": null,+ "source": [+ "task_prompt = \"\"\"Generate a 2-day travel itinerary for New York City, tailored to the real-time weather forecast for the upcoming weekend. Follow these steps:\n",+ "\n",+ "Determine Current Date and Weekend:\n",+ "Use Dappier's real-time search to identify the current date and day. Calculate the dates of the upcoming weekend based on this information.\n",+ "\n",+ "Fetch Weather Data:\n",+ "Retrieve the weather forecast for the identified weekend dates to understand the conditions for each day.\n",+ "\n",+ "Design the Itinerary:\n",+ "Use the weather insights to plan activities and destinations that suit the expected conditions. For each suggested location:\n",+ "\n",+ "Verify whether it is free to visit or requires advance booking.\n",+ "Check current traffic conditions to estimate travel times and feasibility.\n",+ "Output:\n",+ "Present a detailed 2-day itinerary, including timing, activities, and travel considerations. Ensure the plan is optimized for convenience and enjoyment.\n",+ "\"\"\""+ ],"metadata": {"id": "mXq5H58M_r4d"},- "outputs": [],- "source": [- "task_prompt = \"\"\"Generate a 2-day travel itinerary for New York tailored to the\n",- "real-time weather forecast for the upcoming weekend. Start by utilizing\n",- "Dappierโs real-time search to determine the current date and day, calculate the\n",- "upcoming weekend based on this information, and fetch the corresponding weather\n",- "data for those dates. Use the weather insights to craft the itinerary.\n",- "No additional actions are required.\n",- "\"\"\""- ]+ "execution_count": 10,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "E7oQL_6wBj5u"- },"source": ["We will configure the assistant agent with tools for real-time weather data\n","retrieval."- ]+ ],+ "metadata": {+ "id": "E7oQL_6wBj5u"+ }},{"cell_type": "code",- "execution_count": null,- "metadata": {- "id": "ZtFN7wXtBz7u"- },- "outputs": [],"source": ["dappier_tool = FunctionTool(DappierToolkit().search_real_time_data)\n","\n",@@ -440,36 +457,24 @@" tools=tool_list,\n"," temperature=0.0,\n",")"- ]+ ],+ "metadata": {+ "id": "ZtFN7wXtBz7u"+ },+ "execution_count": 11,+ "outputs": []},{"cell_type": "markdown",- "metadata": {- "id": "2x6WJY_wCZa7"- },"source": ["Setting Up the Role-Playing Session"- ]+ ],+ "metadata": {+ "id": "2x6WJY_wCZa7"+ }},{"cell_type": "code",- "execution_count": null,- "metadata": {- "colab": {- "base_uri": "https://localhost:8080/"- },- "id": "YqaaY5osCb4u",- "outputId": "d1ec8945-fd42-4523-bfa8-091dac1ab853"- },- "outputs": [- {- "name": "stderr",- "output_type": "stream",- "text": [- "WARNING:camel.agents.chat_agent:Overriding the configured tools in `BaseModelBackend` with the tools from `ChatAgent`.\n"- ]- }- ],"source": ["# Initialize the role-playing session\n","role_play_session = RolePlaying(\n",@@ -487,545 +492,426 @@" task_prompt=task_prompt,\n"," with_task_specify=False,\n",")"+ ],+ "metadata": {+ "colab": {+ "base_uri": "https://localhost:8080/"+ },+ "id": "YqaaY5osCb4u",+ "outputId": "72654dc0-7bbb-4e35-ed06-ddb8221e697c"+ },+ "execution_count": 12,+ "outputs": [+ {+ "output_type": "stream",+ "name": "stderr",+ "text": [+ "WARNING:camel.agents.chat_agent:Overriding the configured tools in `BaseModelBackend` with the tools from `ChatAgent`.\n"+ ]+ }]},{"cell_type": "markdown",- "metadata": {- "id": "-mwTkCTSC3jX"- },"source": ["Print the system message and task prompt"- ]+ ],+ "metadata": {+ "id": "-mwTkCTSC3jX"+ }},{"cell_type": "code",- "execution_count": null,+ "source": [+ "# Print system and task messages\n",+ "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\")"+ ],"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "c7accbo3DAak",- "outputId": "5e7f1d4a-6874-4e3e-c41d-477e92269043"+ "outputId": "22998589-fbef-46dd-ea51-8c1a3e85a492"},+ "execution_count": 13,"outputs": [{- "name": "stdout","output_type": "stream",+ "name": "stdout","text": ["\u001b[32mAI Assistant sys message:\n",- "BaseMessage(role_name='CAMEL Assistant', role_type=<RoleType.ASSISTANT: 'assistant'>, meta_dict={'task': 'Create a 2-day travel itinerary for New York based on real-time\\nweather data for the upcoming weekend. Use Dappierโs real-time search to gather\\nrelevant weather information, and then generate the itinerary using the data.\\nNo further actions are needed.', 'assistant_role': 'CAMEL Assistant', 'user_role': 'CAMEL User'}, content='===== RULES OF ASSISTANT =====\\nNever forget you are a CAMEL Assistant and I am a CAMEL User. 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: Create a 2-day travel itinerary for New York based on real-time\\nweather data for the upcoming weekend. Use Dappierโs real-time search to gather\\nrelevant weather information, and then generate the itinerary using the data.\\nNo further actions are needed.. 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', parsed=None)\n",+ "BaseMessage(role_name='CAMEL Assistant', role_type=<RoleType.ASSISTANT: 'assistant'>, meta_dict={'task': \"Generate a 2-day travel itinerary for New York City, tailored to the real-time weather forecast for the upcoming weekend. Follow these steps:\\n\\nDetermine Current Date and Weekend:\\nUse Dappier's real-time search to identify the current date and day. Calculate the dates of the upcoming weekend based on this information.\\n\\nFetch Weather Data:\\nRetrieve the weather forecast for the identified weekend dates to understand the conditions for each day.\\n\\nDesign the Itinerary:\\nUse the weather insights to plan activities and destinations that suit the expected conditions. For each suggested location:\\n\\nVerify whether it is free to visit or requires advance booking.\\nCheck current traffic conditions to estimate travel times and feasibility.\\nOutput:\\nPresent a detailed 2-day itinerary, including timing, activities, and travel considerations. Ensure the plan is optimized for convenience and enjoyment.\\n\", 'assistant_role': 'CAMEL Assistant', 'user_role': 'CAMEL User'}, content=\"===== RULES OF ASSISTANT =====\\nNever forget you are a CAMEL Assistant and I am a CAMEL User. 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: Generate a 2-day travel itinerary for New York City, tailored to the real-time weather forecast for the upcoming weekend. Follow these steps:\\n\\nDetermine Current Date and Weekend:\\nUse Dappier's real-time search to identify the current date and day. Calculate the dates of the upcoming weekend based on this information.\\n\\nFetch Weather Data:\\nRetrieve the weather forecast for the identified weekend dates to understand the conditions for each day.\\n\\nDesign the Itinerary:\\nUse the weather insights to plan activities and destinations that suit the expected conditions. For each suggested location:\\n\\nVerify whether it is free to visit or requires advance booking.\\nCheck current traffic conditions to estimate travel times and feasibility.\\nOutput:\\nPresent a detailed 2-day itinerary, including timing, activities, and travel considerations. Ensure the plan is optimized for convenience and enjoyment.\\n. 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', parsed=None)\n","\n","\u001b[34mAI User sys message:\n",- "BaseMessage(role_name='CAMEL User', role_type=<RoleType.USER: 'user'>, meta_dict={'task': 'Create a 2-day travel itinerary for New York based on real-time\\nweather data for the upcoming weekend. Use Dappierโs real-time search to gather\\nrelevant weather information, and then generate the itinerary using the data.\\nNo further actions are needed.', 'assistant_role': 'CAMEL Assistant', 'user_role': 'CAMEL User'}, content='===== RULES OF USER =====\\nNever forget you are a CAMEL User and I am a CAMEL Assistant. Never flip roles! You will always instruct me.\\nWe share a common interest in collaborating to successfully complete a task.\\nI must help you to complete the task.\\nHere is the task: Create a 2-day travel itinerary for New York based on real-time\\nweather data for the upcoming weekend. Use Dappierโs real-time search to gather\\nrelevant weather information, and then generate the itinerary using the data.\\nNo further actions are needed.. Never forget our task!\\nYou must instruct me based on my expertise and your needs to solve the task ONLY in the following two ways:\\n\\n1. Instruct with a necessary input:\\nInstruction: <YOUR_INSTRUCTION>\\nInput: <YOUR_INPUT>\\n\\n2. Instruct without any input:\\nInstruction: <YOUR_INSTRUCTION>\\nInput: None\\n\\nThe \"Instruction\" describes a task or question. The paired \"Input\" provides further context or information for the requested \"Instruction\".\\n\\nYou must give me one instruction at a time.\\nI must write a response that appropriately solves the requested instruction.\\nI must decline your instruction honestly if I cannot perform the instruction due to physical, moral, legal reasons or my capability and explain the reasons.\\nYou should instruct me not ask me questions.\\nNow you must start to instruct me using the two ways described above.\\nDo not add anything else other than your instruction and the optional corresponding input!\\nKeep giving me instructions and necessary inputs until you think the task is completed.\\nWhen the task is completed, you must only reply with a single word <CAMEL_TASK_DONE>.\\nNever say <CAMEL_TASK_DONE> unless my responses have solved your task.', video_bytes=None, image_list=None, image_detail='auto', video_detail='low', parsed=None)\n",+ "BaseMessage(role_name='CAMEL User', role_type=<RoleType.USER: 'user'>, meta_dict={'task': \"Generate a 2-day travel itinerary for New York City, tailored to the real-time weather forecast for the upcoming weekend. Follow these steps:\\n\\nDetermine Current Date and Weekend:\\nUse Dappier's real-time search to identify the current date and day. Calculate the dates of the upcoming weekend based on this information.\\n\\nFetch Weather Data:\\nRetrieve the weather forecast for the identified weekend dates to understand the conditions for each day.\\n\\nDesign the Itinerary:\\nUse the weather insights to plan activities and destinations that suit the expected conditions. For each suggested location:\\n\\nVerify whether it is free to visit or requires advance booking.\\nCheck current traffic conditions to estimate travel times and feasibility.\\nOutput:\\nPresent a detailed 2-day itinerary, including timing, activities, and travel considerations. Ensure the plan is optimized for convenience and enjoyment.\\n\", 'assistant_role': 'CAMEL Assistant', 'user_role': 'CAMEL User'}, content='===== RULES OF USER =====\\nNever forget you are a CAMEL User and I am a CAMEL Assistant. Never flip roles! You will always instruct me.\\nWe share a common interest in collaborating to successfully complete a task.\\nI must help you to complete the task.\\nHere is the task: Generate a 2-day travel itinerary for New York City, tailored to the real-time weather forecast for the upcoming weekend. Follow these steps:\\n\\nDetermine Current Date and Weekend:\\nUse Dappier\\'s real-time search to identify the current date and day. Calculate the dates of the upcoming weekend based on this information.\\n\\nFetch Weather Data:\\nRetrieve the weather forecast for the identified weekend dates to understand the conditions for each day.\\n\\nDesign the Itinerary:\\nUse the weather insights to plan activities and destinations that suit the expected conditions. For each suggested location:\\n\\nVerify whether it is free to visit or requires advance booking.\\nCheck current traffic conditions to estimate travel times and feasibility.\\nOutput:\\nPresent a detailed 2-day itinerary, including timing, activities, and travel considerations. Ensure the plan is optimized for convenience and enjoyment.\\n. Never forget our task!\\nYou must instruct me based on my expertise and your needs to solve the task ONLY in the following two ways:\\n\\n1. Instruct with a necessary input:\\nInstruction: <YOUR_INSTRUCTION>\\nInput: <YOUR_INPUT>\\n\\n2. Instruct without any input:\\nInstruction: <YOUR_INSTRUCTION>\\nInput: None\\n\\nThe \"Instruction\" describes a task or question. The paired \"Input\" provides further context or information for the requested \"Instruction\".\\n\\nYou must give me one instruction at a time.\\nI must write a response that appropriately solves the requested instruction.\\nI must decline your instruction honestly if I cannot perform the instruction due to physical, moral, legal reasons or my capability and explain the reasons.\\nYou should instruct me not ask me questions.\\nNow you must start to instruct me using the two ways described above.\\nDo not add anything else other than your instruction and the optional corresponding input!\\nKeep giving me instructions and necessary inputs until you think the task is completed.\\nWhen the task is completed, you must only reply with a single word <CAMEL_TASK_DONE>.\\nNever say <CAMEL_TASK_DONE> unless my responses have solved your task.', video_bytes=None, image_list=None, image_detail='auto', video_detail='low', parsed=None)\n","\n","\u001b[33mOriginal task prompt:\n",- "Create a 2-day travel itinerary for New York based on real-time\n",- "weather data for the upcoming weekend. Use Dappierโs real-time search to gather\n",- "relevant weather information, and then generate the itinerary using the data.\n",- "No further actions are needed.\n",- "\n",- "\u001b[36mSpecified task prompt:\n",- "None\n",- "\n",- "\u001b[31mFinal task prompt:\n",- "Create a 2-day travel itinerary for New York based on real-time\n",- "weather data for the upcoming weekend. Use Dappierโs real-time search to gather\n",- "relevant weather information, and then generate the itinerary using the data.\n",- "No further actions are needed.\n",+ "Generate a 2-day travel itinerary for New York City, tailored to the real-time weather forecast for the upcoming weekend. Follow these steps:\n",+ "\n",+ "Determine Current Date and Weekend:\n",+ "Use Dappier's real-time search to identify the current date and day. Calculate the dates of the upcoming weekend based on this information.\n",+ "\n",+ "Fetch Weather Data:\n",+ "Retrieve the weather forecast for the identified weekend dates to understand the conditions for each day.\n",+ "\n",+ "Design the Itinerary:\n",+ "Use the weather insights to plan activities and destinations that suit the expected conditions. For each suggested location:\n",+ "\n",+ "Verify whether it is free to visit or requires advance booking.\n",+ "Check current traffic conditions to estimate travel times and feasibility.\n",+ "Output:\n",+ "Present a detailed 2-day itinerary, including timing, activities, and travel considerations. Ensure the plan is optimized for convenience and enjoyment.\n",+ "\n","\n"]}- ],- "source": [- "# Print system and task messages\n",- "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": "u7J8cx0HDQ--"- },"source": ["Set the termination rule and start the interaction between agents\n","\n",- "**NOTE**: This session will take approximately 5 minutes and will consume around 60k tokens by using GPT4o-mini."- ]+ "**NOTE**: This session will take approximately 6 minutes and will consume around 60k tokens by using GPT4o-mini."+ ],+ "metadata": {+ "id": "u7J8cx0HDQ--"+ }},{"cell_type": "code",- "execution_count": null,+ "source": [+ "n = 0\n",+ "input_msg = role_play_session.init_chat()\n",+ "while n < 20: # Limit the chat to 20 turns\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",+ " # Print output from the user\n",+ " print_text_animated(\n",+ " Fore.BLUE + f\"AI User:\\n\\n{user_response.msg.content}\\n\",\n",+ " 0.01\n",+ " )\n",+ "\n",+ " if \"CAMEL_TASK_DONE\" in user_response.msg.content:\n",+ " break\n",+ "\n",+ " # Print output from the assistant, including any function\n",+ " # execution information\n",+ " print_text_animated(Fore.GREEN + \"AI Assistant:\", 0.01)\n",+ " tool_calls: List[FunctionCallingRecord] = [\n",+ " FunctionCallingRecord(**call.as_dict())\n",+ " for call in assistant_response.info['tool_calls']\n",+ " ]\n",+ " for func_record in tool_calls:\n",+ " print_text_animated(f\"{func_record}\", 0.01)\n",+ " print_text_animated(f\"{assistant_response.msg.content}\\n\", 0.01)\n",+ "\n",+ " input_msg = assistant_response.msg"+ ],"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "09ZV5DDLDS8O",- "outputId": "621a2863-3462-48bd-d56f-bd3ad3cb3470"+ "outputId": "b6987ac4-7ae8-4c59-aea2-5c62d6b866be"},+ "execution_count": 14,"outputs": [{- "name": "stdout","output_type": "stream",+ "name": "stdout","text": ["\u001b[34mAI User:\n","\n",- "Instruction: Gather real-time weather data for New York for the upcoming weekend using Dappierโs real-time search. \n",+ "Instruction: Determine the current date and day. \n","Input: None\n","\u001b[32mAI Assistant:Function Execution: search_real_time_data\n",- "\tArgs: {'query': 'New York weather forecast for the upcoming weekend', 'ai_model_id': 'am_01j06ytn18ejftedz6dyhz2b15'}\n",- "\tResult: This weekend in New York City, expect sunny skies in the morning on Saturday, turning overcast by the afternoon. The high will be around **39ยฐF** with WNW winds at **10 to 15 mph**. Perfect for a cozy day indoors or a brisk walk outside! โ๏ธโ๏ธSolution: I have gathered the real-time weather data for New York City for the upcoming weekend. Here are the details:\n",- "\n",- "- **Saturday**: Expect sunny skies in the morning, turning overcast by the afternoon. The high will be around **39ยฐF** with WNW winds at **10 to 15 mph**. This weather is perfect for a cozy day indoors or a brisk walk outside.\n",+ "\tArgs: {'query': 'What is the current date and day?', 'ai_model_id': 'am_01j06ytn18ejftedz6dyhz2b15'}\n",+ "\tResult: It's Tuesday, January 14, 2025! ๐Solution: The current date is Tuesday, January 14, 2025. \n","\n","Next request.\n","\u001b[34mAI User:\n","\n",- "Instruction: Based on the weather data for Saturday, create a list of recommended activities for that day in New York City. \n",+ "Instruction: Calculate the dates of the upcoming weekend (Saturday and Sunday) based on the current date. \n","Input: None\n",- "\u001b[32mAI Assistant:Solution: Based on the weather data for Saturday in New York City, here are some recommended activities:\n",+ "\u001b[32mAI Assistant:Solution: Since today is Tuesday, January 14, 2025, the upcoming weekend will be:\n","\n",- "1. **Visit a Museum**: \n",- " - **The Metropolitan Museum of Art**: Explore world-class art collections indoors.\n",- " - **American Museum of Natural History**: Perfect for families and offers fascinating exhibits.\n",- "\n",- "2. **Indoor Shopping**:\n",- " - **Westfield World Trade Center**: Enjoy shopping and dining in a beautiful indoor space.\n",- " - **Macy's Herald Square**: One of the largest department stores in the world.\n",- "\n",- "3. **Cafรฉ Hopping**:\n",- " - Spend the afternoon in cozy cafรฉs like **Stumptown Coffee Roasters** or **Blue Bottle Coffee** to enjoy warm drinks and pastries.\n",- "\n",- "4. **Catch a Broadway Show**:\n",- " - Check for matinee performances and enjoy a world-class theater experience.\n",- "\n",- "5. **Visit the High Line**:\n",- " - If you prefer some outdoor activity, take a brisk walk on the High Line, an elevated park with beautiful views, but dress warmly!\n",- "\n",- "6. **Explore Indoor Markets**:\n",- " - **Chelsea Market**: A great place to sample various foods and shop for unique items.\n",- "\n",- "7. **Art Galleries in Chelsea**:\n",- " - Explore the numerous art galleries in the Chelsea neighborhood, which are mostly indoors and free to visit.\n",- "\n",- "These activities will allow you to enjoy the day while staying warm and comfortable. \n",+ "- Saturday: January 18, 2025\n",+ "- Sunday: January 19, 2025\n","\n","Next request.\n","\u001b[34mAI User:\n","\n",- "Instruction: Create a list of recommended activities for Sunday based on the weather data for New York City. \n",+ "Instruction: Fetch the weather forecast for January 18 and January 19, 2025, in New York City. \n","Input: None\n","\u001b[32mAI Assistant:Function Execution: search_real_time_data\n",- "\tArgs: {'query': 'New York weather forecast for Sunday', 'ai_model_id': 'am_01j06ytn18ejftedz6dyhz2b15'}\n",- "\tResult: This Sunday in New York, expect partly cloudy skies with a high of around **29ยฐF**. Itโll be a bit windy, with WNW winds at **20 to 30 mph**, and gusts could reach over **40 mph**! ๐ฌ๏ธโ๏ธ The low will drop to about **24ยฐF**. Definitely a chilly day, so make sure to bundle up if youโre heading out! ๐งฃ๐งคSolution: Based on the weather data for Sunday in New York City, here are some recommended activities:\n",- "\n",- "1. **Visit Indoor Attractions**:\n",- " - **The Museum of Modern Art (MoMA)**: Enjoy contemporary art in a warm indoor setting.\n",- " - **The Intrepid Sea, Air & Space Museum**: Explore this fascinating museum located on an aircraft carrier.\n",- "\n",- "2. **Enjoy a Cozy Brunch**:\n",- " - Find a warm cafรฉ or restaurant for brunch. Consider places like **Balthazar** in SoHo or **Sarabeth's** for a delightful meal.\n",- "\n",- "3. **Indoor Ice Skating**:\n",- " - **The Rink at Rockefeller Center**: Experience ice skating in a famous location, but be sure to dress warmly!\n",- "\n",- "4. **Explore Grand Central Terminal**:\n",- " - Visit this iconic landmark, enjoy the architecture, and grab a bite at the food market inside.\n",- "\n",- "5. **Attend a Live Performance**:\n",- " - Check for indoor concerts or performances at venues like **Carnegie Hall** or **The Apollo Theater**.\n",- "\n",- "6. **Visit a Spa or Wellness Center**:\n",- " - Treat yourself to a spa day at places like **The Spa at Mandarin Oriental** or **AIRE Ancient Baths** to relax and warm up.\n",- "\n",- "7. **Catch a Movie**:\n",- " - Spend the afternoon at a cozy cinema like **Alamo Drafthouse** or **Angelika Film Center** to enjoy a film in a warm environment.\n",- "\n",- "Given the chilly temperatures and windy conditions, these activities will keep you warm and entertained throughout the day.\n",- "\n",- "Next request.\n",- "\u001b[34mAI User:\n",- "\n",- "Instruction: Compile the 2-day travel itinerary for New York City, including the activities for both Saturday and Sunday based on the weather data. \n",- "Input: None\n",- "\u001b[32mAI Assistant:Solution: Here is the compiled 2-day travel itinerary for New York City based on the weather data for the upcoming weekend:\n",+ "\tArgs: {'query': 'Weather forecast for New York City on January 18 and January 19, 2025', 'ai_model_id': 'am_01j06ytn18ejftedz6dyhz2b15'}\n",+ "\tResult: Here's the weather forecast for New York City on January 18 and 19, 2025:\n","\n",- "### **Saturday Itinerary**\n",+ "- **January 18 (Saturday):** High of 36ยฐF with drizzle expected. ๐ง๏ธ\n",+ "- **January 19 (Sunday):** High of 39ยฐF, mostly overcast. โ๏ธ\n","\n",- "- **Morning**:\n",- " - **Visit a Museum**: Start your day at **The Metropolitan Museum of Art** or the **American Museum of Natural History** to enjoy the art and exhibits indoors.\n",+ "Make sure to bundle up! ๐งฃ๐งคSolution: The weather forecast for New York City on the upcoming weekend is as follows:\n","\n",- "- **Lunch**:\n",- " - **Cafรฉ Hopping**: Enjoy lunch at a cozy cafรฉ like **Stumptown Coffee Roasters** or **Blue Bottle Coffee**.\n",+ "- **January 18 (Saturday):** High of 36ยฐF with drizzle expected. ๐ง๏ธ\n",+ "- **January 19 (Sunday):** High of 39ยฐF, mostly overcast. โ๏ธ\n","\n",- "- **Afternoon**:\n",- " - **Indoor Shopping**: Head to **Westfield World Trade Center** for shopping and dining.\n",- " - **Catch a Broadway Show**: Look for matinee performances to enjoy a world-class theater experience.\n",- "\n",- "- **Evening**:\n",- " - **Explore Indoor Markets**: Visit **Chelsea Market** for dinner and to sample various foods.\n",- " - **Optional**: If you prefer some outdoor activity, take a brisk walk on the High Line, but dress warmly!\n",- "\n",- "### **Sunday Itinerary**\n",- "\n",- "- **Morning**:\n",- " - **Enjoy a Cozy Brunch**: Start your day with brunch at **Balthazar** in SoHo or **Sarabeth's**.\n",- "\n",- "- **Late Morning to Afternoon**:\n",- " - **Visit Indoor Attractions**: Explore **The Museum of Modern Art (MoMA)** or **The Intrepid Sea, Air & Space Museum** to stay warm.\n",- "\n",- "- **Lunch**:\n",- " - **Indoor Ice Skating**: Head to **The Rink at Rockefeller Center** for some ice skating fun.\n",- "\n",- "- **Afternoon**:\n",- " - **Explore Grand Central Terminal**: Visit this iconic landmark and enjoy the architecture and food market.\n",- "\n",- "- **Evening**:\n",- " - **Attend a Live Performance**: Check for indoor concerts or performances at venues like **Carnegie Hall** or **The Apollo Theater**.\n",- " - **Optional**: Treat yourself to a spa day or catch a movie at **Alamo Drafthouse** or **Angelika Film Center**.\n",- "\n",- "This itinerary provides a mix of indoor and outdoor activities while considering the weather conditions, ensuring a comfortable and enjoyable weekend in New York City.\n",+ "It's advisable to dress warmly due to the cold temperatures and potential drizzle on Saturday.\n","\n","Next request.\n","\u001b[34mAI User:\n","\n",- "Instruction: Review the itinerary for any potential adjustments or improvements based on the weather data and activities planned. \n",+ "Instruction: Design a 2-day itinerary for New York City on January 18 and January 19, 2025, considering the weather conditions. \n","Input: None\n",- "\u001b[32mAI Assistant:Solution: Upon reviewing the itinerary for the weekend in New York City, here are some potential adjustments and improvements based on the weather data and planned activities:\n",- "\n",- "### **Saturday Adjustments**\n",- "- **Morning Museum Visit**: Since the weather is sunny in the morning, consider starting your day earlier to enjoy the outdoor surroundings of the museums before heading inside.\n",+ "\u001b[32mAI Assistant:Solution: Hereโs a 2-day itinerary for New York City on January 18 and January 19, 2025, tailored to the weather conditions:\n",+ "\n",+ "### Day 1: Saturday, January 18, 2025\n",+ "**Weather:** High of 36ยฐF with drizzle expected.\n",+ "\n",+ "**Morning:**\n",+ "- **10:00 AM - Visit the American Museum of Natural History**\n",+ " - **Details:** Explore the fascinating exhibits indoors, perfect for a chilly, drizzly day.\n",+ " - **Cost:** Admission is suggested donation; check for any special exhibits that may require tickets.\n",+ " - **Travel Consideration:** Take the subway to 81st St - Museum of Natural History (1 train).\n",+ "\n",+ "**Lunch:**\n",+ "- **12:30 PM - Lunch at Shake Shack (near the museum)**\n",+ " - **Details:** Enjoy a warm burger and fries. Indoor seating available.\n",+ "\n",+ "**Afternoon:**\n",+ "- **2:00 PM - Explore the Metropolitan Museum of Art**\n",+ " - **Details:** Another indoor activity, with vast collections to explore.\n",+ " - **Cost:** Suggested admission; check for any special exhibits.\n",+ " - **Travel Consideration:** A short walk or a quick subway ride (take the 4, 5, or 6 train to 86th St).\n",+ "\n",+ "**Evening:**\n",+ "- **5:00 PM - Dinner at a nearby restaurant (e.g., The Modern)**\n",+ " - **Details:** Enjoy a warm meal. Reservations recommended.\n"," \n",- "- **Indoor Shopping**: If the weather turns overcast in the afternoon, it might be a good idea to shift some shopping to the morning after the museum visit, allowing for a more leisurely afternoon indoors.\n",- "\n",- "- **Broadway Show**: Ensure to book tickets in advance for the matinee show to avoid disappointment, as popular shows can sell out quickly.\n",- "\n",- "### **Sunday Adjustments**\n",- "- **Brunch Timing**: Given the cold and windy conditions, consider having brunch at a place that offers a warm and cozy atmosphere. Reservations may be beneficial to avoid long waits.\n",- "\n",- "- **Indoor Attractions**: Since the high is only around 29ยฐF and it will be windy, prioritize indoor activities. You might want to spend more time at the **Museum of Modern Art (MoMA)** or **The Intrepid Sea, Air & Space Museum** and reduce time spent outdoors.\n",- "\n",- "- **Ice Skating**: If the wind is particularly strong, consider skipping the ice skating if it feels too cold. Instead, you could extend your visit to the museums or enjoy a leisurely afternoon at a cafรฉ.\n",- "\n",- "- **Evening Performance**: Check the schedule for live performances in advance and consider booking tickets to ensure you have a spot, especially since it will be a chilly evening.\n",- "\n",- "### **General Tips**\n",- "- **Dress Warmly**: Remind yourself to dress in layers and wear warm clothing, especially for outdoor activities.\n",- "- **Stay Hydrated and Nourished**: Plan to take breaks for warm drinks and snacks throughout the day to keep your energy up.\n",- "\n",- "These adjustments will help ensure a more comfortable and enjoyable experience while taking into account the weather conditions throughout the weekend.\n",- "\n",- "Next request.\n",- "\u001b[34mAI User:\n",- "\n",- "Instruction: Finalize the 2-day travel itinerary for New York City, incorporating the adjustments and improvements made. \n",- "Input: None\n",- "\u001b[32mAI Assistant:Solution: Here is the finalized 2-day travel itinerary for New York City, incorporating the adjustments and improvements based on the weather data and planned activities:\n",- "\n",- "### **Saturday Itinerary**\n",- "\n",- "- **Morning**:\n",- " - **Visit a Museum**: Start your day early at **The Metropolitan Museum of Art** or the **American Museum of Natural History**. Enjoy the outdoor surroundings before heading inside.\n",- "\n",- "- **Late Morning**:\n",- " - **Indoor Shopping**: After the museum, head to **Westfield World Trade Center** for shopping and dining. This will allow you to stay warm as the weather turns overcast.\n",- "\n",- "- **Lunch**:\n",- " - **Cafรฉ Hopping**: Enjoy lunch at a cozy cafรฉ like **Stumptown Coffee Roasters** or **Blue Bottle Coffee**.\n",- "\n",- "- **Afternoon**:\n",- " - **Catch a Broadway Show**: Look for matinee performances and book tickets in advance to enjoy a world-class theater experience.\n",- "\n",- "- **Evening**:\n",- " - **Explore Indoor Markets**: Visit **Chelsea Market** for dinner and to sample various foods.\n",- " - **Optional**: If you feel up for it, take a brisk walk on the High Line, but dress warmly!\n",- "\n",- "### **Sunday Itinerary**\n",- "\n",- "- **Morning**:\n",- " - **Enjoy a Cozy Brunch**: Start your day with brunch at **Balthazar** in SoHo or **Sarabeth's**. Make reservations to avoid long waits.\n",- "\n",- "- **Late Morning to Afternoon**:\n",- " - **Visit Indoor Attractions**: Spend the day at **The Museum of Modern Art (MoMA)** or **The Intrepid Sea, Air & Space Museum** to stay warm and enjoy fascinating exhibits.\n",- "\n",- "- **Lunch**:\n",- " - **Indoor Ice Skating**: If the wind is manageable, head to **The Rink at Rockefeller Center** for some ice skating fun. If it feels too cold, consider extending your museum visit or enjoying a leisurely afternoon at a cafรฉ.\n",- "\n",- "- **Afternoon**:\n",- " - **Explore Grand Central Terminal**: Visit this iconic landmark, enjoy the architecture, and grab a bite at the food market inside.\n",- "\n",- "- **Evening**:\n",- " - **Attend a Live Performance**: Check for indoor concerts or performances at venues like **Carnegie Hall** or **The Apollo Theater**. Book tickets in advance to ensure a spot.\n",- " - **Optional**: Treat yourself to a spa day or catch a movie at **Alamo Drafthouse** or **Angelika Film Center** to end the weekend on a relaxing note.\n",- "\n",- "This finalized itinerary provides a well-rounded experience while considering the weather conditions, ensuring a comfortable and enjoyable weekend in New York City.\n",- "\n",- "Next request.\n",- "\u001b[34mAI User:\n",+ "- **7:00 PM - Broadway Show**\n",+ " - **Details:** Catch a show in the Theater District. Book tickets in advance.\n",+ " - **Travel Consideration:** Take a taxi or subway to Times Square.\n",+ "\n",+ "### Day 2: Sunday, January 19, 2025\n",+ "**Weather:** High of 39ยฐF, mostly overcast.\n",+ "\n",+ "**Morning:**\n",+ "- **10:00 AM - Visit the High Line**\n",+ " - **Details:** A beautiful elevated park; dress warmly as it can be breezy.\n",+ " - **Cost:** Free to visit.\n",+ " - **Travel Consideration:** Take the subway to 14th St (A, C, E trains).\n",+ "\n",+ "**Lunch:**\n",+ "- **12:00 PM - Lunch at Chelsea Market**\n",+ " - **Details:** A variety of food options in an indoor market setting.\n",+ "\n",+ "**Afternoon:**\n",+ "- **1:30 PM - Visit the Whitney Museum of American Art**\n",+ " - **Details:** Explore contemporary American art indoors.\n",+ " - **Cost:** Admission fee; check for any special exhibits.\n",+ " - **Travel Consideration:** A short walk from Chelsea Market.\n",+ "\n",+ "**Evening:**\n",+ "- **4:00 PM - Stroll through Central Park (weather permitting)**\n",+ " - **Details:** Enjoy the park's beauty; dress warmly.\n",+ " \n",+ "- **6:00 PM - Dinner at a cozy restaurant (e.g., The Smith)**\n",+ " - **Details:** Enjoy a warm meal to end your trip. Reservations recommended.\n","\n",- "Instruction: Prepare a summary of the finalized 2-day travel itinerary for New York City, highlighting key activities and weather considerations. \n",- "Input: None\n",- "\u001b[32mAI Assistant:Solution: Here is a summary of the finalized 2-day travel itinerary for New York City, highlighting key activities and weather considerations:\n",- "\n",- "### **2-Day Travel Itinerary Summary for New York City**\n",- "\n",- "#### **Saturday**\n",- "- **Weather**: Sunny in the morning, overcast by afternoon, high around 39ยฐF.\n",- "- **Key Activities**:\n",- " - **Morning**: Visit **The Metropolitan Museum of Art** or **American Museum of Natural History**. Enjoy the outdoor surroundings before heading inside.\n",- " - **Late Morning**: Indoor shopping at **Westfield World Trade Center**.\n",- " - **Lunch**: Cozy cafรฉ experience at **Stumptown Coffee Roasters** or **Blue Bottle Coffee**.\n",- " - **Afternoon**: Attend a matinee Broadway show (book tickets in advance).\n",- " - **Evening**: Dinner at **Chelsea Market** and optional brisk walk on the High Line (dress warmly).\n",- "\n",- "#### **Sunday**\n",- "- **Weather**: Partly cloudy, high around 29ยฐF, windy with WNW winds at 20 to 30 mph.\n",- "- **Key Activities**:\n",- " - **Morning**: Enjoy a cozy brunch at **Balthazar** or **Sarabeth's** (make reservations).\n",- " - **Late Morning to Afternoon**: Visit **The Museum of Modern Art (MoMA)** or **The Intrepid Sea, Air & Space Museum** to stay warm.\n",- " - **Lunch**: Optional indoor ice skating at **The Rink at Rockefeller Center** (check wind conditions).\n",- " - **Afternoon**: Explore **Grand Central Terminal** and its food market.\n",- " - **Evening**: Attend a live performance at **Carnegie Hall** or **The Apollo Theater** (book tickets in advance) or enjoy a movie at **Alamo Drafthouse** or **Angelika Film Center**.\n",- "\n",- "### **Weather Considerations**\n",- "- Dress in layers and wear warm clothing, especially for outdoor activities.\n",- "- Plan for indoor activities during the colder parts of the day, particularly on Sunday.\n",- "\n",- "This summary encapsulates the key activities planned for the weekend while taking into account the weather conditions to ensure a comfortable and enjoyable experience in New York City.\n",+ "### Travel Considerations:\n",+ "- **Traffic:** Check real-time traffic updates before heading out, especially for dinner and show times.\n",+ "- **Weather:** Be prepared for cold and potentially wet conditions; wear layers and bring an umbrella.\n","\n","Next request.\n","\u001b[34mAI User:\n","\n",- "Instruction: Provide a list of essential items to pack for the 2-day trip to New York City based on the itinerary and weather conditions. \n",+ "Instruction: Verify whether each suggested location in the itinerary requires advance booking or is free to visit. \n","Input: None\n",- "\u001b[32mAI Assistant:Solution: Here is a list of essential items to pack for the 2-day trip to New York City, considering the itinerary and weather conditions:\n",- "\n",- "### **Essential Packing List**\n",- "\n",- "1. **Clothing**:\n",- " - **Warm Layers**: \n",- " - Thermal tops and long-sleeve shirts\n",- " - Sweaters or fleece jackets\n",- " - **Outerwear**: \n",- " - Insulated winter coat (preferably waterproof)\n",- " - **Bottoms**: \n",- " - Warm pants (jeans or thermal leggings)\n",- " - **Accessories**:\n",- " - Warm hat or beanie\n",- " - Scarf\n",- " - Gloves or mittens\n",- " - Warm socks (consider wool for extra warmth)\n",- " - **Footwear**:\n",- " - Comfortable, insulated walking shoes or boots\n",- " - Optional: Indoor shoes for museums or performances\n",- "\n",- "2. **Personal Items**:\n",- " - **Toiletries**: Travel-sized toiletries, including moisturizer (to combat dry winter air)\n",- " - **Medications**: Any personal medications you may need\n",- " - **Charger**: Phone charger and any other electronic device chargers\n",- "\n",- "3. **Travel Essentials**:\n",- " - **Backpack or Day Bag**: For carrying essentials while exploring the city\n",- " - **Water Bottle**: Stay hydrated throughout the day\n",- " - **Snacks**: Energy bars or snacks for on-the-go\n",- "\n",- "4. **Documents**:\n",- " - **ID/Passport**: Necessary for identification\n",- " - **Tickets/Reservations**: Printouts or digital copies of Broadway show tickets, museum entries, and restaurant reservations\n",- " - **Travel Insurance**: If applicable\n",- "\n",- "5. **Optional Items**:\n",- " - **Camera**: For capturing memories of your trip\n",- " - **Notebook or Journal**: To jot down experiences or thoughts during your travels\n",- " - **Umbrella**: Compact travel umbrella in case of unexpected weather changes\n",- "\n",- "This packing list ensures you are well-prepared for the chilly weather and activities planned for your weekend in New York City.\n",+ "\u001b[32mAI Assistant:Function Execution: search_real_time_data\n",+ "\tArgs: {'query': 'Does the American Museum of Natural History require advance booking?', 'ai_model_id': 'am_01j06ytn18ejftedz6dyhz2b15'}\n",+ "\tResult: Yes, the American Museum of Natural History requires all tickets to be reserved online in advance through their website. So make sure to book your tickets before you go! ๐๏ธโจFunction Execution: search_real_time_data\n",+ "\tArgs: {'query': 'Does the Metropolitan Museum of Art require advance booking?', 'ai_model_id': 'am_01j06ytn18ejftedz6dyhz2b15'}\n",+ "\tResult: You can purchase tickets for the Metropolitan Museum of Art either at the register or in advance online. If you buy in advance, just make sure to use them within the time stated on the ticket, as they become invalid after that. Enjoy your visit! ๐จโจFunction Execution: search_real_time_data\n",+ "\tArgs: {'query': 'Does the Whitney Museum of American Art require advance booking?', 'ai_model_id': 'am_01j06ytn18ejftedz6dyhz2b15'}\n",+ "\tResult: Yes, the Whitney Museum of American Art recommends advance booking for tickets since capacity is limited. Even though admission is free, it's a good idea to reserve your tickets ahead of time to ensure you get in! ๐จโจSolution: Hereโs the verification for each suggested location in the itinerary regarding advance booking requirements:\n",+ "\n",+ "### Day 1: Saturday, January 18, 2025\n",+ "1. **American Museum of Natural History**\n",+ " - **Booking Requirement:** Yes, tickets must be reserved online in advance through their website.\n",+ "\n",+ "2. **Metropolitan Museum of Art**\n",+ " - **Booking Requirement:** Tickets can be purchased at the register or in advance online. If bought in advance, they must be used within the specified time.\n",+ "\n",+ "### Day 2: Sunday, January 19, 2025\n",+ "3. **Whitney Museum of American Art**\n",+ " - **Booking Requirement:** Yes, advance booking is recommended due to limited capacity. Itโs advisable to reserve tickets ahead of time.\n",+ "\n",+ "### Other Locations:\n",+ "- **Chelsea Market:** No advance booking required; it's a public market.\n",+ "- **High Line:** Free to visit; no booking required.\n",+ "- **Central Park:** Free to visit; no booking required.\n",+ "- **Restaurants (e.g., The Modern, The Smith):** Reservations are recommended for dinner.\n","\n","Next request.\n","\u001b[34mAI User:\n","\n",- "Instruction: Compile a list of dining options for each meal during the 2-day trip, based on the itinerary. \n",+ "Instruction: Check current traffic conditions for the suggested travel routes in the itinerary to estimate travel times and feasibility. \n","Input: None\n",- "\u001b[32mAI Assistant:Solution: Here is a compiled list of dining options for each meal during the 2-day trip to New York City, based on the itinerary:\n",- "\n",- "### **Dining Options for the 2-Day Trip**\n",- "\n",- "#### **Saturday**\n",- "- **Breakfast**: \n",- " - **Cafรฉ Grumpy**: Known for its artisanal coffee and light breakfast options.\n",- " - **Jack's Wife Freda**: Offers a cozy atmosphere with a unique brunch menu.\n",- "\n",- "- **Lunch**: \n",- " - **Stumptown Coffee Roasters**: Great for a quick bite and excellent coffee.\n",- " - **Blue Bottle Coffee**: Offers pastries and light snacks in a comfortable setting.\n",- "\n",- "- **Dinner**: \n",- " - **Chelsea Market**: A variety of options including:\n",- " - **Lobster Place**: Fresh seafood and sushi.\n",- " - **Los Tacos No. 1**: Authentic Mexican tacos.\n",- " - **Chelsea Market Basket**: Gourmet sandwiches and salads.\n",- "\n",- "#### **Sunday**\n",- "- **Breakfast/Brunch**: \n",- " - **Balthazar**: A classic French bistro known for its brunch menu.\n",- " - **Sarabeth's**: Famous for its brunch offerings, including pancakes and eggs benedict.\n",- "\n",- "- **Lunch**: \n",- " - **The Modern**: Located at MoMA, offers a refined dining experience with a seasonal menu (reservations recommended).\n",- " - **Eataly**: An Italian marketplace with various dining options, including pasta, pizza, and gelato.\n",- "\n",- "- **Dinner**: \n",- " - **Carnegie Deli**: Iconic for its massive sandwiches and classic New York deli experience.\n",- " - **The Apollo Theater Cafรฉ**: If attending a performance, enjoy a meal at the cafรฉ before or after the show.\n",- "\n",- "This list provides a variety of dining options for each meal, ensuring a delightful culinary experience during your weekend in New York City.\n",+ "\u001b[32mAI Assistant:Function Execution: search_real_time_data\n",+ "\tArgs: {'query': 'Current traffic conditions from American Museum of Natural History to Shake Shack', 'ai_model_id': 'am_01j06ytn18ejftedz6dyhz2b15'}\n",+ "\tResult: Traffic conditions from the American Museum of Natural History to Shake Shack are generally light right now. You should have a smooth ride! ๐๐จ Itโs a short trip, so youโll be enjoying those delicious burgers in no time! ๐โจFunction Execution: search_real_time_data\n",+ "\tArgs: {'query': 'Current traffic conditions from Shake Shack to Metropolitan Museum of Art', 'ai_model_id': 'am_01j06ytn18ejftedz6dyhz2b15'}\n",+ "\tResult: I can't provide real-time traffic data at the moment, but you can check a traffic app or map for the latest conditions. Typically, the drive from Shake Shack to the Metropolitan Museum of Art is about 10-15 minutes, depending on the time of day. Safe travels! ๐๐จFunction Execution: search_real_time_data\n",+ "\tArgs: {'query': 'Current traffic conditions from Metropolitan Museum of Art to The Modern restaurant', 'ai_model_id': 'am_01j06ytn18ejftedz6dyhz2b15'}\n",+ "\tResult: Traffic from the Metropolitan Museum of Art to The Modern restaurant is currently light, so you should have a smooth trip! ๐๐จ It typically takes about 10-15 minutes, depending on the route you take. Enjoy your meal! ๐ฝ๏ธโจFunction Execution: search_real_time_data\n",+ "\tArgs: {'query': 'Current traffic conditions from The Modern restaurant to Times Square for Broadway show', 'ai_model_id': 'am_01j06ytn18ejftedz6dyhz2b15'}\n",+ "\tResult: Traffic from The Modern restaurant to Times Square is currently light, so you should be able to get there quickly! ๐๐จ It typically takes around 10-15 minutes, but keep an eye out for any street closures or events that might pop up. Enjoy the show! ๐ญโจFunction Execution: search_real_time_data\n",+ "\tArgs: {'query': 'Current traffic conditions from High Line to Chelsea Market', 'ai_model_id': 'am_01j06ytn18ejftedz6dyhz2b15'}\n",+ "\tResult: Traffic from the High Line to Chelsea Market is generally light right now, so you should have a smooth trip! ๐ถโโ๏ธ๐จ It's a short walk, about 10 minutes, but if you're driving, it might take around the same time depending on street conditions. Enjoy your time at Chelsea Market! ๐ฅโจFunction Execution: search_real_time_data\n",+ "\tArgs: {'query': 'Current traffic conditions from Chelsea Market to Whitney Museum of American Art', 'ai_model_id': 'am_01j06ytn18ejftedz6dyhz2b15'}\n",+ "\tResult: Traffic from Chelsea Market to the Whitney Museum of American Art is pretty light right now! ๐ถโโ๏ธ If you're walking, it should take about 10-15 minutes. If you're driving, it might be a similar time, depending on the exact route you take. Enjoy the art! ๐ผ๏ธโจFunction Execution: search_real_time_data\n",+ "\tArgs: {'query': 'Current traffic conditions from Whitney Museum of American Art to Central Park', 'ai_model_id': 'am_01j06ytn18ejftedz6dyhz2b15'}\n",+ "\tResult: Traffic from the Whitney Museum of American Art to Central Park is currently light. If you're walking, it should take about 15-20 minutes. If you're driving, the travel time is similar, depending on the route you choose. Enjoy your time in the park! ๐ณโจFunction Execution: search_real_time_data\n",+ "\tArgs: {'query': 'Current traffic conditions from Central Park to The Smith restaurant', 'ai_model_id': 'am_01j06ytn18ejftedz6dyhz2b15'}\n",+ "\tResult: Traffic from Central Park to The Smith restaurant is currently light! ๐๐จ If you're walking, it should take about 15-20 minutes. If you're driving, it might take a similar amount of time, depending on your exact route. Enjoy your meal! ๐ฝ๏ธโจSolution: Here are the current traffic conditions and estimated travel times for the suggested routes in the itinerary:\n",+ "\n",+ "### Day 1: Saturday, January 18, 2025\n",+ "1. **From American Museum of Natural History to Shake Shack**\n",+ " - **Traffic Conditions:** Light traffic.\n",+ " - **Estimated Travel Time:** Short trip; you should arrive quickly.\n",+ "\n",+ "2. **From Shake Shack to Metropolitan Museum of Art**\n",+ " - **Traffic Conditions:** Unable to provide real-time data, but typically about 10-15 minutes depending on the time of day.\n",+ "\n",+ "3. **From Metropolitan Museum of Art to The Modern restaurant**\n",+ " - **Traffic Conditions:** Light traffic.\n",+ " - **Estimated Travel Time:** Approximately 10-15 minutes.\n",+ "\n",+ "4. **From The Modern restaurant to Times Square for Broadway show**\n",+ " - **Traffic Conditions:** Light traffic.\n",+ " - **Estimated Travel Time:** Around 10-15 minutes.\n",+ "\n",+ "### Day 2: Sunday, January 19, 2025\n",+ "5. **From High Line to Chelsea Market**\n",+ " - **Traffic Conditions:** Light traffic.\n",+ " - **Estimated Travel Time:** About 10 minutes walking; similar time if driving.\n",+ "\n",+ "6. **From Chelsea Market to Whitney Museum of American Art**\n",+ " - **Traffic Conditions:** Light traffic.\n",+ " - **Estimated Travel Time:** Approximately 10-15 minutes walking or driving.\n",+ "\n",+ "7. **From Whitney Museum of American Art to Central Park**\n",+ " - **Traffic Conditions:** Light traffic.\n",+ " - **Estimated Travel Time:** About 15-20 minutes walking or driving.\n",+ "\n",+ "8. **From Central Park to The Smith restaurant**\n",+ " - **Traffic Conditions:** Light traffic.\n",+ " - **Estimated Travel Time:** Approximately 15-20 minutes walking or driving.\n",+ "\n",+ "Overall, the traffic conditions are favorable for your itinerary, making it feasible to travel between locations smoothly.\n","\n","Next request.\n","\u001b[34mAI User:\n","\n",- "Instruction: Create a list of potential attractions and activities to consider if time allows during the 2-day trip to New York City. \n",+ "Instruction: Present the final detailed 2-day itinerary for New York City, including timing, activities, travel considerations, and booking requirements. \n","Input: None\n",- "\u001b[32mAI Assistant:Solution: Here is a list of potential attractions and activities to consider if time allows during your 2-day trip to New York City:\n",- "\n",- "### **Potential Attractions and Activities**\n",- "\n",- "1. **Central Park**:\n",- " - Take a leisurely stroll or rent a bike to explore the park's scenic paths, bridges, and landmarks like Bethesda Terrace and Bow Bridge.\n",- "\n",- "2. **Top of the Rock Observation Deck**:\n",- " - Enjoy stunning views of the Manhattan skyline and Central Park from the observation deck at Rockefeller Center.\n",- "\n",- "3. **Statue of Liberty and Ellis Island**:\n",- " - If time permits, take a ferry to visit these iconic landmarks. Consider booking tickets in advance to save time.\n",+ "\u001b[32mAI Assistant:Solution: Here is the final detailed 2-day itinerary for New York City on January 18 and January 19, 2025, including timing, activities, travel considerations, and booking requirements:\n",+ "\n",+ "### Day 1: Saturday, January 18, 2025\n",+ "**Weather:** High of 36ยฐF with drizzle expected.\n",+ "\n",+ "**Morning:**\n",+ "- **10:00 AM - Visit the American Museum of Natural History**\n",+ " - **Booking Requirement:** Tickets must be reserved online in advance.\n",+ " - **Travel Consideration:** Take the subway to 81st St - Museum of Natural History (1 train).\n",+ " - **Estimated Travel Time:** Light traffic; short trip.\n",+ "\n",+ "**Lunch:**\n",+ "- **12:30 PM - Lunch at Shake Shack (near the museum)**\n",+ " - **Details:** Enjoy a warm burger and fries. Indoor seating available.\n",+ " - **Estimated Travel Time:** Light traffic; quick trip.\n",+ "\n",+ "**Afternoon:**\n",+ "- **2:00 PM - Explore the Metropolitan Museum of Art**\n",+ " - **Booking Requirement:** Tickets can be purchased at the register or in advance online.\n",+ " - **Travel Consideration:** A short walk or subway ride (4, 5, or 6 train to 86th St).\n",+ " - **Estimated Travel Time:** About 10-15 minutes.\n",+ "\n",+ "**Evening:**\n",+ "- **5:00 PM - Dinner at The Modern**\n",+ " - **Booking Requirement:** Reservations recommended.\n",+ " - **Travel Consideration:** Approximately 10-15 minutes travel time from the Met.\n",+ " \n",+ "- **7:00 PM - Broadway Show**\n",+ " - **Booking Requirement:** Tickets should be booked in advance.\n",+ " - **Travel Consideration:** Take a taxi or subway to Times Square; about 10-15 minutes travel time.\n","\n",- "4. **Brooklyn Bridge**:\n",- " - Walk across the Brooklyn Bridge for breathtaking views of the city skyline and the East River. You can also explore Brooklyn Bridge Park afterward.\n",+ "### Day 2: Sunday, January 19, 2025\n",+ "**Weather:** High of 39ยฐF, mostly overcast.\n","\n",- "5. **9/11 Memorial and Museum**:\n",- " - Visit the memorial and museum to pay tribute and learn about the events of September 11, 2001.\n",+ "**Morning:**\n",+ "- **10:00 AM - Visit the High Line**\n",+ " - **Booking Requirement:** Free to visit; no booking required.\n",+ " - **Travel Consideration:** Take the subway to 14th St (A, C, E trains).\n",+ " - **Estimated Travel Time:** Light traffic; about 10 minutes walking.\n","\n",- "6. **The High Line**:\n",- " - If you didn't get a chance on Saturday, consider walking the High Line, an elevated park with gardens, art installations, and views of the Hudson River.\n",+ "**Lunch:**\n",+ "- **12:00 PM - Lunch at Chelsea Market**\n",+ " - **Booking Requirement:** No advance booking required; various food options available.\n",+ " - **Estimated Travel Time:** About 10 minutes walking from the High Line.\n","\n",- "7. **Shopping in SoHo**:\n",- " - Explore the trendy shops and boutiques in SoHo for unique fashion finds and souvenirs.\n",+ "**Afternoon:**\n",+ "- **1:30 PM - Visit the Whitney Museum of American Art**\n",+ " - **Booking Requirement:** Advance booking recommended due to limited capacity.\n",+ " - **Travel Consideration:** A short walk from Chelsea Market.\n",+ " - **Estimated Travel Time:** Approximately 10-15 minutes.\n","\n",- "8. **Visit the New York Public Library**:\n",- " - Check out the stunning architecture and exhibitions at the main branch of the New York Public Library on 5th Avenue.\n",+ "**Evening:**\n",+ "- **4:00 PM - Stroll through Central Park**\n",+ " - **Booking Requirement:** Free to visit; no booking required.\n",+ " - **Travel Consideration:** About 15-20 minutes walking from the Whitney.\n","\n",- "9. **Explore Greenwich Village**:\n",- " - Wander through this historic neighborhood known for its bohemian vibe, charming streets, and great dining options.\n",+ "- **6:00 PM - Dinner at The Smith**\n",+ " - **Booking Requirement:** Reservations recommended.\n",+ " - **Travel Consideration:** Approximately 15-20 minutes travel time from Central Park.\n","\n",- "10. **Attend a Comedy Show**:\n",- " - If you have an evening free, consider catching a comedy show at venues like **The Comedy Cellar** or **Upright Citizens Brigade Theatre**.\n",+ "### Summary of Travel Considerations:\n",+ "- **Traffic:** Generally light for all routes; check real-time updates before heading out.\n",+ "- **Weather:** Dress warmly and be prepared for drizzle on Saturday.\n","\n",- "These attractions and activities provide additional options to enhance your experience in New York City, allowing you to explore more of what the city has to offer if time allows.\n",+ "This itinerary is designed to maximize your enjoyment while accommodating the weather and travel conditions. Enjoy your trip to New York City!\n","\n","Next request.\n","\u001b[34mAI User:\n","\n",- "Instruction: Summarize the entire travel plan, including the itinerary, dining options, packing list, and potential attractions, into a cohesive document. \n",+ "Instruction: Confirm that the task is completed and provide a final response. \n","Input: None\n",- "\u001b[32mAI Assistant:Solution: Here is a cohesive summary of the entire travel plan for the 2-day trip to New York City, including the itinerary, dining options, packing list, and potential attractions.\n",- "\n",- "---\n",- "\n",- "# **2-Day Travel Plan for New York City**\n",- "\n",- "## **Itinerary Overview**\n",- "\n",- "### **Saturday**\n",- "- **Weather**: Sunny in the morning, overcast by afternoon, high around 39ยฐF.\n",- "- **Key Activities**:\n",- " - **Morning**: Visit **The Metropolitan Museum of Art** or **American Museum of Natural History**.\n",- " - **Late Morning**: Indoor shopping at **Westfield World Trade Center**.\n",- " - **Lunch**: Cozy cafรฉ experience at **Stumptown Coffee Roasters** or **Blue Bottle Coffee**.\n",- " - **Afternoon**: Attend a matinee Broadway show (book tickets in advance).\n",- " - **Evening**: Dinner at **Chelsea Market** and optional brisk walk on the High Line (dress warmly).\n",- "\n",- "### **Sunday**\n",- "- **Weather**: Partly cloudy, high around 29ยฐF, windy with WNW winds at 20 to 30 mph.\n",- "- **Key Activities**:\n",- " - **Morning**: Enjoy a cozy brunch at **Balthazar** or **Sarabeth's** (make reservations).\n",- " - **Late Morning to Afternoon**: Visit **The Museum of Modern Art (MoMA)** or **The Intrepid Sea, Air & Space Museum**.\n",- " - **Lunch**: Optional indoor ice skating at **The Rink at Rockefeller Center** (check wind conditions).\n",- " - **Afternoon**: Explore **Grand Central Terminal** and its food market.\n",- " - **Evening**: Attend a live performance at **Carnegie Hall** or **The Apollo Theater** (book tickets in advance) or enjoy a movie at **Alamo Drafthouse** or **Angelika Film Center**.\n",- "\n",- "## **Dining Options**\n",- "\n",- "### **Saturday**\n",- "- **Breakfast**: \n",- " - Cafรฉ Grumpy\n",- " - Jack's Wife Freda\n",- "- **Lunch**: \n",- " - Stumptown Coffee Roasters\n",- " - Blue Bottle Coffee\n",- "- **Dinner**: \n",- " - Chelsea Market (Lobster Place, Los Tacos No. 1, Chelsea Market Basket)\n",- "\n",- "### **Sunday**\n",- "- **Breakfast/Brunch**: \n",- " - Balthazar\n",- " - Sarabeth's\n",- "- **Lunch**: \n",- " - The Modern\n",- " - Eataly\n",- "- **Dinner**: \n",- " - Carnegie Deli\n",- " - The Apollo Theater Cafรฉ\n",- "\n",- "## **Packing List**\n",- "1. **Clothing**:\n",- " - Warm layers (thermal tops, sweaters)\n",- " - Insulated winter coat\n",- " - Warm pants\n",- " - Accessories (hat, scarf, gloves)\n",- " - Comfortable footwear\n",- "2. **Personal Items**:\n",- " - Toiletries\n",- " - Medications\n",- " - Phone charger\n",- "3. **Travel Essentials**:\n",- " - Backpack or day bag\n",- " - Water bottle\n",- " - Snacks\n",- "4. **Documents**:\n",- " - ID/Passport\n",- " - Tickets/Reservations\n",- " - Travel Insurance\n",- "5. **Optional Items**:\n",- " - Camera\n",- " - Notebook or journal\n",- " - Compact umbrella\n",- "\n",- "## **Potential Attractions and Activities**\n",- "1. Central Park\n",- "2. Top of the Rock Observation Deck\n",- "3. Statue of Liberty and Ellis Island\n",- "4. Brooklyn Bridge\n",- "5. 9/11 Memorial and Museum\n",- "6. The High Line\n",- "7. Shopping in SoHo\n",- "8. Visit the New York Public Library\n",- "9. Explore Greenwich Village\n",- "10. Attend a comedy show\n",- "\n",- "---\n",- "\n",- "This travel plan provides a comprehensive guide for your weekend in New York City, ensuring a well-rounded experience filled with activities, dining, and exploration while considering the weather conditions.\n",+ "\u001b[32mAI Assistant:Solution: The task is completed. I have provided a detailed 2-day itinerary for New York City on January 18 and January 19, 2025, including timing, activities, travel considerations, and booking requirements. If you have any further questions or need additional assistance, feel free to ask!\n","\n","Next request.\n","\u001b[34mAI User:\n",@@ -1033,114 +919,64 @@"<CAMEL_TASK_DONE>\n"]}- ],- "source": [- "n = 0\n",- "input_msg = role_play_session.init_chat()\n",- "while n < 20: # Limit the chat to 20 turns\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",- " # Print output from the user\n",- " print_text_animated(\n",- " Fore.BLUE + f\"AI User:\\n\\n{user_response.msg.content}\\n\",\n",- " 0.01\n",- " )\n",- "\n",- " if \"CAMEL_TASK_DONE\" in user_response.msg.content:\n",- " break\n",- "\n",- " # Print output from the assistant, including any function\n",- " # execution information\n",- " print_text_animated(Fore.GREEN + \"AI Assistant:\", 0.01)\n",- " tool_calls: List[FunctionCallingRecord] = [\n",- " FunctionCallingRecord(**call.as_dict())\n",- " for call in assistant_response.info['tool_calls']\n",- " ]\n",- " for func_record in tool_calls:\n",- " print_text_animated(f\"{func_record}\", 0.01)\n",- " print_text_animated(f\"{assistant_response.msg.content}\\n\", 0.01)\n",- "\n",- " input_msg = assistant_response.msg"]},{"cell_type": "code",- "execution_count": null,+ "source": [+ "# End the AgentOps session\n",+ "agentops.end_session(\"Success\")"+ ],"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "VyAzcIZxEoCR",- "outputId": "e7e64465-9612-4277-d8c9-e80e43b5992e"+ "outputId": "ee1be4dc-4f9c-4ac4-a237-b48a38691825"},+ "execution_count": 15,"outputs": [{- "name": "stderr","output_type": "stream",+ "name": "stderr","text": [- "๐ AgentOps: Session Stats - Duration: 7m 9.2s | Cost: $0.013102 | LLMs: 26 | Tools: 5 | Actions: 0 | Errors: 0\n",- "๐ AgentOps: \u001b[34mSession Replay: https://app.agentops.ai/drilldown?session_id=e1d4ca98-f21d-4f65-b4b1-2004faa385c1\u001b[0m\n"+ "๐ AgentOps: Session Stats - \u001b[1mDuration:\u001b[0m 13m 34.0s | \u001b[1mCost:\u001b[0m $0.012518 | \u001b[1mLLMs:\u001b[0m 31 | \u001b[1mTools:\u001b[0m 16 | \u001b[1mActions:\u001b[0m 0 | \u001b[1mErrors:\u001b[0m 0\n",+ "๐ AgentOps: \u001b[34m\u001b[34mSession Replay: https://app.agentops.ai/drilldown?session_id=c31e4378-a022-4272-adba-0e75792c87cd\u001b[0m\u001b[0m\n"]}- ],- "source": [- "# End the AgentOps session\n",- "agentops.end_session(\"Success\")"]},{"cell_type": "markdown",- "metadata": {- "id": "Ra6-BgxWE-y2"- },"source": ["๐ Go to the AgentOps link shown above, you will be able to see the detailed record for this running like below.\n","\n","**NOTE**: The AgentOps link is private and tied to the AgentOps account. To access the link, you'll need to run the session using your own AgentOps API Key, which will then allow you to open the link with the session's running information."- ]+ ],+ "metadata": {+ "id": "Ra6-BgxWE-y2"+ }},{"cell_type": "markdown",- "metadata": {- "id": "IjAnF9ozJZa8"- },"source": [- ""- ]+ ""+ ],+ "metadata": {+ "id": "2lA-dSb2R0m1"+ }},{"cell_type": "markdown",- "metadata": {- "id": "flYNal6-R4yR"- },"source": ["## ๐ Highlights"- ]+ ],+ "metadata": {+ "id": "flYNal6-R4yR"+ }},{"cell_type": "markdown",- "metadata": {- "id": "SmkXhy4JR726"- },"source": ["This notebook has guided you through setting up and running a CAMEL RAG workflow with Dappier for a multi-agent role-playing task. You can adapt and expand this example for various other scenarios requiring advanced web information retrieval and AI collaboration.\n","\n",@@ -1152,13 +988,35 @@"* **AgentOps**: Track and analysis the running of CAMEL Agents.\n","\n","This comprehensive setup allows you to adapt and expand the example for various scenarios requiring advanced web information retrieval, AI collaboration, and multi-source data aggregation."- ]+ ],+ "metadata": {+ "id": "SmkXhy4JR726"+ }},{"cell_type": "markdown",+ "source": [+ "Check out some of our other work:\n",+ "\n",+ "1. ๐ซ Creating Your First CAMEL Agent [free Colab](https://docs.camel-ai.org/cookbooks/create_your_first_agent.html)\n",+ "\n",+ "2. Graph RAG Cookbook [free Colab](https://colab.research.google.com/drive/1uZKQSuu0qW6ukkuSv9TukLB9bVaS1H0U?usp=sharing)\n",+ "\n",+ "3. ๐งโโ๏ธ Create A Hackathon Judge Committee with Workforce [free Colab](https://colab.research.google.com/drive/18ajYUMfwDx3WyrjHow3EvUMpKQDcrLtr?usp=sharing)\n",+ "\n",+ "4. ๐ฅ 3 ways to ingest data from websites with Firecrawl & CAMEL [free Colab](https://colab.research.google.com/drive/1lOmM3VmgR1hLwDKdeLGFve_75RFW0R9I?usp=sharing)\n",+ "\n",+ "5. ๐ฆฅ Agentic SFT Data Generation with CAMEL and Mistral Models, Fine-Tuned with Unsloth [free Colab](https://colab.research.google.com/drive/1lYgArBw7ARVPSpdwgKLYnp_NEXiNDOd-?usp=sharingg)\n",+ "\n",+ "\n",+ "Thanks from everyone at ๐ซ CAMEL-AI"+ ],"metadata": {- "id": "s6Det-fcMb9A"- },+ "id": "pO3rAib2i4Ll"+ }+ },+ {+ "cell_type": "markdown","source": ["<div class=\"align-center\">\n"," <a href=\"https://www.camel-ai.org/\"><img src=\"https://i.postimg.cc/KzQ5rfBC/button.png\"width=\"150\"></a>\n",@@ -1166,21 +1024,10 @@" \n","โญ <i>Star us on [*Github*](https://github.com/camel-ai/camel), join our [*Discord*](https://discord.camel-ai.org) or follow our [*X*](https://x.com/camelaiorg)\n","</div>"- ]- }- ],- "metadata": {- "colab": {- "provenance": []- },- "kernelspec": {- "display_name": "Python 3",- "name": "python3"- },- "language_info": {- "name": "python"+ ],+ "metadata": {+ "id": "s6Det-fcMb9A"+ }}- },- "nbformat": 4,- "nbformat_minor": 0-}+ ]+}\ No newline at end of filediff --git a/docs/cookbooks/data_generation/index.rst b/docs/cookbooks/data_generation/index.rstindex 39e309d17..14995a191 100644--- a/docs/cookbooks/data_generation/index.rst+++ b/docs/cookbooks/data_generation/index.rst@@ -17,3 +17,4 @@ Model Training and Fine-tuningdata_gen_with_real_function_calls_and_hermes_formatself_instruct_data_generationcot_data_gen_sft_qwen_unsolth_upload_huggingface+ synthetic_dataevaluation&filter_with_reward_modeldiff --git a/docs/cookbooks/data_generation/synthetic_dataevaluation&filter_with_reward_model.ipynb b/docs/cookbooks/data_generation/synthetic_dataevaluation&filter_with_reward_model.ipynbnew file mode 100644index 000000000..ea1ec81e2--- /dev/null+++ b/docs/cookbooks/data_generation/synthetic_dataevaluation&filter_with_reward_model.ipynb@@ -0,0 +1,696 @@+{+ "cells": [+ {+ "cell_type": "markdown",+ "metadata": {+ "id": "wTyN9Ur03UgZ"+ },+ "source": [+ "# Agentic Data Generation, Evaluation & Filtering with Reward Models"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {+ "id": "7V3aV16AmY0K"+ },+ "source": [+ "You can also check this cookbook in colab [here](https://colab.research.google.com/drive/15Y4iDw_yeskG7ZXzqy6pnJDVtPjl3RVA?usp=sharing)"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {+ "id": "M7mXkUbVi2sD"+ },+ "source": [+ "<div class=\"align-center\">\n",+ " <a href=\"https://www.camel-ai.org/\"><img src=\"https://i.postimg.cc/KzQ5rfBC/button.png\"width=\"150\"></a>\n",+ " <a href=\"https://discord.camel-ai.org\"><img src=\"https://i.postimg.cc/L4wPdG9N/join-2.png\" width=\"150\"></a></a>\n",+ " \n",+ "โญ <i>Star us on [*Github*](https://github.com/camel-ai/camel), join our [*Discord*](https://discord.camel-ai.org) or follow our [*X*](https://x.com/camelaiorg)\n",+ "</div>"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {+ "id": "sAMnfaxK5SLY"+ },+ "source": [+ "This notebook demonstrates how to set up and leverage CAMEL's reward model to evaluate and filter synthetic data.\n",+ "\n",+ "In this notebook, you'll explore:\n",+ "\n",+ "* **CAMEL**: A powerful multi-agent framework that enables data synthesis, evaluation, and model training, as well as multi-agent role-playing scenarios, allowing for sophisticated AI-driven tasks.\n",+ "* **CAMEL FireCrawl Reader**: The Firecrawl loader encapsulated in CAMEL allows users to retrieve web information through Firecrawl.\n",+ "* **Reward Model Module**: A critical component designed to score and evaluate the quality of generated data based on predefined criteria. It supports fine-tuning of the evaluation process and ensures alignment with desired outcomes, making it an essential tool for filtering synthetic data effectively.\n",+ "\n",+ "This cookbook demonstrates CAMEL serves as a flexible framework that can be adapted for various scenarios requiring evaluation, filtering, and optimization of AI-generated content."+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {+ "id": "8QuUILh4_Zfb"+ },+ "source": [+ ""+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {+ "id": "eTAwCl7q2m2P"+ },+ "source": [+ "## ๐ฆ Installation"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {+ "id": "DvLPKCp26ZGS"+ },+ "source": [+ "First, install the CAMEL package with its dependencies"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "metadata": {+ "id": "ua2cEP-B2m2S"+ },+ "outputs": [],+ "source": [+ "!pip install \"camel-ai[web_tools]==0.2.16\""+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {+ "id": "TZjOU-PM2m2S"+ },+ "source": [+ "Next, we need to securely input and store the required API keys for accessing OpenAI, Firecrawl, and NVIDIA services."+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "metadata": {+ "colab": {+ "base_uri": "https://localhost:8080/"+ },+ "id": "0leJxgNB2m2T",+ "outputId": "dba63d78-3932-49f5-b730-6b0181b9fcfd"+ },+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "Enter your OpenAI API key: ยทยทยทยทยทยทยทยทยทยท\n",+ "Enter your Firecrawl API key: ยทยทยทยทยทยทยทยทยทยท\n",+ "Enter your NVIDIA API key: ยทยทยทยทยทยทยทยทยทยท\n"+ ]+ }+ ],+ "source": [+ "from getpass import getpass\n",+ "import os\n",+ "\n",+ "openai_api_key = getpass('Enter your OpenAI API key: ')\n",+ "os.environ[\"OPENAI_API_KEY\"] = openai_api_key\n",+ "\n",+ "# Generate an API key at https://www.firecrawl.dev/app/api-keys\n",+ "firecrawl_api_key = getpass('Enter your Firecrawl API key: ')\n",+ "os.environ[\"FIRECRAWL_API_KEY\"] = firecrawl_api_key\n",+ "\n",+ "# Generate an API key at https://build.nvidia.com/nvidia/nemotron-4-340b-reward\n",+ "nvidia_api_key = getpass('Enter your NVIDIA API key: ')\n",+ "os.environ[\"NVIDIA_API_KEY\"] = nvidia_api_key"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {+ "id": "3ug4mmpA2m2T"+ },+ "source": [+ "To work effectively with the Alpaca format and manage items systematically, we define a set of models using Pydantic. These models ensure that the data is well-structured, type-safe, and validated."+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "metadata": {+ "id": "h9IdTqJC2m2T"+ },+ "outputs": [],+ "source": [+ "from pydantic import BaseModel\n",+ "from camel.messages.conversion import AlpacaItem\n",+ "\n",+ "class NumberedAlpacaItem(BaseModel):\n",+ " number: int\n",+ " item: AlpacaItem\n",+ "\n",+ "\n",+ "class AlpacaItemResponse(BaseModel):\n",+ " \"\"\"\n",+ " Represents an instruction-response item in the Alpaca format.\n",+ " \"\"\"\n",+ " items: list[NumberedAlpacaItem]"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {+ "id": "hMJJHNH02m2T"+ },+ "source": [+ "# ๐ Data Generation\n",+ "Next, we define our data generation function. It takes a source content and generates a list of instruction-input-response triplets based on it.\n",+ "\n",+ "Later, we will use a reward model to filter this list."+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "metadata": {+ "id": "yvmO-S8P2m2U"+ },+ "outputs": [],+ "source": [+ "from typing import List\n",+ "from camel.models import ModelFactory\n",+ "from camel.types import ModelPlatformType, ModelType\n",+ "from camel.configs import ChatGPTConfig\n",+ "from camel.agents import ChatAgent\n",+ "\n",+ "def generate_alpaca_items(content: str, n_items: int, start_num: int = 1, examples: List[AlpacaItem] = None) -> List[AlpacaItem]:\n",+ " system_msg = \"\"\"\n",+ "You are an AI assistant generating detailed, accurate responses based on the provided content.\n",+ "You will be given a reference content, and you must generate a specific number of AlpacaItems.\n",+ "These are instruction-input-response triplets, where the input is the context or examples.\n",+ "\n",+ "Add a number to the items to keep track of the order. Generate exactly that many.\n",+ "\n",+ "For each instruction, imagine but do not include a real world scenario and real user in that scenario to inform realistic and varied instructions. Avoid common sense questions and answers.\n",+ "\n",+ "Include multiple lines in the output as appropriate to provide sufficient detail. Cite the most relevant context verbatim in output fields, do not omit anything important.\n",+ "\n",+ "Leave the input field blank.\n",+ "\n",+ "Ensure all of the most significant parts of the context are covered.\n",+ "\n",+ "Start with open ended instructions, then move to more specific ones. Consider the starting number for an impression of what has already been generated.\n",+ " \"\"\"\n",+ "\n",+ " examples_str = \"\"\n",+ " if examples:\n",+ " examples_str = \"\\n\\nHere are some example items for reference:\\n\" + \\\n",+ " \"\\n\".join(ex.model_dump_json() for ex in examples)\n",+ "\n",+ " model = ModelFactory.create(\n",+ " model_platform=ModelPlatformType.OPENAI,\n",+ " model_type=ModelType.GPT_4O_MINI,\n",+ " model_config_dict=ChatGPTConfig(\n",+ " temperature=0.6, response_format=AlpacaItemResponse\n",+ " ).as_dict(),\n",+ " )\n",+ "\n",+ " agent = ChatAgent(\n",+ " system_message=system_msg,\n",+ " model=model,\n",+ " )\n",+ "\n",+ " prompt = f\"Content reference:\\n{content}{examples_str}\\n\\n Generate {n_items} AlpacaItems. The first should start numbering at {start_num}.\"\n",+ " response = agent.step(prompt)\n",+ "\n",+ " # Parse the generated JSON to our wrapper class\n",+ " alpaca_items = [n_item.item for n_item in\n",+ " AlpacaItemResponse.\n",+ " model_validate_json(response.msgs[0].content).items]\n",+ "\n",+ " return alpaca_items\n",+ "\n",+ "# Few shot examples to ensure the right amount of detail\n",+ "examples = [\n",+ " AlpacaItem(\n",+ " instruction=\"Explain the process for sprint planning and review in CAMEL.\",\n",+ " input=\"\",\n",+ " output=\"The process for sprint planning and review in CAMEL includes:\\n1. **Sprint Duration**: Each sprint lasts two weeks for development and one week for review.\\n2. **Planning Meeting**: Conducted biweekly, where the founder highlights the sprint goal and developers select items for the sprint.\\n3. **Review Meeting**: Stakeholders review the delivered features and provide feedback on the work completed during the sprint.\"\n",+ " )\n",+ "]"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {+ "id": "YPh1UxQB2m2U"+ },+ "source": [+ "# ๐ Point to content and generate data!\n",+ "Now we point to the content that we wish to generate SFT data around and use CAMEL's Firecrawl integration to get this content in a nice markdown format.\n"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "metadata": {+ "colab": {+ "base_uri": "https://localhost:8080/"+ },+ "id": "ghDjZH152m2U",+ "outputId": "cbd1cfa0-fe97-44e6-954c-0a52a69f9ed1"+ },+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "Generated 50 items\n",+ "[AlpacaItem(instruction='Summarize the contributing guidelines for the CAMEL project.', input='', output='The contributing guidelines for the CAMEL project include:\\n1. **Types of Contributions**: Contributions can include new features, infrastructure enhancements, documentation improvements, issue reporting, and bug fixes.\\n2. **Workflow**: Community contributors should follow the Fork-and-Pull-Request workflow, while members of CAMEL-AI.org should use the Checkout-and-Pull-Request workflow.\\n3. **Pull Requests**: Mention related issues and tag relevant maintainers. Pull requests must pass formatting, linting, and testing checks before merging.'), AlpacaItem(instruction='What are the steps for writing a cookbook entry for CAMEL?', input='', output='The steps for writing a cookbook entry for CAMEL are:\\n1. **Template Usage**: Use the provided template for consistency.\\n2. **Writing in Colab**: Write your cookbook in Google Colab, ensuring that LLM-generated responses are correct and verified.\\n3. **Clear Explanations**: Provide clear explanations of the code and its purpose.\\n4. **Review and Submit**: After writing, review in Colab, then submit by downloading the notebook and creating a pull request.'), AlpacaItem(instruction='Describe the principles for writing docstrings in CAMEL.', input='', output='The principles for writing docstrings in CAMEL include:\\n1. **Use Raw Strings**: Start with `r\"\"\"` to prevent issues with special characters.\\n2. **Brief Descriptions**: Provide a concise summary of the functionality at the beginning.\\n3. **Document Parameters**: Use an `Args` section to document parameters, including type and default values.'), AlpacaItem(instruction='What is the process for conducting code reviews in CAMEL?', input='', output='The process for conducting code reviews in CAMEL includes:\\n1. **Reviewers Check**: Reviewers assess code for functionality, readability, and compliance with standards.\\n2. **Feedback**: Leave constructive feedback where changes are necessary.\\n3. **Approval**: The code must be approved by at least two reviewers before merging.'), AlpacaItem(instruction='Outline the steps for submitting a cookbook to CAMEL.', input='', output='The steps for submitting a cookbook to CAMEL are:\\n1. **Finalize in Colab**: Ensure that the Colab notebook is complete and reviewed.\\n2. **Download Notebook**: Download the finalized notebook as a .ipynb file.\\n3. **Create Pull Request**: Open a pull request to add the .ipynb file to the repository, including any necessary documentation.'), AlpacaItem(instruction='Explain the importance of code coverage in CAMEL.', input='', output='Code coverage is important in CAMEL because it measures how much of the code is tested by unit tests. This helps in identifying robust areas of the codebase and areas that may need more testing, ensuring better reliability and maintainability of the code.'), AlpacaItem(instruction='What are the guidelines for labeling pull requests in CAMEL?', input='', output='The guidelines for labeling pull requests in CAMEL include:\\n- **feat**: For new features.\\n- **fix**: For bug fixes.\\n- **docs**: For documentation updates.\\n- **style**: For code style changes.\\n- **refactor**: For code refactoring.\\n- **test**: For adding or updating tests.\\n- **chore**: For maintenance tasks.'), AlpacaItem(instruction='What communication channels are available for CAMEL contributors?', input='', output='The communication channels available for CAMEL contributors include:\\n- **Discord**: For real-time communication.\\n- **WeChat**: For Chinese-speaking contributors.\\n- **Slack**: For team collaboration.'), AlpacaItem(instruction='Describe the purpose of the sprint planning process in CAMEL.', input='', output='The purpose of the sprint planning process in CAMEL is to define what can be delivered in the upcoming sprint and how those goals will be achieved. It ensures that the team has a clear understanding of the sprint objectives and tasks to focus on.'), AlpacaItem(instruction='What are the key components of the CAMEL project license?', input='', output='The CAMEL project is licensed under Apache 2.0, which means that contributions will also be licensed under the same terms by default. Contributors can add the license manually or use a script to automate the process.'), AlpacaItem(instruction='Summarize the guidelines for contributing to the CAMEL documentation.', input='', output='The guidelines for contributing to the CAMEL documentation include:\\n1. **Comprehensive Coverage**: Provide thorough documentation for all classes and methods.\\n2. **Sphinx Usage**: Documentation is generated automatically using Sphinx from the codebase.'), AlpacaItem(instruction='What steps should be taken to ensure reproducibility in the CAMEL cookbook?', input='', output='To ensure reproducibility in the CAMEL cookbook, contributors should:\\n1. Write code that can be run and produces consistent results.\\n2. Provide clear instructions for running the code.\\n3. Validate all examples with real code execution.'), AlpacaItem(instruction='Explain the significance of logging over using print statements in CAMEL.', input='', output='Using logging instead of print statements in CAMEL is significant because it allows for more professional, configurable, and consistent logging. It helps in maintaining clean code and provides better control over the logging output.'), AlpacaItem(instruction='What is the process for updating dependencies in CAMEL?', input='', output='The process for updating dependencies in CAMEL includes:\\n1. Modify the `pyproject.toml` file to add, update, or delete dependencies.\\n2. Run `poetry lock` to synchronize the dependencies with the lock file.'), AlpacaItem(instruction='What are the responsibilities of a code reviewer in CAMEL?', input='', output='The responsibilities of a code reviewer in CAMEL include:\\n1. Conduct timely reviews to keep the project moving.\\n2. Provide clear and constructive feedback.\\n3. Collaborate with contributors to ensure code meets project standards.'), AlpacaItem(instruction='Outline the steps to build documentation locally for CAMEL.', input='', output='To build documentation locally for CAMEL, follow these steps:\\n1. Navigate to the `docs` directory.\\n2. Run the command `make html` to generate the HTML documentation.'), AlpacaItem(instruction='What are the key principles to follow when writing entries for the CAMEL cookbook?', input='', output='The key principles for writing entries for the CAMEL cookbook include:\\n1. High Quality: Ensure accurate code and clear explanations.\\n2. Correctness: Validate LLM-generated responses with real code execution.\\n3. Accessibility: Make content understandable for all users, from beginners to advanced.'), AlpacaItem(instruction='Describe how to run tests in CAMEL.', input='', output='To run tests in CAMEL, use the command `pytest .` in the project root directory. This will execute all tests, including those that require an OpenAI API key. For local isolated unit tests, use `pytest --fast-test-mode .`.'), AlpacaItem(instruction='What is the purpose of the code review checklist in CAMEL?', input='', output='The purpose of the code review checklist in CAMEL is to ensure that all contributions maintain high quality by evaluating functionality, code quality, design consistency, and documentation before merging into the main branch.'), AlpacaItem(instruction='Explain the process for scheduling an introduction call for new contributors in CAMEL.', input='', output='To schedule an introduction call for new contributors in CAMEL, visit the provided Calendly links:\\n- For English speakers: Use the designated link for English.\\n- For Chinese speakers: Use the designated link for Chinese.'), AlpacaItem(instruction='What are the main goals of the CAMEL project?', input='', output='The main goals of the CAMEL project include developing a robust open-source framework for AI applications, fostering community contributions, and ensuring high-quality documentation and testing.'), AlpacaItem(instruction=\"What is the significance of the 'Fork-and-Pull-Request' workflow in CAMEL?\", input='', output=\"The 'Fork-and-Pull-Request' workflow in CAMEL is significant because it allows contributors to work on their own copy of the project and submit changes for review, ensuring that contributions are managed efficiently and collaboratively.\"), AlpacaItem(instruction='What should contributors do before their pull request can be merged?', input='', output='Before a pull request can be merged in CAMEL, it must pass formatting, linting, and testing checks. Contributors should also ensure that they have addressed any feedback from reviewers.'), AlpacaItem(instruction='Summarize the guidelines for writing clear and concise explanations in the CAMEL cookbook.', input='', output='The guidelines for writing clear and concise explanations in the CAMEL cookbook include:\\n1. Use simple language to describe code functionality.\\n2. Break down complex logic into understandable steps.\\n3. Provide context for technical terms.'), AlpacaItem(instruction='What is the recommended way to provide feedback during code reviews in CAMEL?', input='', output='The recommended way to provide feedback during code reviews in CAMEL is to leave constructive comments that are clear and aimed at helping the contributor improve their code.'), AlpacaItem(instruction='What are the key components of the CAMEL community guidelines?', input='', output='The key components of the CAMEL community guidelines include promoting an inclusive environment, encouraging collaboration, and respecting diverse perspectives among contributors.'), AlpacaItem(instruction='Explain the significance of ensuring high-quality documentation in CAMEL.', input='', output='Ensuring high-quality documentation in CAMEL is significant because it helps users understand how to use the framework effectively, facilitates onboarding for new contributors, and promotes better collaboration within the community.'), AlpacaItem(instruction='What should contributors do if they encounter challenges during the setup process?', input='', output='If contributors encounter challenges during the setup process in CAMEL, they should reach out to a maintainer for assistance to ensure a smooth experience.'), AlpacaItem(instruction='Describe the process for merging pull requests in CAMEL.', input='', output='The process for merging pull requests in CAMEL involves:\\n1. Ensuring the pull request has been approved by at least two reviewers.\\n2. The merging should be done by a maintainer or an authorized contributor.'), AlpacaItem(instruction='What are the best practices for conducting a sprint review in CAMEL?', input='', output='Best practices for conducting a sprint review in CAMEL include:\\n1. Gathering stakeholder feedback on delivered features.\\n2. Identifying areas for improvement based on the work completed.'), AlpacaItem(instruction='What is the significance of using Google Colab for cookbook contributions?', input='', output='Using Google Colab for cookbook contributions is significant because it allows for interactive code execution alongside explanations, making it easier for users to understand and experiment with the code.'), AlpacaItem(instruction='What are the steps to create a new issue on the CAMEL GitHub repository?', input='', output=\"To create a new issue on the CAMEL GitHub repository, follow these steps:\\n1. Go to the issues page on GitHub.\\n2. Click on 'New Issue' and fill in the required information, including a proper title and description.\\n3. Assign labels and update the assignees and milestones as necessary.\"), AlpacaItem(instruction=\"What should contributors do to maintain the project's coding standards?\", input='', output=\"To maintain the project's coding standards, contributors should:\\n1. Follow the established style guidelines.\\n2. Use tools like Ruff for formatting and linting checks.\\n3. Ensure documentation is up-to-date and comprehensive.\"), AlpacaItem(instruction='Explain the role of the CAMEL project maintainers.', input='', output='The role of the CAMEL project maintainers includes overseeing contributions, ensuring code quality, managing project direction, and facilitating communication within the community.'), AlpacaItem(instruction='What are the guidelines for submitting documentation updates in CAMEL?', input='', output='The guidelines for submitting documentation updates in CAMEL include:\\n1. Ensure that updates are comprehensive and improve clarity.\\n2. Follow the automated documentation generation process using Sphinx.'), AlpacaItem(instruction='What are the requirements for submitting a feature request in CAMEL?', input='', output='The requirements for submitting a feature request in CAMEL include providing a clear description of the feature, explaining its benefits, and linking to any relevant issues or discussions.'), AlpacaItem(instruction='Describe the importance of unit tests in the CAMEL project.', input='', output='Unit tests are important in the CAMEL project because they verify that individual components of the code work as expected, helping to catch bugs early and ensuring code reliability.'), AlpacaItem(instruction='What is the process for addressing feedback received during code reviews?', input='', output='The process for addressing feedback received during code reviews involves:\\n1. Carefully reviewing the comments and suggestions provided by reviewers.\\n2. Making necessary changes to the code based on the feedback.\\n3. Updating the pull request to reflect the changes made.'), AlpacaItem(instruction='Summarize the steps for conducting a developer meeting in CAMEL.', input='', output='The steps for conducting a developer meeting in CAMEL include:\\n1. Scheduling the meeting in advance and sharing the agenda.\\n2. Discussing ongoing projects, challenges, and upcoming tasks.\\n3. Gathering feedback and suggestions from team members.'), AlpacaItem(instruction='What should contributors include in their pull requests?', input='', output='Contributors should include the following in their pull requests:\\n1. A clear title and description of the changes.\\n2. Links to any related issues.\\n3. Any necessary documentation or references.'), AlpacaItem(instruction='Explain the significance of following the pull request review process.', input='', output='Following the pull request review process is significant because it ensures that all contributions are evaluated for quality, functionality, and adherence to project standards, which helps maintain the integrity of the codebase.'), AlpacaItem(instruction='What are the best practices for writing unit tests in CAMEL?', input='', output='Best practices for writing unit tests in CAMEL include:\\n1. Ensure tests cover all edge cases and expected outcomes.\\n2. Keep tests isolated to avoid dependencies on other parts of the code.\\n3. Use descriptive names for test functions to clarify their purpose.'), AlpacaItem(instruction='What is the process for integrating new features into the CAMEL project?', input='', output='The process for integrating new features into the CAMEL project involves:\\n1. Submitting a feature request or proposal.\\n2. Developing the feature in a separate branch.\\n3. Creating a pull request for review once development is complete.'), AlpacaItem(instruction='Describe the importance of maintaining a clean and organized project structure in CAMEL.', input='', output='Maintaining a clean and organized project structure in CAMEL is important because it enhances code readability, facilitates easier navigation for contributors, and makes it simpler to manage and scale the project.'), AlpacaItem(instruction='What are the steps for conducting a retrospective after a sprint in CAMEL?', input='', output='The steps for conducting a retrospective after a sprint in CAMEL include:\\n1. Gathering team feedback on what went well and what could be improved.\\n2. Discussing challenges faced during the sprint.\\n3. Identifying actionable items to implement in the next sprint.'), AlpacaItem(instruction='What should contributors do to ensure their code is secure?', input='', output='To ensure their code is secure, contributors should:\\n1. Follow best practices for security in coding.\\n2. Review code for potential vulnerabilities.\\n3. Conduct security testing as part of the development process.'), AlpacaItem(instruction=\"What is the significance of the CAMEL community's code of conduct?\", input='', output=\"The significance of the CAMEL community's code of conduct is to promote a respectful and inclusive environment for all contributors, ensuring that everyone feels welcome and valued while participating in the project.\"), AlpacaItem(instruction='Explain the relationship between CAMEL and its contributors.', input='', output='The relationship between CAMEL and its contributors is collaborative; contributors provide enhancements, fixes, and documentation, while CAMEL offers a platform for sharing knowledge and fostering community engagement.'), AlpacaItem(instruction='What are the benefits of participating in the CAMEL community?', input='', output='The benefits of participating in the CAMEL community include:\\n1. Gaining experience in open-source development.\\n2. Networking with other developers and contributors.\\n3. Contributing to a project that aims to advance AI capabilities.'), AlpacaItem(instruction='Summarize the guidelines for writing clear commit messages in CAMEL.', input='', output=\"The guidelines for writing clear commit messages in CAMEL include:\\n1. Use the imperative mood to describe the changes (e.g., 'Add feature' instead of 'Added feature').\\n2. Keep messages concise and focused on the changes made.\\n3. Include references to related issues when applicable.\")]\n"+ ]+ }+ ],+ "source": [+ "import random\n",+ "from camel.loaders.firecrawl_reader import Firecrawl\n",+ "firecrawl = Firecrawl()\n",+ "# Scrape and clean content from a specified URL\n",+ "response = firecrawl.scrape(\n",+ " url=\"https://github.com/camel-ai/camel/blob/master/CONTRIBUTING.md\"\n",+ ")\n",+ "\n",+ "# Generate the items 50 a time up to 50\n",+ "alpaca_entries = []\n",+ "for start in range(1, 51, 50):\n",+ " # Combine default examples with random samples from previous generations\n",+ " current_examples = examples + (random.sample(alpaca_entries,\n",+ " min(5, len(alpaca_entries)))\n",+ " if alpaca_entries else [])\n",+ "\n",+ " batch = generate_alpaca_items(\n",+ " content=response[\"markdown\"],\n",+ " n_items=50,\n",+ " start_num=start,\n",+ " examples=current_examples\n",+ " )\n",+ " print(f\"Generated {len(batch)} items\")\n",+ " alpaca_entries.extend(batch)\n",+ "\n",+ "print(alpaca_entries)"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "metadata": {+ "colab": {+ "base_uri": "https://localhost:8080/"+ },+ "id": "frSMDZ-U2m2V",+ "outputId": "de992905-b4ee-4e2e-aef1-c45f6e8e6f84"+ },+ "outputs": [+ {+ "data": {+ "text/plain": [+ "50"+ ]+ },+ "execution_count": 6,+ "metadata": {},+ "output_type": "execute_result"+ }+ ],+ "source": [+ "len(alpaca_entries)"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {+ "id": "5Nr-DX502m2V"+ },+ "source": [+ "# ๐ Code for Conversion to Reward Model Format\n",+ "Next, we transform the Alpaca-style entries into a format compatible with the reward model. Each entry will be converted into a structured list of instruction-input-response pairs that the reward model can evaluate."+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "metadata": {+ "id": "FVYyGBSK2m2V"+ },+ "outputs": [],+ "source": [+ "messages_lists=[]\n",+ "for item in alpaca_entries:\n",+ " messages_list =[]\n",+ " user_content = item.instruction\n",+ " if item.input:\n",+ " user_content += f\"\\nInput: {item.input}\"\n",+ " messages_list.append({\"role\": \"user\", \"content\": user_content})\n",+ " messages_list.append({\"role\": \"assistant\", \"content\": item.output})\n",+ " messages_lists.append(messages_list)"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {+ "id": "hIuE1dImfBJG"+ },+ "source": [+ "# โจTest Reward Model\n",+ "Then, we can test the reward model to check its output format and use it as a reference to set the filtering criteria.\n"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "metadata": {+ "colab": {+ "base_uri": "https://localhost:8080/"+ },+ "id": "Ae3BVlbXfAmB",+ "outputId": "dddb3fc1-f1a2-4da7-dd0e-f4df8a3b4dc1"+ },+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "Evaluating message list 1:\n",+ "[{'role': 'user', 'content': 'Summarize the contributing guidelines for the CAMEL project.'}, {'role': 'assistant', 'content': 'The contributing guidelines for the CAMEL project include:\\n1. **Types of Contributions**: Contributions can include new features, infrastructure enhancements, documentation improvements, issue reporting, and bug fixes.\\n2. **Workflow**: Community contributors should follow the Fork-and-Pull-Request workflow, while members of CAMEL-AI.org should use the Checkout-and-Pull-Request workflow.\\n3. **Pull Requests**: Mention related issues and tag relevant maintainers. Pull requests must pass formatting, linting, and testing checks before merging.'}]\n",+ "Scores: {'helpfulness': 2.21875, 'correctness': 2.40625, 'coherence': 3.453125, 'complexity': 1.6640625, 'verbosity': 1.078125}\n",+ "\n",+ "Evaluating message list 2:\n",+ "[{'role': 'user', 'content': 'What are the steps for writing a cookbook entry for CAMEL?'}, {'role': 'assistant', 'content': 'The steps for writing a cookbook entry for CAMEL are:\\n1. **Template Usage**: Use the provided template for consistency.\\n2. **Writing in Colab**: Write your cookbook in Google Colab, ensuring that LLM-generated responses are correct and verified.\\n3. **Clear Explanations**: Provide clear explanations of the code and its purpose.\\n4. **Review and Submit**: After writing, review in Colab, then submit by downloading the notebook and creating a pull request.'}]\n",+ "Scores: {'helpfulness': 2.71875, 'correctness': 2.734375, 'coherence': 3.46875, 'complexity': 1.7109375, 'verbosity': 1.203125}\n",+ "\n",+ "Evaluating message list 3:\n",+ "[{'role': 'user', 'content': 'Describe the principles for writing docstrings in CAMEL.'}, {'role': 'assistant', 'content': 'The principles for writing docstrings in CAMEL include:\\n1. **Use Raw Strings**: Start with `r\"\"\"` to prevent issues with special characters.\\n2. **Brief Descriptions**: Provide a concise summary of the functionality at the beginning.\\n3. **Document Parameters**: Use an `Args` section to document parameters, including type and default values.'}]\n",+ "Scores: {'helpfulness': 1.5546875, 'correctness': 1.890625, 'coherence': 3.015625, 'complexity': 1.65625, 'verbosity': 0.6484375}\n",+ "\n",+ "Evaluating message list 4:\n",+ "[{'role': 'user', 'content': 'What is the process for conducting code reviews in CAMEL?'}, {'role': 'assistant', 'content': 'The process for conducting code reviews in CAMEL includes:\\n1. **Reviewers Check**: Reviewers assess code for functionality, readability, and compliance with standards.\\n2. **Feedback**: Leave constructive feedback where changes are necessary.\\n3. **Approval**: The code must be approved by at least two reviewers before merging.'}]\n",+ "Scores: {'helpfulness': 2.34375, 'correctness': 2.546875, 'coherence': 3.59375, 'complexity': 1.3984375, 'verbosity': 1.0625}\n",+ "\n",+ "Evaluating message list 5:\n",+ "[{'role': 'user', 'content': 'Outline the steps for submitting a cookbook to CAMEL.'}, {'role': 'assistant', 'content': 'The steps for submitting a cookbook to CAMEL are:\\n1. **Finalize in Colab**: Ensure that the Colab notebook is complete and reviewed.\\n2. **Download Notebook**: Download the finalized notebook as a .ipynb file.\\n3. **Create Pull Request**: Open a pull request to add the .ipynb file to the repository, including any necessary documentation.'}]\n",+ "Scores: {'helpfulness': 2.34375, 'correctness': 2.625, 'coherence': 3.546875, 'complexity': 1.46875, 'verbosity': 1.046875}\n",+ "\n",+ "Evaluating message list 6:\n",+ "[{'role': 'user', 'content': 'Explain the importance of code coverage in CAMEL.'}, {'role': 'assistant', 'content': 'Code coverage is important in CAMEL because it measures how much of the code is tested by unit tests. This helps in identifying robust areas of the codebase and areas that may need more testing, ensuring better reliability and maintainability of the code.'}]\n",+ "Scores: {'helpfulness': 2.78125, 'correctness': 2.875, 'coherence': 3.8125, 'complexity': 1.7734375, 'verbosity': 1.0234375}\n",+ "\n",+ "Evaluating message list 7:\n",+ "[{'role': 'user', 'content': 'What are the guidelines for labeling pull requests in CAMEL?'}, {'role': 'assistant', 'content': 'The guidelines for labeling pull requests in CAMEL include:\\n- **feat**: For new features.\\n- **fix**: For bug fixes.\\n- **docs**: For documentation updates.\\n- **style**: For code style changes.\\n- **refactor**: For code refactoring.\\n- **test**: For adding or updating tests.\\n- **chore**: For maintenance tasks.'}]\n",+ "Scores: {'helpfulness': 2.859375, 'correctness': 2.984375, 'coherence': 3.78125, 'complexity': 1.6171875, 'verbosity': 1.1328125}\n",+ "\n",+ "Evaluating message list 8:\n",+ "[{'role': 'user', 'content': 'What communication channels are available for CAMEL contributors?'}, {'role': 'assistant', 'content': 'The communication channels available for CAMEL contributors include:\\n- **Discord**: For real-time communication.\\n- **WeChat**: For Chinese-speaking contributors.\\n- **Slack**: For team collaboration.'}]\n",+ "Scores: {'helpfulness': 1.4296875, 'correctness': 1.6796875, 'coherence': 3.59375, 'complexity': 0.796875, 'verbosity': 0.546875}\n",+ "\n",+ "Evaluating message list 9:\n",+ "[{'role': 'user', 'content': 'Describe the purpose of the sprint planning process in CAMEL.'}, {'role': 'assistant', 'content': 'The purpose of the sprint planning process in CAMEL is to define what can be delivered in the upcoming sprint and how those goals will be achieved. It ensures that the team has a clear understanding of the sprint objectives and tasks to focus on.'}]\n",+ "Scores: {'helpfulness': 2.84375, 'correctness': 2.984375, 'coherence': 3.890625, 'complexity': 1.6015625, 'verbosity': 0.95703125}\n",+ "\n",+ "Evaluating message list 10:\n",+ "[{'role': 'user', 'content': 'What are the key components of the CAMEL project license?'}, {'role': 'assistant', 'content': 'The CAMEL project is licensed under Apache 2.0, which means that contributions will also be licensed under the same terms by default. Contributors can add the license manually or use a script to automate the process.'}]\n",+ "Scores: {'helpfulness': 1.890625, 'correctness': 1.828125, 'coherence': 3.5625, 'complexity': 1.3515625, 'verbosity': 0.65625}\n",+ "\n",+ "\n",+ "Summary of evaluations:\n",+ "Message List 1:\n",+ "[{'role': 'user', 'content': 'Summarize the contributing guidelines for the CAMEL project.'}, {'role': 'assistant', 'content': 'The contributing guidelines for the CAMEL project include:\\n1. **Types of Contributions**: Contributions can include new features, infrastructure enhancements, documentation improvements, issue reporting, and bug fixes.\\n2. **Workflow**: Community contributors should follow the Fork-and-Pull-Request workflow, while members of CAMEL-AI.org should use the Checkout-and-Pull-Request workflow.\\n3. **Pull Requests**: Mention related issues and tag relevant maintainers. Pull requests must pass formatting, linting, and testing checks before merging.'}]\n",+ "Scores: {'helpfulness': 2.21875, 'correctness': 2.40625, 'coherence': 3.453125, 'complexity': 1.6640625, 'verbosity': 1.078125}\n",+ "\n",+ "Message List 2:\n",+ "[{'role': 'user', 'content': 'What are the steps for writing a cookbook entry for CAMEL?'}, {'role': 'assistant', 'content': 'The steps for writing a cookbook entry for CAMEL are:\\n1. **Template Usage**: Use the provided template for consistency.\\n2. **Writing in Colab**: Write your cookbook in Google Colab, ensuring that LLM-generated responses are correct and verified.\\n3. **Clear Explanations**: Provide clear explanations of the code and its purpose.\\n4. **Review and Submit**: After writing, review in Colab, then submit by downloading the notebook and creating a pull request.'}]\n",+ "Scores: {'helpfulness': 2.71875, 'correctness': 2.734375, 'coherence': 3.46875, 'complexity': 1.7109375, 'verbosity': 1.203125}\n",+ "\n",+ "Message List 3:\n",+ "[{'role': 'user', 'content': 'Describe the principles for writing docstrings in CAMEL.'}, {'role': 'assistant', 'content': 'The principles for writing docstrings in CAMEL include:\\n1. **Use Raw Strings**: Start with `r\"\"\"` to prevent issues with special characters.\\n2. **Brief Descriptions**: Provide a concise summary of the functionality at the beginning.\\n3. **Document Parameters**: Use an `Args` section to document parameters, including type and default values.'}]\n",+ "Scores: {'helpfulness': 1.5546875, 'correctness': 1.890625, 'coherence': 3.015625, 'complexity': 1.65625, 'verbosity': 0.6484375}\n",+ "\n",+ "Message List 4:\n",+ "[{'role': 'user', 'content': 'What is the process for conducting code reviews in CAMEL?'}, {'role': 'assistant', 'content': 'The process for conducting code reviews in CAMEL includes:\\n1. **Reviewers Check**: Reviewers assess code for functionality, readability, and compliance with standards.\\n2. **Feedback**: Leave constructive feedback where changes are necessary.\\n3. **Approval**: The code must be approved by at least two reviewers before merging.'}]\n",+ "Scores: {'helpfulness': 2.34375, 'correctness': 2.546875, 'coherence': 3.59375, 'complexity': 1.3984375, 'verbosity': 1.0625}\n",+ "\n",+ "Message List 5:\n",+ "[{'role': 'user', 'content': 'Outline the steps for submitting a cookbook to CAMEL.'}, {'role': 'assistant', 'content': 'The steps for submitting a cookbook to CAMEL are:\\n1. **Finalize in Colab**: Ensure that the Colab notebook is complete and reviewed.\\n2. **Download Notebook**: Download the finalized notebook as a .ipynb file.\\n3. **Create Pull Request**: Open a pull request to add the .ipynb file to the repository, including any necessary documentation.'}]\n",+ "Scores: {'helpfulness': 2.34375, 'correctness': 2.625, 'coherence': 3.546875, 'complexity': 1.46875, 'verbosity': 1.046875}\n",+ "\n",+ "Message List 6:\n",+ "[{'role': 'user', 'content': 'Explain the importance of code coverage in CAMEL.'}, {'role': 'assistant', 'content': 'Code coverage is important in CAMEL because it measures how much of the code is tested by unit tests. This helps in identifying robust areas of the codebase and areas that may need more testing, ensuring better reliability and maintainability of the code.'}]\n",+ "Scores: {'helpfulness': 2.78125, 'correctness': 2.875, 'coherence': 3.8125, 'complexity': 1.7734375, 'verbosity': 1.0234375}\n",+ "\n",+ "Message List 7:\n",+ "[{'role': 'user', 'content': 'What are the guidelines for labeling pull requests in CAMEL?'}, {'role': 'assistant', 'content': 'The guidelines for labeling pull requests in CAMEL include:\\n- **feat**: For new features.\\n- **fix**: For bug fixes.\\n- **docs**: For documentation updates.\\n- **style**: For code style changes.\\n- **refactor**: For code refactoring.\\n- **test**: For adding or updating tests.\\n- **chore**: For maintenance tasks.'}]\n",+ "Scores: {'helpfulness': 2.859375, 'correctness': 2.984375, 'coherence': 3.78125, 'complexity': 1.6171875, 'verbosity': 1.1328125}\n",+ "\n",+ "Message List 8:\n",+ "[{'role': 'user', 'content': 'What communication channels are available for CAMEL contributors?'}, {'role': 'assistant', 'content': 'The communication channels available for CAMEL contributors include:\\n- **Discord**: For real-time communication.\\n- **WeChat**: For Chinese-speaking contributors.\\n- **Slack**: For team collaboration.'}]\n",+ "Scores: {'helpfulness': 1.4296875, 'correctness': 1.6796875, 'coherence': 3.59375, 'complexity': 0.796875, 'verbosity': 0.546875}\n",+ "\n",+ "Message List 9:\n",+ "[{'role': 'user', 'content': 'Describe the purpose of the sprint planning process in CAMEL.'}, {'role': 'assistant', 'content': 'The purpose of the sprint planning process in CAMEL is to define what can be delivered in the upcoming sprint and how those goals will be achieved. It ensures that the team has a clear understanding of the sprint objectives and tasks to focus on.'}]\n",+ "Scores: {'helpfulness': 2.84375, 'correctness': 2.984375, 'coherence': 3.890625, 'complexity': 1.6015625, 'verbosity': 0.95703125}\n",+ "\n",+ "Message List 10:\n",+ "[{'role': 'user', 'content': 'What are the key components of the CAMEL project license?'}, {'role': 'assistant', 'content': 'The CAMEL project is licensed under Apache 2.0, which means that contributions will also be licensed under the same terms by default. Contributors can add the license manually or use a script to automate the process.'}]\n",+ "Scores: {'helpfulness': 1.890625, 'correctness': 1.828125, 'coherence': 3.5625, 'complexity': 1.3515625, 'verbosity': 0.65625}\n",+ "\n"+ ]+ }+ ],+ "source": [+ "from camel.models.reward import Evaluator, NemotronRewardModel\n",+ "from camel.types import ModelType\n",+ "\n",+ "reward_model = NemotronRewardModel(\n",+ " model_type=ModelType.NVIDIA_NEMOTRON_340B_REWARD,\n",+ " url=\"https://integrate.api.nvidia.com/v1\",\n",+ ")\n",+ "evaluator = Evaluator(reward_model=reward_model)\n",+ "results = [] # To store results for comparison\n",+ "for i in range(min(10, len(messages_lists))):\n",+ " print(f\"Evaluating message list {i+1}:\")\n",+ " print(messages_lists[i]) # Display the message list\n",+ " scores = evaluator.evaluate(messages_lists[i])\n",+ " print(f\"Scores: {scores}\\n\") # Print the evaluation scores\n",+ " results.append((i + 1, messages_lists[i], scores))\n",+ "\n",+ "# Print a summary of the results\n",+ "print(\"\\nSummary of evaluations:\")\n",+ "for index, messages, scores in results:\n",+ " print(f\"Message List {index}:\")\n",+ " print(messages)\n",+ " print(f\"Scores: {scores}\\n\")\n"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {+ "id": "9kbfgqwY2m2V"+ },+ "source": [+ " # ๐ฏFiltering the Generated Data Using the Reward Model\n",+ " Finally, we utilize NVIDIA's Nemotron Reward Model to filter out low-quality instruction-input-response triplets. The model evaluates each response based on defined thresholds for metrics such as helpfulness and correctness.\n",+ "\n",+ " Let's use thresholds = {\"helpfulness\": 2.5, \"correctness\": 2.5} as an example of filter parameters. After filtering, some high-quality triplets are retained."+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "metadata": {+ "colab": {+ "base_uri": "https://localhost:8080/"+ },+ "id": "gVlhSTXO2m2V",+ "outputId": "d7205b6e-d2e8-42af-d1d5-88b964273a49"+ },+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "18\n"+ ]+ }+ ],+ "source": [+ "thresholds = {\"helpfulness\": 2.5, \"correctness\": 2.5}\n",+ "filtered_messages_lists = []\n",+ "for messages_list in messages_lists:\n",+ " response = evaluator.filter_data(messages_list, thresholds)\n",+ " if response:\n",+ " filtered_messages_lists.append(messages_list)\n",+ "\n",+ "print(len(filtered_messages_lists))\n"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "metadata": {+ "colab": {+ "base_uri": "https://localhost:8080/"+ },+ "id": "VF-KQ3dgsrgy",+ "outputId": "b9ccc85c-a05c-4831-ec85-68046f9488d2"+ },+ "outputs": [+ {+ "data": {+ "text/plain": [+ "[[{'role': 'user',\n",+ " 'content': 'What are the steps for writing a cookbook entry for CAMEL?'},\n",+ " {'role': 'assistant',\n",+ " 'content': 'The steps for writing a cookbook entry for CAMEL are:\\n1. **Template Usage**: Use the provided template for consistency.\\n2. **Writing in Colab**: Write your cookbook in Google Colab, ensuring that LLM-generated responses are correct and verified.\\n3. **Clear Explanations**: Provide clear explanations of the code and its purpose.\\n4. **Review and Submit**: After writing, review in Colab, then submit by downloading the notebook and creating a pull request.'}],\n",+ " [{'role': 'user',\n",+ " 'content': 'Explain the importance of code coverage in CAMEL.'},\n",+ " {'role': 'assistant',\n",+ " 'content': 'Code coverage is important in CAMEL because it measures how much of the code is tested by unit tests. This helps in identifying robust areas of the codebase and areas that may need more testing, ensuring better reliability and maintainability of the code.'}],\n",+ " [{'role': 'user',\n",+ " 'content': 'What are the guidelines for labeling pull requests in CAMEL?'},\n",+ " {'role': 'assistant',\n",+ " 'content': 'The guidelines for labeling pull requests in CAMEL include:\\n- **feat**: For new features.\\n- **fix**: For bug fixes.\\n- **docs**: For documentation updates.\\n- **style**: For code style changes.\\n- **refactor**: For code refactoring.\\n- **test**: For adding or updating tests.\\n- **chore**: For maintenance tasks.'}],\n",+ " [{'role': 'user',\n",+ " 'content': 'Describe the purpose of the sprint planning process in CAMEL.'},\n",+ " {'role': 'assistant',\n",+ " 'content': 'The purpose of the sprint planning process in CAMEL is to define what can be delivered in the upcoming sprint and how those goals will be achieved. It ensures that the team has a clear understanding of the sprint objectives and tasks to focus on.'}],\n",+ " [{'role': 'user',\n",+ " 'content': 'What are the key principles to follow when writing entries for the CAMEL cookbook?'},\n",+ " {'role': 'assistant',\n",+ " 'content': 'The key principles for writing entries for the CAMEL cookbook include:\\n1. High Quality: Ensure accurate code and clear explanations.\\n2. Correctness: Validate LLM-generated responses with real code execution.\\n3. Accessibility: Make content understandable for all users, from beginners to advanced.'}],\n",+ " [{'role': 'user',\n",+ " 'content': 'What is the purpose of the code review checklist in CAMEL?'},\n",+ " {'role': 'assistant',\n",+ " 'content': 'The purpose of the code review checklist in CAMEL is to ensure that all contributions maintain high quality by evaluating functionality, code quality, design consistency, and documentation before merging into the main branch.'}],\n",+ " [{'role': 'user',\n",+ " 'content': \"What is the significance of the 'Fork-and-Pull-Request' workflow in CAMEL?\"},\n",+ " {'role': 'assistant',\n",+ " 'content': \"The 'Fork-and-Pull-Request' workflow in CAMEL is significant because it allows contributors to work on their own copy of the project and submit changes for review, ensuring that contributions are managed efficiently and collaboratively.\"}],\n",+ " [{'role': 'user',\n",+ " 'content': 'What should contributors do if they encounter challenges during the setup process?'},\n",+ " {'role': 'assistant',\n",+ " 'content': 'If contributors encounter challenges during the setup process in CAMEL, they should reach out to a maintainer for assistance to ensure a smooth experience.'}],\n",+ " [{'role': 'user',\n",+ " 'content': 'What are the steps to create a new issue on the CAMEL GitHub repository?'},\n",+ " {'role': 'assistant',\n",+ " 'content': \"To create a new issue on the CAMEL GitHub repository, follow these steps:\\n1. Go to the issues page on GitHub.\\n2. Click on 'New Issue' and fill in the required information, including a proper title and description.\\n3. Assign labels and update the assignees and milestones as necessary.\"}],\n",+ " [{'role': 'user',\n",+ " 'content': \"What should contributors do to maintain the project's coding standards?\"},\n",+ " {'role': 'assistant',\n",+ " 'content': \"To maintain the project's coding standards, contributors should:\\n1. Follow the established style guidelines.\\n2. Use tools like Ruff for formatting and linting checks.\\n3. Ensure documentation is up-to-date and comprehensive.\"}],\n",+ " [{'role': 'user',\n",+ " 'content': 'Describe the importance of unit tests in the CAMEL project.'},\n",+ " {'role': 'assistant',\n",+ " 'content': 'Unit tests are important in the CAMEL project because they verify that individual components of the code work as expected, helping to catch bugs early and ensuring code reliability.'}],\n",+ " [{'role': 'user',\n",+ " 'content': 'What should contributors include in their pull requests?'},\n",+ " {'role': 'assistant',\n",+ " 'content': 'Contributors should include the following in their pull requests:\\n1. A clear title and description of the changes.\\n2. Links to any related issues.\\n3. Any necessary documentation or references.'}],\n",+ " [{'role': 'user',\n",+ " 'content': 'Explain the significance of following the pull request review process.'},\n",+ " {'role': 'assistant',\n",+ " 'content': 'Following the pull request review process is significant because it ensures that all contributions are evaluated for quality, functionality, and adherence to project standards, which helps maintain the integrity of the codebase.'}],\n",+ " [{'role': 'user',\n",+ " 'content': 'Describe the importance of maintaining a clean and organized project structure in CAMEL.'},\n",+ " {'role': 'assistant',\n",+ " 'content': 'Maintaining a clean and organized project structure in CAMEL is important because it enhances code readability, facilitates easier navigation for contributors, and makes it simpler to manage and scale the project.'}],\n",+ " [{'role': 'user',\n",+ " 'content': \"What is the significance of the CAMEL community's code of conduct?\"},\n",+ " {'role': 'assistant',\n",+ " 'content': \"The significance of the CAMEL community's code of conduct is to promote a respectful and inclusive environment for all contributors, ensuring that everyone feels welcome and valued while participating in the project.\"}],\n",+ " [{'role': 'user',\n",+ " 'content': 'Explain the relationship between CAMEL and its contributors.'},\n",+ " {'role': 'assistant',\n",+ " 'content': 'The relationship between CAMEL and its contributors is collaborative; contributors provide enhancements, fixes, and documentation, while CAMEL offers a platform for sharing knowledge and fostering community engagement.'}],\n",+ " [{'role': 'user',\n",+ " 'content': 'What are the benefits of participating in the CAMEL community?'},\n",+ " {'role': 'assistant',\n",+ " 'content': 'The benefits of participating in the CAMEL community include:\\n1. Gaining experience in open-source development.\\n2. Networking with other developers and contributors.\\n3. Contributing to a project that aims to advance AI capabilities.'}],\n",+ " [{'role': 'user',\n",+ " 'content': 'Summarize the guidelines for writing clear commit messages in CAMEL.'},\n",+ " {'role': 'assistant',\n",+ " 'content': \"The guidelines for writing clear commit messages in CAMEL include:\\n1. Use the imperative mood to describe the changes (e.g., 'Add feature' instead of 'Added feature').\\n2. Keep messages concise and focused on the changes made.\\n3. Include references to related issues when applicable.\"}]]"+ ]+ },+ "execution_count": 11,+ "metadata": {},+ "output_type": "execute_result"+ }+ ],+ "source": [+ "filtered_messages_lists"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {+ "id": "emHCz7p9sum1"+ },+ "source": [+ "## ๐ Highlights\n",+ "\n",+ "That's everything: Got questions about ๐ซ CAMEL-AI? Join us on [Discord](https://discord.camel-ai.org)! Whether you want to share feedback, explore the latest in multi-agent systems, get support, or connect with others on exciting projects, weโd love to have you in the community! ๐ค\n",+ "\n",+ "Summary of This Cookbook:\n",+ "In this cookbook, we demonstrated how to leverage CAMEL-AI to filter generate data. This practical guide helps you efficiently evaluate synthetic data.\n",+ "\n",+ "Check out some of our other work:\n",+ "\n",+ "1. ๐ซ Creating Your First CAMEL Agent [free Colab](https://docs.camel-ai.org/cookbooks/create_your_first_agent.html)\n",+ "\n",+ "2. ๐ฅ 3 ways to ingest data from websites with Firecrawl & CAMEL [free Colab](https://colab.research.google.com/drive/1lOmM3VmgR1hLwDKdeLGFve_75RFW0R9I?usp=sharing)\n",+ "\n",+ "3. ๐ฆฅ Agentic SFT Data Generation with CAMEL and Mistral Models, Fine-Tuned with Unsloth [free Colab](https://colab.research.google.com/drive/1lYgArBw7ARVPSpdwgKLYnp_NEXiNDOd-?usp=sharingg)\n",+ "\n",+ "Thanks from everyone at ๐ซ CAMEL-AI\n",+ "\n",+ "\n",+ "<div class=\"align-center\">\n",+ " <a href=\"https://www.camel-ai.org/\"><img src=\"https://i.postimg.cc/KzQ5rfBC/button.png\"width=\"150\"></a>\n",+ " <a href=\"https://discord.camel-ai.org\"><img src=\"https://i.postimg.cc/L4wPdG9N/join-2.png\" width=\"150\"></a></a>\n",+ " \n",+ "โญ <i>Star us on <a href=\"https://github.com/camel-ai/camel\">Github</a> </i>, join our [*Discord*](https://discord.camel-ai.org) or follow our [*X*](https://x.com/camelaiorg) โญ\n",+ "</div>"+ ]+ }+ ],+ "metadata": {+ "colab": {+ "provenance": []+ },+ "kernelspec": {+ "display_name": "camel-ai-8RlHKqzd-py3.11",+ "language": "python",+ "name": "python3"+ },+ "language_info": {+ "codemirror_mode": {+ "name": "ipython",+ "version": 3+ },+ "file_extension": ".py",+ "mimetype": "text/x-python",+ "name": "python",+ "nbconvert_exporter": "python",+ "pygments_lexer": "ipython3",+ "version": "3.11.5"+ }+ },+ "nbformat": 4,+ "nbformat_minor": 0+}diff --git a/examples/models/reward/nemotron_model_example.py b/examples/models/reward/nemotron_model_example.pyindex 2371ab3c2..03ac50078 100644--- a/examples/models/reward/nemotron_model_example.py+++ b/examples/models/reward/nemotron_model_example.py@@ -47,8 +47,8 @@ Types: ['helpfulness', 'correctness', 'coherence', 'complexity', 'verbosity']==============================================================================='''-threshoids = {"helpfulness": 1.5, "correctness": 1.5}-is_acceptable = evaluator.filter_data(messages, threshoids)+thresholds = {"helpfulness": 1.5, "correctness": 1.5}+is_acceptable = evaluator.filter_data(messages, thresholds)print("Is acceptable: ", is_acceptable)'''===============================================================================