Data Gen with Real Function Calls and Hermes Format#

Star the Repo

If you find CAMEL useful or interesting, please consider giving it a star on our CAMEL GitHub Repo! Your stars help others find this project and motivate us to continue improving it.

Overview#

This tutorial guides you through generating user queries and structured tool call data using ChatAgent with real tools. We’ll cover setting up the model, generating user-like queries, and saving the output with Hermes style function calling in JSON format.

Installation#

Ensure you have CAMEL AI and desired dependencies installed in your Python environment:

[ ]:
!pip install --upgrade git+https://github.com/camel-ai/camel.git@19530bfe1de9fa74b24e1eab9050ac927d820d65
!pip install duckduckgo_search==6.3.6
!pip install wikipedia==1.4.0
!pip install unstructured==0.16.6

Step 1: Import Required Libraries and Modules#

Start by importing necessary libraries and modules.

[ ]:
import json
from typing import Callable, List, Union, Any

# Import necessary classes and functions from camel library
from camel.agents import ChatAgent
from camel.messages import FunctionCallingMessage
from camel.messages import HermesFunctionFormatter
from camel.messages import ShareGPTConversation
from camel.messages import ShareGPTMessage
from camel.models import ModelFactory
from camel.toolkits import FunctionTool, MathToolkit, SearchToolkit
from camel.types import ModelPlatformType, ModelType

[ ]:
import os
from getpass import getpass
# Prompt for the OpenAI API key securely
openai_api_key = getpass('Enter your OpenAI API key: ')
os.environ["OPENAI_API_KEY"] = openai_api_key
Enter your OpenAI API key: ··········

Step 2: Define Function to Generate User Queries#

This function leverages specific tools to generate human-like queries. We’ll set up a ChatAgent to create relevant, tool-specific user queries.

[ ]:
def generate_user_query(selected_tool: Union[Callable, FunctionTool],
                        n: int = 1) -> List[str]:
    r"""Generates user queries by leveraging specific tools, helping the
    ChatAgent craft
    human-like queries that take advantage of each tool's functionality.

    Args:
        selected_tool (Union[Callable, FunctionTool]): The tool to leverage for
        query generation.
        n (int, optional): The number of queries to generate. Defaults to 1.
    """

    tool_call_sys_msg = (
        "You are a smart query generator designed to utilize specific tools "
        "based on user needs. "
        "Formulate queries as a human user would."

        "Instructions:\n"
        "1. Envision a real-world scenario, but don't say it out loud."
        "2. Craft a realistically phrased actionable query fitting that scenario"
        " that could be satisfied with the provided tool(s)\n"
        "3. With the tool(s) in mind, phrase the query naturally and "
        "informatively.\n"
        "4. Only rely on information from tools they appear likely to "
        "provide\n"
        "5. Pose the query as if the user doesn't know what tools are "
        "available."
    )

    # Convert to FunctionTool if necessary
    if not isinstance(selected_tool, FunctionTool):
        selected_tool = FunctionTool(selected_tool)

    # Create a model instance for generating queries
    query_model = ModelFactory.create(
        model_platform=ModelPlatformType.OPENAI,
        model_type=ModelType.GPT_4O_MINI,
        model_config_dict={"temperature": 1}
    )

    # Initialize ChatAgent with the system message
    query_agent = ChatAgent(
        system_message=tool_call_sys_msg,
        model=query_model,
    )
    queries = []

    # Prepare tools info message for guiding query generation
    tools_info_message = (
            "Generate a relevant query based on the following tool "
            "details:\n\n" +
            "\n".join(f"Tool Schema: {selected_tool.get_openai_tool_schema()}")
    )

    # Generate queries
    for _ in range(n):
        response = query_agent.step(tools_info_message)
        queries.append(response.msgs[0].content)  # Extract the generated query

    return queries

Step 3: Define Function to Generate Structured Tool Call Data#

This function will structure tool call data based on user queries by leveraging each selected tool.

[ ]:
def generate_tool_call_data(user_messages: List[str],
                            selected_tool: Union[Callable, FunctionTool]) -> \
        list[Any]:
    r"""Generates structured tool call data for a list of user messages by
    using each specified tool in selected_tools.
    """

    # Convert to FunctionTool if necessary
    if not isinstance(selected_tool, FunctionTool):
        selected_tool = FunctionTool(selected_tool)

    # Define system message guiding ChatAgent on function calls
    base_system_msg = "You are a function calling AI model. "
    hermes_tool_call_sys_msg = (
        f"You are a function calling AI model. You are provided with "
        f"function signatures within <tools> </tools> XML tags. You may call "
        f"one or more functions to assist with the user query. If available "
        f"tools are not relevant in assisting with user query, just respond "
        f"in natural conversational language. Don't make assumptions about "
        f"what values to plug into functions. After calling & executing the "
        f"functions, you will be provided with function results within "
        f"<tool_response> </tool_response> XML tags."
        f"\n <tools> \n"
        f"{[selected_tool.get_openai_tool_schema()]}"
        f"\n </tools>\n"
        "For each function call return a JSON object, with the following "
        "pydantic model json schema:{'title': 'FunctionCall', 'type': "
        "'object', 'properties': {'name': {'title': 'Name', 'type': "
        "'string'}, 'arguments': {'title': 'Arguments', 'type': 'object'}}, "
        "'required': ['arguments', 'name']}\n"
        f"Each function call should be enclosed within <tool_call> "
        f"</tool_call> XML tags.\n"
        f"Example:\n"
        f"<tool_call>\n"
        "{'name': <function-name>, 'arguments': <args-dict>}\n"
        "</tool_call>"
        f"")
    sys_hermes = ShareGPTMessage(from_='system',
                                 value=hermes_tool_call_sys_msg)
    # Initialize model for tool call data generation
    tool_model = ModelFactory.create(
        model_platform=ModelPlatformType.OPENAI,
        model_type=ModelType.GPT_4O_MINI,
    )

    all_tool_data = {}

    tool_output_data = []
    for user_message in user_messages:
        # Set up ChatAgent with the system message, model, and the single tool
        tool_agent = ChatAgent(
            system_message=base_system_msg,
            model=tool_model,
            tools=[selected_tool],
        )

        # Generate response using ChatAgent and structured output
        try:
            tool_agent.step(user_message)
        except Exception as e:
            print(f"Error: {e}")
            continue
        messages = [record.memory_record.message for record in
                    tool_agent.memory.retrieve()]

        sharegpt_hermes_msgs = \
            [sys_hermes] + [msg.to_sharegpt(HermesFunctionFormatter()) for msg
                            in messages[1:]]

        # Only include conversations with function calls
        if any(type(message) == FunctionCallingMessage for message in
               messages):
            tool_output_data.append(
                json.loads(
                    ShareGPTConversation(sharegpt_hermes_msgs)
                    .model_dump_json(by_alias=True))
            )

    # Add generated data to the dictionary with tool name as the key
    all_tool_data[selected_tool.func.__name__] = tool_output_data

    return tool_output_data

Step 4: Initialize Toolkits and Define Tools List#

We’ll set up toolkits we want to be used

[ ]:
# API keys can be setup in the notebook like this
# google_api_key = getpass('Enter your API key: ')
# os.environ["GOOGLE_API_KEY"] = google_api_key
# weather_api_key = getpass('Enter your API key: ')
# os.environ["OPENWEATHERMAP_API_KEY"] = weather_api_key

selected_tools = [
    *MathToolkit().get_tools(),
    # Add more tools as needed, though they require API keys
    *[  # Search tools with no API keys required
        FunctionTool(SearchToolkit().search_duckduckgo),
        FunctionTool(SearchToolkit().search_wiki),
    ],
    # FunctionTool(SearchToolkit().search_google),
    # *ArxivToolkit().get_tools(),
    # *GoogleMapsToolkit().get_tools(),
    # *WeatherToolkit().get_tools(),
]


Step 5: Generate Data and Save to JSON#

We now loop through each tool, generate queries, create tool call data, and save it all in JSON format.

[ ]:
results = {
    "generated_queries": [],
    "tool_call_data": []
}

for selected_tool in selected_tools:
    user_queries = generate_user_query(selected_tool=selected_tool, n=5)
    tool_call_data = generate_tool_call_data(user_queries, selected_tool)

    # Append results to the lists instead of overwriting
    results["generated_queries"].extend(user_queries)
    results["tool_call_data"].extend(tool_call_data)

# Specify output file path
output_file = "generated_tool_call_data.json"

# Save data to JSON file
with open(output_file, "w") as f:
    json.dump(results, f, indent=4)

print(f"Data saved to {output_file}")

Error: Execution of function search_duckduckgo failed with arguments () and {'query': 'impact of climate change on coastal cities', 'max_results': 5}. Error: https://links.duckduckgo.com/d.js?q=impact+of+climate+change+on+coastal+cities&kl=wt-wt&l=wt-wt&p=&s=0&df=&vqd=4-158770472665703015018404199429899637302&bing_market=wt-WT&ex=-1 202 Ratelimit
Error: Execution of function search_duckduckgo failed with arguments () and {'query': 'latest trends in renewable energy technologies', 'max_results': 5}. Error: https://links.duckduckgo.com/d.js?q=latest+trends+in+renewable+energy+technologies&kl=wt-wt&l=wt-wt&p=&s=0&df=&vqd=4-94360203330343493466750153441163701920&bing_market=wt-WT&ex=-1 202 Ratelimit
Data saved to generated_tool_call_data.json

Step 6: Verify the JSON Output#

Open the generated JSON file and verify that the tool call data has been saved correctly.

[ ]:
# Load and display data to ensure correctness
with open(output_file, "r") as f:
    data = json.load(f)

print("Sample data:", json.dumps(data["generated_queries"][:100], indent=4))  # Display sample queries
print("\nSample tool call data:", json.dumps(data["tool_call_data"][:100], indent=4))  # Display sample tool call data

Sample data: [
    "I need to calculate the sum of two numbers. Can you help me by adding the numbers 25 and 15 together?",
    "Can you add the numbers 7 and 12 for me? What's the result of that addition?",
    "Could you help me find the sum of the numbers 34 and 56? What does that addition equal?",
    "Can you calculate the result of adding the numbers 18 and 27 together? What is their sum?",
    "Could you add the numbers 50 and 75 for me? What is the result of that addition?",
    "Could you help me find the result of subtracting two integers? I have the first number and the second number I want to subtract, and I'm not sure how to calculate it.",
    "I'm looking to calculate the difference between two whole numbers. Can you assist me in performing this subtraction by providing the result when I input the minuend and the subtrahend?",
    "I need to perform a subtraction calculation between two integers. Can you help me by providing the result if I give you the minuend and the subtrahend?",
    "Can you assist me in calculating the result of subtracting one integer from another? I have the minuend and the subtrahend ready to input.",
    "I need help performing a subtraction between two integers. Could you provide the difference if I give you the minuend and the subtrahend?",
    "Can you help me find the product of two integers? I need to multiply, for example, 6 and 7. What would be the result?",
    "I'm looking to multiply two integers together. Can you give me the result of multiplying 12 and 5?",
    "Could you help me calculate the product of two integers? Specifically, I'm interested in multiplying 4 and 9 together. What is the result?",
    "Can you give me the product of two integers? I'm looking to multiply 3 and 8. What would be the answer?",
    "I'm trying to find the product of two integers. Can you help me calculate the result of multiplying 15 and 4?",
    "I'm looking for some information regarding the benefits of meditation. Can you help me find relevant articles or resources that discuss this topic?",
    "Can you help me find some articles or resources about the impact of climate change on coastal cities? I'm looking for a few key pieces of information on this topic.",
    "I need to gather information about the latest trends in renewable energy technologies. Can you find some resources or articles on this subject for me?",
    "I'm researching the effects of fast fashion on the environment and would like to find some relevant articles or studies on this topic. Can you help me locate some resources?",
    "I'm looking for information about the health benefits of yoga. Can you help me find some articles or studies that discuss this topic?",
    "I'm curious to learn more about electric cars. Can you provide a summary of the relevant information available on Wikipedia about electric cars?",
    "I would like to find some detailed information on climate change. Can you help me get a summary from Wikipedia regarding climate change?",
    "I'm interested in learning about renewable energy sources. Could you provide me with a summary from Wikipedia regarding renewable energy?",
    "I'd like to gather some information about the history of the Internet. Can you help me find a summary from Wikipedia on this topic?",
    "I want to learn about the theory of relativity. Could you help me find a summary from Wikipedia on this subject?"
]

Sample tool call data: [
    [
        {
            "from": "system",
            "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. If available tools are not relevant in assisting with user query, just respond in natural conversational language. Don't make assumptions about what values to plug into functions. After calling & executing the functions, you will be provided with function results within <tool_response> </tool_response> XML tags.\n <tools> \n[{'type': 'function', 'function': {'name': 'add', 'description': 'Adds two numbers.', 'parameters': {'properties': {'a': {'type': 'integer', 'description': 'The first number to be added.'}, 'b': {'type': 'integer', 'description': 'The second number to be added.'}}, 'required': ['a', 'b'], 'type': 'object'}}}]\n </tools>\nFor each function call return a JSON object, with the following pydantic model json schema:{'title': 'FunctionCall', 'type': 'object', 'properties': {'name': {'title': 'Name', 'type': 'string'}, 'arguments': {'title': 'Arguments', 'type': 'object'}}, 'required': ['arguments', 'name']}\nEach function call should be enclosed within <tool_call> </tool_call> XML tags.\nExample:\n<tool_call>\n{'name': <function-name>, 'arguments': <args-dict>}\n</tool_call>"
        },
        {
            "from": "human",
            "value": "I need to calculate the sum of two numbers. Can you help me by adding the numbers 25 and 15 together?"
        },
        {
            "from": "gpt",
            "value": "\n<tool_call>\n{'name': 'add', 'arguments': {'a': 25, 'b': 15}}\n</tool_call>"
        },
        {
            "from": "tool",
            "value": "<tool_response>\n{'name': 'add', 'content': 40}\n</tool_response>"
        },
        {
            "from": "gpt",
            "value": "The sum of 25 and 15 is 40."
        }
    ],
    [
        {
            "from": "system",
            "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. If available tools are not relevant in assisting with user query, just respond in natural conversational language. Don't make assumptions about what values to plug into functions. After calling & executing the functions, you will be provided with function results within <tool_response> </tool_response> XML tags.\n <tools> \n[{'type': 'function', 'function': {'name': 'add', 'description': 'Adds two numbers.', 'parameters': {'properties': {'a': {'type': 'integer', 'description': 'The first number to be added.'}, 'b': {'type': 'integer', 'description': 'The second number to be added.'}}, 'required': ['a', 'b'], 'type': 'object'}}}]\n </tools>\nFor each function call return a JSON object, with the following pydantic model json schema:{'title': 'FunctionCall', 'type': 'object', 'properties': {'name': {'title': 'Name', 'type': 'string'}, 'arguments': {'title': 'Arguments', 'type': 'object'}}, 'required': ['arguments', 'name']}\nEach function call should be enclosed within <tool_call> </tool_call> XML tags.\nExample:\n<tool_call>\n{'name': <function-name>, 'arguments': <args-dict>}\n</tool_call>"
        },
        {
            "from": "human",
            "value": "Can you add the numbers 7 and 12 for me? What's the result of that addition?"
        },
        {
            "from": "gpt",
            "value": "\n<tool_call>\n{'name': 'add', 'arguments': {'a': 7, 'b': 12}}\n</tool_call>"
        },
        {
            "from": "tool",
            "value": "<tool_response>\n{'name': 'add', 'content': 19}\n</tool_response>"
        },
        {
            "from": "gpt",
            "value": "The result of adding 7 and 12 is 19."
        }
    ],
    [
        {
            "from": "system",
            "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. If available tools are not relevant in assisting with user query, just respond in natural conversational language. Don't make assumptions about what values to plug into functions. After calling & executing the functions, you will be provided with function results within <tool_response> </tool_response> XML tags.\n <tools> \n[{'type': 'function', 'function': {'name': 'add', 'description': 'Adds two numbers.', 'parameters': {'properties': {'a': {'type': 'integer', 'description': 'The first number to be added.'}, 'b': {'type': 'integer', 'description': 'The second number to be added.'}}, 'required': ['a', 'b'], 'type': 'object'}}}]\n </tools>\nFor each function call return a JSON object, with the following pydantic model json schema:{'title': 'FunctionCall', 'type': 'object', 'properties': {'name': {'title': 'Name', 'type': 'string'}, 'arguments': {'title': 'Arguments', 'type': 'object'}}, 'required': ['arguments', 'name']}\nEach function call should be enclosed within <tool_call> </tool_call> XML tags.\nExample:\n<tool_call>\n{'name': <function-name>, 'arguments': <args-dict>}\n</tool_call>"
        },
        {
            "from": "human",
            "value": "Could you help me find the sum of the numbers 34 and 56? What does that addition equal?"
        },
        {
            "from": "gpt",
            "value": "\n<tool_call>\n{'name': 'add', 'arguments': {'a': 34, 'b': 56}}\n</tool_call>"
        },
        {
            "from": "tool",
            "value": "<tool_response>\n{'name': 'add', 'content': 90}\n</tool_response>"
        },
        {
            "from": "gpt",
            "value": "The sum of 34 and 56 is 90."
        }
    ],
    [
        {
            "from": "system",
            "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. If available tools are not relevant in assisting with user query, just respond in natural conversational language. Don't make assumptions about what values to plug into functions. After calling & executing the functions, you will be provided with function results within <tool_response> </tool_response> XML tags.\n <tools> \n[{'type': 'function', 'function': {'name': 'add', 'description': 'Adds two numbers.', 'parameters': {'properties': {'a': {'type': 'integer', 'description': 'The first number to be added.'}, 'b': {'type': 'integer', 'description': 'The second number to be added.'}}, 'required': ['a', 'b'], 'type': 'object'}}}]\n </tools>\nFor each function call return a JSON object, with the following pydantic model json schema:{'title': 'FunctionCall', 'type': 'object', 'properties': {'name': {'title': 'Name', 'type': 'string'}, 'arguments': {'title': 'Arguments', 'type': 'object'}}, 'required': ['arguments', 'name']}\nEach function call should be enclosed within <tool_call> </tool_call> XML tags.\nExample:\n<tool_call>\n{'name': <function-name>, 'arguments': <args-dict>}\n</tool_call>"
        },
        {
            "from": "human",
            "value": "Can you calculate the result of adding the numbers 18 and 27 together? What is their sum?"
        },
        {
            "from": "gpt",
            "value": "\n<tool_call>\n{'name': 'add', 'arguments': {'a': 18, 'b': 27}}\n</tool_call>"
        },
        {
            "from": "tool",
            "value": "<tool_response>\n{'name': 'add', 'content': 45}\n</tool_response>"
        },
        {
            "from": "gpt",
            "value": "The sum of 18 and 27 is 45."
        }
    ],
    [
        {
            "from": "system",
            "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. If available tools are not relevant in assisting with user query, just respond in natural conversational language. Don't make assumptions about what values to plug into functions. After calling & executing the functions, you will be provided with function results within <tool_response> </tool_response> XML tags.\n <tools> \n[{'type': 'function', 'function': {'name': 'add', 'description': 'Adds two numbers.', 'parameters': {'properties': {'a': {'type': 'integer', 'description': 'The first number to be added.'}, 'b': {'type': 'integer', 'description': 'The second number to be added.'}}, 'required': ['a', 'b'], 'type': 'object'}}}]\n </tools>\nFor each function call return a JSON object, with the following pydantic model json schema:{'title': 'FunctionCall', 'type': 'object', 'properties': {'name': {'title': 'Name', 'type': 'string'}, 'arguments': {'title': 'Arguments', 'type': 'object'}}, 'required': ['arguments', 'name']}\nEach function call should be enclosed within <tool_call> </tool_call> XML tags.\nExample:\n<tool_call>\n{'name': <function-name>, 'arguments': <args-dict>}\n</tool_call>"
        },
        {
            "from": "human",
            "value": "Could you add the numbers 50 and 75 for me? What is the result of that addition?"
        },
        {
            "from": "gpt",
            "value": "\n<tool_call>\n{'name': 'add', 'arguments': {'a': 50, 'b': 75}}\n</tool_call>"
        },
        {
            "from": "tool",
            "value": "<tool_response>\n{'name': 'add', 'content': 125}\n</tool_response>"
        },
        {
            "from": "gpt",
            "value": "The result of adding 50 and 75 is 125."
        }
    ],
    [
        {
            "from": "system",
            "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. If available tools are not relevant in assisting with user query, just respond in natural conversational language. Don't make assumptions about what values to plug into functions. After calling & executing the functions, you will be provided with function results within <tool_response> </tool_response> XML tags.\n <tools> \n[{'type': 'function', 'function': {'name': 'mul', 'description': 'Multiplies two integers.', 'parameters': {'properties': {'a': {'type': 'integer', 'description': 'The multiplier in the multiplication.'}, 'b': {'type': 'integer', 'description': 'The multiplicand in the multiplication.'}}, 'required': ['a', 'b'], 'type': 'object'}}}]\n </tools>\nFor each function call return a JSON object, with the following pydantic model json schema:{'title': 'FunctionCall', 'type': 'object', 'properties': {'name': {'title': 'Name', 'type': 'string'}, 'arguments': {'title': 'Arguments', 'type': 'object'}}, 'required': ['arguments', 'name']}\nEach function call should be enclosed within <tool_call> </tool_call> XML tags.\nExample:\n<tool_call>\n{'name': <function-name>, 'arguments': <args-dict>}\n</tool_call>"
        },
        {
            "from": "human",
            "value": "Can you help me find the product of two integers? I need to multiply, for example, 6 and 7. What would be the result?"
        },
        {
            "from": "gpt",
            "value": "\n<tool_call>\n{'name': 'mul', 'arguments': {'a': 6, 'b': 7}}\n</tool_call>"
        },
        {
            "from": "tool",
            "value": "<tool_response>\n{'name': 'mul', 'content': 42}\n</tool_response>"
        },
        {
            "from": "gpt",
            "value": "The product of 6 and 7 is 42."
        }
    ],
    [
        {
            "from": "system",
            "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. If available tools are not relevant in assisting with user query, just respond in natural conversational language. Don't make assumptions about what values to plug into functions. After calling & executing the functions, you will be provided with function results within <tool_response> </tool_response> XML tags.\n <tools> \n[{'type': 'function', 'function': {'name': 'mul', 'description': 'Multiplies two integers.', 'parameters': {'properties': {'a': {'type': 'integer', 'description': 'The multiplier in the multiplication.'}, 'b': {'type': 'integer', 'description': 'The multiplicand in the multiplication.'}}, 'required': ['a', 'b'], 'type': 'object'}}}]\n </tools>\nFor each function call return a JSON object, with the following pydantic model json schema:{'title': 'FunctionCall', 'type': 'object', 'properties': {'name': {'title': 'Name', 'type': 'string'}, 'arguments': {'title': 'Arguments', 'type': 'object'}}, 'required': ['arguments', 'name']}\nEach function call should be enclosed within <tool_call> </tool_call> XML tags.\nExample:\n<tool_call>\n{'name': <function-name>, 'arguments': <args-dict>}\n</tool_call>"
        },
        {
            "from": "human",
            "value": "I'm looking to multiply two integers together. Can you give me the result of multiplying 12 and 5?"
        },
        {
            "from": "gpt",
            "value": "\n<tool_call>\n{'name': 'mul', 'arguments': {'a': 12, 'b': 5}}\n</tool_call>"
        },
        {
            "from": "tool",
            "value": "<tool_response>\n{'name': 'mul', 'content': 60}\n</tool_response>"
        },
        {
            "from": "gpt",
            "value": "The result of multiplying 12 and 5 is 60."
        }
    ],
    [
        {
            "from": "system",
            "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. If available tools are not relevant in assisting with user query, just respond in natural conversational language. Don't make assumptions about what values to plug into functions. After calling & executing the functions, you will be provided with function results within <tool_response> </tool_response> XML tags.\n <tools> \n[{'type': 'function', 'function': {'name': 'mul', 'description': 'Multiplies two integers.', 'parameters': {'properties': {'a': {'type': 'integer', 'description': 'The multiplier in the multiplication.'}, 'b': {'type': 'integer', 'description': 'The multiplicand in the multiplication.'}}, 'required': ['a', 'b'], 'type': 'object'}}}]\n </tools>\nFor each function call return a JSON object, with the following pydantic model json schema:{'title': 'FunctionCall', 'type': 'object', 'properties': {'name': {'title': 'Name', 'type': 'string'}, 'arguments': {'title': 'Arguments', 'type': 'object'}}, 'required': ['arguments', 'name']}\nEach function call should be enclosed within <tool_call> </tool_call> XML tags.\nExample:\n<tool_call>\n{'name': <function-name>, 'arguments': <args-dict>}\n</tool_call>"
        },
        {
            "from": "human",
            "value": "Could you help me calculate the product of two integers? Specifically, I'm interested in multiplying 4 and 9 together. What is the result?"
        },
        {
            "from": "gpt",
            "value": "\n<tool_call>\n{'name': 'mul', 'arguments': {'a': 4, 'b': 9}}\n</tool_call>"
        },
        {
            "from": "tool",
            "value": "<tool_response>\n{'name': 'mul', 'content': 36}\n</tool_response>"
        },
        {
            "from": "gpt",
            "value": "The product of 4 and 9 is 36."
        }
    ],
    [
        {
            "from": "system",
            "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. If available tools are not relevant in assisting with user query, just respond in natural conversational language. Don't make assumptions about what values to plug into functions. After calling & executing the functions, you will be provided with function results within <tool_response> </tool_response> XML tags.\n <tools> \n[{'type': 'function', 'function': {'name': 'mul', 'description': 'Multiplies two integers.', 'parameters': {'properties': {'a': {'type': 'integer', 'description': 'The multiplier in the multiplication.'}, 'b': {'type': 'integer', 'description': 'The multiplicand in the multiplication.'}}, 'required': ['a', 'b'], 'type': 'object'}}}]\n </tools>\nFor each function call return a JSON object, with the following pydantic model json schema:{'title': 'FunctionCall', 'type': 'object', 'properties': {'name': {'title': 'Name', 'type': 'string'}, 'arguments': {'title': 'Arguments', 'type': 'object'}}, 'required': ['arguments', 'name']}\nEach function call should be enclosed within <tool_call> </tool_call> XML tags.\nExample:\n<tool_call>\n{'name': <function-name>, 'arguments': <args-dict>}\n</tool_call>"
        },
        {
            "from": "human",
            "value": "Can you give me the product of two integers? I'm looking to multiply 3 and 8. What would be the answer?"
        },
        {
            "from": "gpt",
            "value": "\n<tool_call>\n{'name': 'mul', 'arguments': {'a': 3, 'b': 8}}\n</tool_call>"
        },
        {
            "from": "tool",
            "value": "<tool_response>\n{'name': 'mul', 'content': 24}\n</tool_response>"
        },
        {
            "from": "gpt",
            "value": "The product of 3 and 8 is 24."
        }
    ],
    [
        {
            "from": "system",
            "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. If available tools are not relevant in assisting with user query, just respond in natural conversational language. Don't make assumptions about what values to plug into functions. After calling & executing the functions, you will be provided with function results within <tool_response> </tool_response> XML tags.\n <tools> \n[{'type': 'function', 'function': {'name': 'mul', 'description': 'Multiplies two integers.', 'parameters': {'properties': {'a': {'type': 'integer', 'description': 'The multiplier in the multiplication.'}, 'b': {'type': 'integer', 'description': 'The multiplicand in the multiplication.'}}, 'required': ['a', 'b'], 'type': 'object'}}}]\n </tools>\nFor each function call return a JSON object, with the following pydantic model json schema:{'title': 'FunctionCall', 'type': 'object', 'properties': {'name': {'title': 'Name', 'type': 'string'}, 'arguments': {'title': 'Arguments', 'type': 'object'}}, 'required': ['arguments', 'name']}\nEach function call should be enclosed within <tool_call> </tool_call> XML tags.\nExample:\n<tool_call>\n{'name': <function-name>, 'arguments': <args-dict>}\n</tool_call>"
        },
        {
            "from": "human",
            "value": "I'm trying to find the product of two integers. Can you help me calculate the result of multiplying 15 and 4?"
        },
        {
            "from": "gpt",
            "value": "\n<tool_call>\n{'name': 'mul', 'arguments': {'a': 15, 'b': 4}}\n</tool_call>"
        },
        {
            "from": "tool",
            "value": "<tool_response>\n{'name': 'mul', 'content': 60}\n</tool_response>"
        },
        {
            "from": "gpt",
            "value": "The product of 15 and 4 is 60."
        }
    ],
    [
        {
            "from": "system",
            "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. If available tools are not relevant in assisting with user query, just respond in natural conversational language. Don't make assumptions about what values to plug into functions. After calling & executing the functions, you will be provided with function results within <tool_response> </tool_response> XML tags.\n <tools> \n[{'type': 'function', 'function': {'name': 'search_duckduckgo', 'description': 'Use DuckDuckGo search engine to search information for\\nthe given query.\\n\\nThis function queries the DuckDuckGo API for related topics to\\nthe given search term. The results are formatted into a list of\\ndictionaries, each representing a search result.', 'parameters': {'properties': {'query': {'type': 'string', 'description': 'The query to be searched.'}, 'source': {'default': 'text', 'type': 'string', 'description': 'The type of information to query (e.g., \"text\",\\n\"images\", \"videos\"). Defaults to \"text\".'}, 'max_results': {'default': 5, 'type': 'integer', 'description': 'Max number of results, defaults to `5`.'}}, 'required': ['query'], 'type': 'object'}}}]\n </tools>\nFor each function call return a JSON object, with the following pydantic model json schema:{'title': 'FunctionCall', 'type': 'object', 'properties': {'name': {'title': 'Name', 'type': 'string'}, 'arguments': {'title': 'Arguments', 'type': 'object'}}, 'required': ['arguments', 'name']}\nEach function call should be enclosed within <tool_call> </tool_call> XML tags.\nExample:\n<tool_call>\n{'name': <function-name>, 'arguments': <args-dict>}\n</tool_call>"
        },
        {
            "from": "human",
            "value": "I'm looking for some information regarding the benefits of meditation. Can you help me find relevant articles or resources that discuss this topic?"
        },
        {
            "from": "gpt",
            "value": "\n<tool_call>\n{'name': 'search_duckduckgo', 'arguments': {'query': 'benefits of meditation', 'max_results': 5}}\n</tool_call>"
        },
        {
            "from": "tool",
            "value": "<tool_response>\n{'name': 'search_duckduckgo', 'content': [{'result_id': 1, 'title': '12 Science-Based Benefits of Meditation - Healthline', 'description': 'Learn how meditation can reduce stress, anxiety, and pain, improve sleep, memory, and self-awareness, and more. Find out the types, methods, and evidence of meditation for your mind and body.', 'url': 'https://www.healthline.com/nutrition/12-benefits-of-meditation'}, {'result_id': 2, 'title': 'What meditation can do for your mind, mood, and health', 'description': 'Learn how meditation can help you lower stress, anxiety, depression, and pain, and improve your creativity, intuition, and connection with yourself. Find out different types of meditation and how to start your practice with simple tips.', 'url': 'https://www.health.harvard.edu/staying-healthy/what-meditation-can-do-for-your-mind-mood-and-health-'}, {'result_id': 3, 'title': 'Meditation: A simple, fast way to reduce stress - Mayo Clinic', 'description': 'Benefits of meditation. Meditation can give you a sense of calm, peace and balance that can benefit your emotional well-being and your overall health. You also can use it to relax and cope with stress by focusing on something that calms you. Meditation can help you learn to stay centered and keep inner peace.', 'url': 'https://www.mayoclinic.org/tests-procedures/meditation/in-depth/meditation/art-20045858'}, {'result_id': 4, 'title': '20+ Health Benefits of Meditation According to Science', 'description': 'Learn how meditation can improve your physical and mental wellbeing, from reducing stress and anxiety to enhancing cognitive functioning and empathy. Explore the research-backed benefits of meditation for students, trauma survivors, and more.', 'url': 'https://positivepsychology.com/benefits-of-meditation/'}, {'result_id': 5, 'title': '10 Benefits of Meditation - Psych Central', 'description': 'Meditation can reduce stress, anxiety, pain, and improve memory, sleep, and relationships. Learn how different types of meditation work and how to get started.', 'url': 'https://psychcentral.com/health/benefits-of-meditation'}]}\n</tool_response>"
        },
        {
            "from": "gpt",
            "value": "Here are some articles and resources discussing the benefits of meditation:\n\n1. **[12 Science-Based Benefits of Meditation - Healthline](https://www.healthline.com/nutrition/12-benefits-of-meditation)**  \n   Learn how meditation can reduce stress, anxiety, and pain, improve sleep, memory, and self-awareness, and more. This article covers various types and methods of meditation.\n\n2. **[What meditation can do for your mind, mood, and health - Harvard Health](https://www.health.harvard.edu/staying-healthy/what-meditation-can-do-for-your-mind-mood-and-health-)**  \n   Discover how meditation can help lower stress, anxiety, depression, and pain, while also enhancing creativity and intuition. It includes tips on how to start your meditation practice.\n\n3. **[Meditation: A simple, fast way to reduce stress - Mayo Clinic](https://www.mayoclinic.org/tests-procedures/meditation/in-depth/meditation/art-20045858)**  \n   This resource discusses how meditation can provide a sense of calm and balance, benefiting emotional well-being and overall health. It also offers insights on coping with stress.\n\n4. **[20+ Health Benefits of Meditation According to Science - Positive Psychology](https://positivepsychology.com/benefits-of-meditation/)**  \n   Explore the research-backed benefits of meditation, including its effects on physical and mental well-being, cognitive functioning, and empathy.\n\n5. **[10 Benefits of Meditation - Psych Central](https://psychcentral.com/health/benefits-of-meditation)**  \n   This article outlines how meditation can reduce stress, anxiety, and pain, while improving memory, sleep, and relationships. It also discusses different types of meditation.\n\nFeel free to explore these resources for more in-depth information on the benefits of meditation!"
        }
    ],
    [
        {
            "from": "system",
            "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. If available tools are not relevant in assisting with user query, just respond in natural conversational language. Don't make assumptions about what values to plug into functions. After calling & executing the functions, you will be provided with function results within <tool_response> </tool_response> XML tags.\n <tools> \n[{'type': 'function', 'function': {'name': 'search_duckduckgo', 'description': 'Use DuckDuckGo search engine to search information for\\nthe given query.\\n\\nThis function queries the DuckDuckGo API for related topics to\\nthe given search term. The results are formatted into a list of\\ndictionaries, each representing a search result.', 'parameters': {'properties': {'query': {'type': 'string', 'description': 'The query to be searched.'}, 'source': {'default': 'text', 'type': 'string', 'description': 'The type of information to query (e.g., \"text\",\\n\"images\", \"videos\"). Defaults to \"text\".'}, 'max_results': {'default': 5, 'type': 'integer', 'description': 'Max number of results, defaults to `5`.'}}, 'required': ['query'], 'type': 'object'}}}]\n </tools>\nFor each function call return a JSON object, with the following pydantic model json schema:{'title': 'FunctionCall', 'type': 'object', 'properties': {'name': {'title': 'Name', 'type': 'string'}, 'arguments': {'title': 'Arguments', 'type': 'object'}}, 'required': ['arguments', 'name']}\nEach function call should be enclosed within <tool_call> </tool_call> XML tags.\nExample:\n<tool_call>\n{'name': <function-name>, 'arguments': <args-dict>}\n</tool_call>"
        },
        {
            "from": "human",
            "value": "I'm researching the effects of fast fashion on the environment and would like to find some relevant articles or studies on this topic. Can you help me locate some resources?"
        },
        {
            "from": "gpt",
            "value": "\n<tool_call>\n{'name': 'search_duckduckgo', 'arguments': {'query': 'effects of fast fashion on the environment', 'max_results': 5}}\n</tool_call>"
        },
        {
            "from": "tool",
            "value": "<tool_response>\n{'name': 'search_duckduckgo', 'content': [{'result_id': 1, 'title': 'The Impact of Fast Fashion On the Environment \u2014 PSCI', 'description': 'The fashion industry has caused a substantial amount of damage to our environment. However, if we start to take proactive steps towards advocating for a green-friendly fashion industry and becoming an environmentally-conscious consumer, we can finally slow down climate change.', 'url': 'https://psci.princeton.edu/tips/2020/7/20/the-impact-of-fast-fashion-on-the-environment'}, {'result_id': 2, 'title': 'Fast Fashion and Its Environmental Impact in 2024 | Earth.Org', 'description': 'Yet, fast fashion has a significant environmental impact. According to the UN Environment Programme (UNEP), the industry is the second-biggest consumer of water and is responsible for about 10% of global carbon emissions - more than all international flights and maritime shipping combined.', 'url': 'https://earth.org/fast-fashions-detrimental-effect-on-the-environment/'}, {'result_id': 3, 'title': \"The Fashion Industry's Environmental Impact: Everything You Need To ...\", 'description': \"The fashion industry's environmental impact, a critical concern, reaches across the globe, impacting climate change, resource depletion, and pollution. ... water usage, and chemical pollution. It also explores the challenges of fast fashion and unethical labour practices while showcasing sustainable solutions and the circular fashion economy ...\", 'url': 'https://sigmaearth.com/the-fashion-industrys-environmental-impact-everything-you-need-to-know/'}, {'result_id': 4, 'title': 'Fast fashion: How clothes are linked to climate change - BBC', 'description': \"What's the environmental impact of fast fashion? Producing clothes uses a lot of natural resources and creates greenhouse gas emissions which are responsible for climate change.\", 'url': 'https://www.bbc.com/news/science-environment-60382624'}, {'result_id': 5, 'title': 'The environmental costs of fast fashion - UNEP', 'description': \"A new UNEP video captures how fast fashion is a growing problem, creating waste while fuelling carbon emissions, and how combatting it is everyone's responsibility.\", 'url': 'https://www.unep.org/news-and-stories/story/environmental-costs-fast-fashion'}]}\n</tool_response>"
        },
        {
            "from": "gpt",
            "value": "Here are some relevant articles and studies on the effects of fast fashion on the environment:\n\n1. **[The Impact of Fast Fashion On the Environment \u2014 PSCI](https://psci.princeton.edu/tips/2020/7/20/the-impact-of-fast-fashion-on-the-environment)**  \n   This article discusses the substantial damage caused by the fashion industry to the environment and emphasizes the importance of advocating for a green-friendly fashion industry.\n\n2. **[Fast Fashion and Its Environmental Impact in 2024 | Earth.Org](https://earth.org/fast-fashions-detrimental-effect-on-the-environment/)**  \n   This piece highlights the significant environmental impact of fast fashion, noting that it is the second-biggest consumer of water and responsible for about 10% of global carbon emissions.\n\n3. **[The Fashion Industry's Environmental Impact: Everything You Need To Know](https://sigmaearth.com/the-fashion-industrys-environmental-impact-everything-you-need-to-know/)**  \n   This comprehensive article covers the fashion industry's impact on climate change, resource depletion, and pollution, while also discussing sustainable solutions and the circular fashion economy.\n\n4. **[Fast fashion: How clothes are linked to climate change - BBC](https://www.bbc.com/news/science-environment-60382624)**  \n   This article examines the environmental impact of fast fashion, focusing on the natural resources used in clothing production and the greenhouse gas emissions generated.\n\n5. **[The environmental costs of fast fashion - UNEP](https://www.unep.org/news-and-stories/story/environmental-costs-fast-fashion)**  \n   This report from the United Nations Environment Programme discusses how fast fashion creates waste and fuels carbon emissions, emphasizing the collective responsibility to combat these issues.\n\nThese resources should provide a solid foundation for your research on the environmental effects of fast fashion."
        }
    ],
    [
        {
            "from": "system",
            "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. If available tools are not relevant in assisting with user query, just respond in natural conversational language. Don't make assumptions about what values to plug into functions. After calling & executing the functions, you will be provided with function results within <tool_response> </tool_response> XML tags.\n <tools> \n[{'type': 'function', 'function': {'name': 'search_duckduckgo', 'description': 'Use DuckDuckGo search engine to search information for\\nthe given query.\\n\\nThis function queries the DuckDuckGo API for related topics to\\nthe given search term. The results are formatted into a list of\\ndictionaries, each representing a search result.', 'parameters': {'properties': {'query': {'type': 'string', 'description': 'The query to be searched.'}, 'source': {'default': 'text', 'type': 'string', 'description': 'The type of information to query (e.g., \"text\",\\n\"images\", \"videos\"). Defaults to \"text\".'}, 'max_results': {'default': 5, 'type': 'integer', 'description': 'Max number of results, defaults to `5`.'}}, 'required': ['query'], 'type': 'object'}}}]\n </tools>\nFor each function call return a JSON object, with the following pydantic model json schema:{'title': 'FunctionCall', 'type': 'object', 'properties': {'name': {'title': 'Name', 'type': 'string'}, 'arguments': {'title': 'Arguments', 'type': 'object'}}, 'required': ['arguments', 'name']}\nEach function call should be enclosed within <tool_call> </tool_call> XML tags.\nExample:\n<tool_call>\n{'name': <function-name>, 'arguments': <args-dict>}\n</tool_call>"
        },
        {
            "from": "human",
            "value": "I'm looking for information about the health benefits of yoga. Can you help me find some articles or studies that discuss this topic?"
        },
        {
            "from": "gpt",
            "value": "\n<tool_call>\n{'name': 'search_duckduckgo', 'arguments': {'query': 'health benefits of yoga', 'max_results': 5}}\n</tool_call>"
        },
        {
            "from": "tool",
            "value": "<tool_response>\n{'name': 'search_duckduckgo', 'content': [{'result_id': 1, 'title': '12 Science-Based Benefits of Yoga - Healthline', 'description': 'Learn how yoga can improve your flexibility, strength, mental health, immunity, and more. Find out the latest research and tips on yoga styles, poses, and breathing techniques.', 'url': 'https://www.healthline.com/nutrition/13-benefits-of-yoga'}, {'result_id': 2, 'title': '9 Benefits of Yoga - Johns Hopkins Medicine', 'description': 'Learn how yoga can improve your strength, balance, flexibility, back pain, arthritis, heart health, sleep, mood and stress. Find out how to get started with yoga classes or poses for seniors and people with limitations.', 'url': 'https://www.hopkinsmedicine.org/health/wellness-and-prevention/9-benefits-of-yoga'}, {'result_id': 3, 'title': 'Yoga for Health: What the Science Says | NCCIH - National Center for ...', 'description': 'Some but not all studies that looked at the effects of yoga on positive aspects of mental health found evidence of benefits, such as better resilience or general mental well-being. Health Habits. A survey of young adults showed that practicing yoga regularly was associated with better eating and physical activity habits, such as more servings ...', 'url': 'https://www.nccih.nih.gov/health/providers/digest/yoga-for-health-science'}, {'result_id': 4, 'title': 'Yoga - Benefits Beyond the Mat - Harvard Health', 'description': 'Yoga provides many other mental and physical benefits. Some of these extend to the kitchen table. Types of yoga. There are many types of yoga. Hatha (a combination of many styles) is one of the most popular styles. It is a more physical type of yoga rather than a still, meditative form. Hatha yoga focuses on pranayamas (breath', 'url': 'https://www.health.harvard.edu/staying-healthy/yoga-benefits-beyond-the-mat'}, {'result_id': 5, 'title': '17 Benefits of Yoga Backed by Science - Verywell Health', 'description': 'Yoga is a mind-body practice that combines physical poses, breathwork, and meditation. Preliminary research has overwhelmingly found that yoga benefits physical and mental health. Potential benefits include improved balance, increased bone density, less chronic pain, and lower stress levels.', 'url': 'https://www.verywellhealth.com/benefits-of-yoga-8652622'}]}\n</tool_response>"
        },
        {
            "from": "gpt",
            "value": "Here are some articles and studies discussing the health benefits of yoga:\n\n1. **[12 Science-Based Benefits of Yoga - Healthline](https://www.healthline.com/nutrition/13-benefits-of-yoga)**  \n   This article explores how yoga can improve flexibility, strength, mental health, immunity, and more, along with the latest research and tips on yoga styles, poses, and breathing techniques.\n\n2. **[9 Benefits of Yoga - Johns Hopkins Medicine](https://www.hopkinsmedicine.org/health/wellness-and-prevention/9-benefits-of-yoga)**  \n   This resource outlines how yoga can enhance strength, balance, flexibility, alleviate back pain, improve heart health, and promote better sleep and mood.\n\n3. **[Yoga for Health: What the Science Says | NCCIH - National Center for Complementary and Integrative Health](https://www.nccih.nih.gov/health/providers/digest/yoga-for-health-science)**  \n   This article reviews studies on the effects of yoga on mental health, resilience, and overall well-being, along with insights into health habits associated with regular yoga practice.\n\n4. **[Yoga - Benefits Beyond the Mat - Harvard Health](https://www.health.harvard.edu/staying-healthy/yoga-benefits-beyond-the-mat)**  \n   This article discusses various mental and physical benefits of yoga, including its impact on lifestyle and health beyond just physical practice.\n\n5. **[17 Benefits of Yoga Backed by Science - Verywell Health](https://www.verywellhealth.com/benefits-of-yoga-8652622)**  \n   This resource highlights the mind-body practice of yoga and its numerous benefits, including improved balance, increased bone density, reduced chronic pain, and lower stress levels.\n\nThese articles provide a comprehensive overview of the various health benefits associated with yoga practice."
        }
    ],
    [
        {
            "from": "system",
            "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. If available tools are not relevant in assisting with user query, just respond in natural conversational language. Don't make assumptions about what values to plug into functions. After calling & executing the functions, you will be provided with function results within <tool_response> </tool_response> XML tags.\n <tools> \n[{'type': 'function', 'function': {'name': 'search_wiki', 'description': 'Search the entity in WikiPedia and return the summary of the\\nrequired page, containing factual information about\\n    the given entity.', 'parameters': {'properties': {'entity': {'type': 'string', 'description': 'The entity to be searched.'}}, 'required': ['entity'], 'type': 'object'}}}]\n </tools>\nFor each function call return a JSON object, with the following pydantic model json schema:{'title': 'FunctionCall', 'type': 'object', 'properties': {'name': {'title': 'Name', 'type': 'string'}, 'arguments': {'title': 'Arguments', 'type': 'object'}}, 'required': ['arguments', 'name']}\nEach function call should be enclosed within <tool_call> </tool_call> XML tags.\nExample:\n<tool_call>\n{'name': <function-name>, 'arguments': <args-dict>}\n</tool_call>"
        },
        {
            "from": "human",
            "value": "I'm curious to learn more about electric cars. Can you provide a summary of the relevant information available on Wikipedia about electric cars?"
        },
        {
            "from": "gpt",
            "value": "\n<tool_call>\n{'name': 'search_wiki', 'arguments': {'entity': 'Electric car'}}\n</tool_call>"
        },
        {
            "from": "tool",
            "value": "<tool_response>\n{'name': 'search_wiki', 'content': 'An electric car or electric vehicle (EV) is a passenger automobile that is propelled by an electric traction motor, using electrical energy as the primary source of propulsion. The term normally refers to a plug-in electric vehicle, typically a battery electric vehicle (BEV), which only uses energy stored in on-board battery packs, but broadly may also include plug-in hybrid electric vehicle (PHEV), range-extended electric vehicle (REEV) and fuel cell electric vehicle (FCEV), which can convert electric power from other fuels via a generator or a fuel cell.\\nCompared to conventional internal combustion engine (ICE) vehicles, electric cars are quieter, more responsive, have superior energy conversion efficiency and no exhaust emissions, as well as a lower overall carbon footprint from manufacturing to end of life (even when a power plant supplying the electricity might add to its emissions). Due to the superior efficiency of electric motors, electric cars also generate less waste heat, thus reducing the need for engine cooling systems that are often large, complicated and maintenance-prone in ICE vehicles.\\nThe electric vehicle battery typically needs to be plugged into a mains electricity power supply for recharging in order to maximize the cruising range.'}\n</tool_response>"
        },
        {
            "from": "gpt",
            "value": "An electric car, or electric vehicle (EV), is a passenger automobile powered by an electric traction motor, using electrical energy as its primary source of propulsion. The term usually refers to plug-in electric vehicles, particularly battery electric vehicles (BEVs), which rely solely on energy stored in on-board battery packs. However, it can also encompass plug-in hybrid electric vehicles (PHEVs), range-extended electric vehicles (REEVs), and fuel cell electric vehicles (FCEVs), which generate electric power from other fuels.\n\nElectric cars offer several advantages over conventional internal combustion engine (ICE) vehicles, including:\n\n- Quieter operation\n- Greater responsiveness\n- Superior energy conversion efficiency\n- No exhaust emissions\n- A lower overall carbon footprint from manufacturing to end of life\n\nDespite the potential emissions from power plants supplying electricity, electric cars generally produce less waste heat, reducing the need for large and complex engine cooling systems found in ICE vehicles. To maximize cruising range, the electric vehicle battery typically requires recharging by plugging into a mains electricity power supply."
        }
    ],
    [
        {
            "from": "system",
            "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. If available tools are not relevant in assisting with user query, just respond in natural conversational language. Don't make assumptions about what values to plug into functions. After calling & executing the functions, you will be provided with function results within <tool_response> </tool_response> XML tags.\n <tools> \n[{'type': 'function', 'function': {'name': 'search_wiki', 'description': 'Search the entity in WikiPedia and return the summary of the\\nrequired page, containing factual information about\\n    the given entity.', 'parameters': {'properties': {'entity': {'type': 'string', 'description': 'The entity to be searched.'}}, 'required': ['entity'], 'type': 'object'}}}]\n </tools>\nFor each function call return a JSON object, with the following pydantic model json schema:{'title': 'FunctionCall', 'type': 'object', 'properties': {'name': {'title': 'Name', 'type': 'string'}, 'arguments': {'title': 'Arguments', 'type': 'object'}}, 'required': ['arguments', 'name']}\nEach function call should be enclosed within <tool_call> </tool_call> XML tags.\nExample:\n<tool_call>\n{'name': <function-name>, 'arguments': <args-dict>}\n</tool_call>"
        },
        {
            "from": "human",
            "value": "I would like to find some detailed information on climate change. Can you help me get a summary from Wikipedia regarding climate change?"
        },
        {
            "from": "gpt",
            "value": "\n<tool_call>\n{'name': 'search_wiki', 'arguments': {'entity': 'Climate Change'}}\n</tool_call>"
        },
        {
            "from": "tool",
            "value": "<tool_response>\n{'name': 'search_wiki', 'content': \"Present-day climate change includes both global warming\u2014the ongoing increase in global average temperature\u2014and its wider effects on Earth's climate. Climate change in a broader sense also includes previous long-term changes to Earth's climate. The current rise in global temperatures is driven by human activities, especially fossil fuel burning since the Industrial Revolution. Fossil fuel use, deforestation, and some agricultural and industrial practices release greenhouse gases. These gases absorb some of the heat that the Earth radiates after it warms from sunlight, warming the lower atmosphere.\"}\n</tool_response>"
        },
        {
            "from": "gpt",
            "value": "Climate change refers to both global warming\u2014the ongoing increase in global average temperature\u2014and its broader effects on Earth's climate. It encompasses long-term changes to Earth's climate, including those that occurred in the past. The current rise in global temperatures is primarily driven by human activities, particularly the burning of fossil fuels since the Industrial Revolution. This includes practices such as fossil fuel use, deforestation, and certain agricultural and industrial activities, which release greenhouse gases. These gases trap heat in the atmosphere, leading to a warming effect on the lower atmosphere."
        }
    ],
    [
        {
            "from": "system",
            "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. If available tools are not relevant in assisting with user query, just respond in natural conversational language. Don't make assumptions about what values to plug into functions. After calling & executing the functions, you will be provided with function results within <tool_response> </tool_response> XML tags.\n <tools> \n[{'type': 'function', 'function': {'name': 'search_wiki', 'description': 'Search the entity in WikiPedia and return the summary of the\\nrequired page, containing factual information about\\n    the given entity.', 'parameters': {'properties': {'entity': {'type': 'string', 'description': 'The entity to be searched.'}}, 'required': ['entity'], 'type': 'object'}}}]\n </tools>\nFor each function call return a JSON object, with the following pydantic model json schema:{'title': 'FunctionCall', 'type': 'object', 'properties': {'name': {'title': 'Name', 'type': 'string'}, 'arguments': {'title': 'Arguments', 'type': 'object'}}, 'required': ['arguments', 'name']}\nEach function call should be enclosed within <tool_call> </tool_call> XML tags.\nExample:\n<tool_call>\n{'name': <function-name>, 'arguments': <args-dict>}\n</tool_call>"
        },
        {
            "from": "human",
            "value": "I'm interested in learning about renewable energy sources. Could you provide me with a summary from Wikipedia regarding renewable energy?"
        },
        {
            "from": "gpt",
            "value": "\n<tool_call>\n{'name': 'search_wiki', 'arguments': {'entity': 'Renewable energy'}}\n</tool_call>"
        },
        {
            "from": "tool",
            "value": "<tool_response>\n{'name': 'search_wiki', 'content': 'Renewable energy (or green energy) is energy from renewable natural resources that are replenished on a human timescale. The most widely used renewable energy types are solar energy, wind power, and hydropower. Bioenergy and geothermal power are also significant in some countries. Some also consider nuclear power a renewable power source, although this is controversial. Renewable energy installations can be large or small and are suited for both urban and rural areas.'}\n</tool_response>"
        },
        {
            "from": "gpt",
            "value": "Renewable energy, also known as green energy, is derived from renewable natural resources that are replenished on a human timescale. The most commonly used types of renewable energy include solar energy, wind power, and hydropower. Additionally, bioenergy and geothermal power are significant sources in certain countries. While some consider nuclear power to be a renewable energy source, this classification is controversial. Renewable energy installations can vary in size and are suitable for both urban and rural areas."
        }
    ],
    [
        {
            "from": "system",
            "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. If available tools are not relevant in assisting with user query, just respond in natural conversational language. Don't make assumptions about what values to plug into functions. After calling & executing the functions, you will be provided with function results within <tool_response> </tool_response> XML tags.\n <tools> \n[{'type': 'function', 'function': {'name': 'search_wiki', 'description': 'Search the entity in WikiPedia and return the summary of the\\nrequired page, containing factual information about\\n    the given entity.', 'parameters': {'properties': {'entity': {'type': 'string', 'description': 'The entity to be searched.'}}, 'required': ['entity'], 'type': 'object'}}}]\n </tools>\nFor each function call return a JSON object, with the following pydantic model json schema:{'title': 'FunctionCall', 'type': 'object', 'properties': {'name': {'title': 'Name', 'type': 'string'}, 'arguments': {'title': 'Arguments', 'type': 'object'}}, 'required': ['arguments', 'name']}\nEach function call should be enclosed within <tool_call> </tool_call> XML tags.\nExample:\n<tool_call>\n{'name': <function-name>, 'arguments': <args-dict>}\n</tool_call>"
        },
        {
            "from": "human",
            "value": "I'd like to gather some information about the history of the Internet. Can you help me find a summary from Wikipedia on this topic?"
        },
        {
            "from": "gpt",
            "value": "\n<tool_call>\n{'name': 'search_wiki', 'arguments': {'entity': 'History of the Internet'}}\n</tool_call>"
        },
        {
            "from": "tool",
            "value": "<tool_response>\n{'name': 'search_wiki', 'content': 'The history of the Internet has its origin in the efforts of scientists and engineers to build and interconnect computer networks. The Internet Protocol Suite, the set of rules used to communicate between networks and devices on the Internet, arose from research and development in the United States and involved international collaboration, particularly with researchers in the United Kingdom and France.\\nComputer science was an emerging discipline in the late 1950s that began to consider time-sharing between computer users, and later, the possibility of achieving this over wide area networks. J. C. R. Licklider developed the idea of a universal network at the Information Processing Techniques Office (IPTO) of the United States Department of Defense (DoD) Advanced Research Projects Agency (ARPA). Independently, Paul Baran at the RAND Corporation proposed a distributed network based on data in message blocks in the early 1960s, and Donald Davies conceived of packet switching in 1965 at the National Physical Laboratory (NPL), proposing a national commercial data network in the United Kingdom.'}\n</tool_response>"
        },
        {
            "from": "gpt",
            "value": "The history of the Internet originates from the efforts of scientists and engineers to build and interconnect computer networks. The Internet Protocol Suite, which is the set of rules used for communication between networks and devices on the Internet, was developed through research and collaboration primarily in the United States, with significant contributions from researchers in the United Kingdom and France.\n\nIn the late 1950s, computer science began to emerge as a discipline that explored time-sharing among computer users and the potential for this over wide area networks. J. C. R. Licklider, working at the Information Processing Techniques Office (IPTO) of the U.S. Department of Defense's Advanced Research Projects Agency (ARPA), developed the concept of a universal network. Around the same time, Paul Baran at the RAND Corporation proposed a distributed network using data in message blocks, and Donald Davies conceived the idea of packet switching in 1965 at the National Physical Laboratory (NPL), advocating for a national commercial data network in the UK."
        }
    ],
    [
        {
            "from": "system",
            "value": "You are a function calling AI model. You are provided with function signatures within <tools> </tools> XML tags. You may call one or more functions to assist with the user query. If available tools are not relevant in assisting with user query, just respond in natural conversational language. Don't make assumptions about what values to plug into functions. After calling & executing the functions, you will be provided with function results within <tool_response> </tool_response> XML tags.\n <tools> \n[{'type': 'function', 'function': {'name': 'search_wiki', 'description': 'Search the entity in WikiPedia and return the summary of the\\nrequired page, containing factual information about\\n    the given entity.', 'parameters': {'properties': {'entity': {'type': 'string', 'description': 'The entity to be searched.'}}, 'required': ['entity'], 'type': 'object'}}}]\n </tools>\nFor each function call return a JSON object, with the following pydantic model json schema:{'title': 'FunctionCall', 'type': 'object', 'properties': {'name': {'title': 'Name', 'type': 'string'}, 'arguments': {'title': 'Arguments', 'type': 'object'}}, 'required': ['arguments', 'name']}\nEach function call should be enclosed within <tool_call> </tool_call> XML tags.\nExample:\n<tool_call>\n{'name': <function-name>, 'arguments': <args-dict>}\n</tool_call>"
        },
        {
            "from": "human",
            "value": "I want to learn about the theory of relativity. Could you help me find a summary from Wikipedia on this subject?"
        },
        {
            "from": "gpt",
            "value": "\n<tool_call>\n{'name': 'search_wiki', 'arguments': {'entity': 'theory of relativity'}}\n</tool_call>"
        },
        {
            "from": "tool",
            "value": "<tool_response>\n{'name': 'search_wiki', 'content': 'The theory of relativity usually encompasses two interrelated physics theories by Albert Einstein: special relativity and general relativity, proposed and published in 1905 and 1915, respectively. Special relativity applies to all physical phenomena in the absence of gravity. General relativity explains the law of gravitation and its relation to the forces of nature. It applies to the cosmological and astrophysical realm, including astronomy.\\nThe theory transformed theoretical physics and astronomy during the 20th century, superseding a 200-year-old theory of mechanics created primarily by Isaac Newton.'}\n</tool_response>"
        },
        {
            "from": "gpt",
            "value": "The theory of relativity usually encompasses two interrelated physics theories by Albert Einstein: special relativity and general relativity, proposed and published in 1905 and 1915, respectively. \n\n- **Special relativity** applies to all physical phenomena in the absence of gravity.\n- **General relativity** explains the law of gravitation and its relation to the forces of nature, applying to the cosmological and astrophysical realm, including astronomy.\n\nThe theory transformed theoretical physics and astronomy during the 20th century, superseding a 200-year-old theory of mechanics created primarily by Isaac Newton."
        }
    ]
]

Summary#

In this tutorial, you learned how to generate user queries and structure tool call data by leveraging multiple tools with the camel library. This setup enables scalable and flexible data generation for various toolkits and tasks.