{ "cells": [ { "cell_type": "markdown", "id": "3df36883-3c1c-4008-98ca-0d641820d9ef", "metadata": {}, "source": [ "## Dataset exploration\n", "\n", "This is probably going to be a minimal EDA notebook looking at tool calling datasets that exists in market right now" ] }, { "cell_type": "code", "execution_count": 22, "id": "63d7e44e-d808-4628-ab7a-540aa6d0fd72", "metadata": {}, "outputs": [], "source": [ "#!pip install datasets" ] }, { "cell_type": "code", "execution_count": 2, "id": "52075b0f-61be-4898-be35-bd72bd022efc", "metadata": {}, "outputs": [], "source": [ "from datasets import load_dataset" ] }, { "cell_type": "markdown", "id": "c3c59bbd-1060-4b71-9ceb-1e70d733b8a4", "metadata": {}, "source": [ "### Hermes-Function-Calling v1\n", "\n", "- Apache 2.0\n", "- Single-Turn: 2k\n", "- Func_calling: 2k\n", "- Glaive: 5k\n", "- Json mode agent: 1.3k\n", "- Json mode single: 1.24k\n", "\n", "https://huggingface.co/datasets/NousResearch/hermes-function-calling-v1" ] }, { "cell_type": "code", "execution_count": 27, "id": "22a4366c-4a9a-45f8-b12d-603b0ab2df5f", "metadata": {}, "outputs": [], "source": [ "d = load_dataset(\"NousResearch/hermes-function-calling-v1\")" ] }, { "cell_type": "code", "execution_count": 32, "id": "bc731c69-3ef5-4e34-98b6-e07646241d09", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "dict_keys(['id', 'conversations', 'category', 'subcategory', 'task'])" ] }, "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d['train'][123].keys()" ] }, { "cell_type": "code", "execution_count": 30, "id": "0b54ea4f-3f2a-48dc-8efc-9cff09dd46db", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'id': '936b90da-dbeb-4864-a6e6-28899965265d',\n", " 'conversations': [{'from': 'system',\n", " 'value': \"You are a function calling AI model. You are provided with function signatures within XML tags. You may call one or more functions to assist with the user query. Don't make assumptions about what values to plug into functions.\\n\\n[{'type': 'function', 'function': {'name': 'scale_up_cluster', 'description': 'Scales up the number of compute nodes in an HPC cluster.', 'parameters': {'type': 'object', 'properties': {'cluster_name': {'type': 'string', 'description': 'The name of the HPC cluster to scale up.'}, 'node_type': {'type': 'string', 'description': 'The type of compute node to add to the cluster.'}, 'additional_nodes': {'type': 'integer', 'description': 'The number of additional compute nodes to add to the cluster.'}}, 'required': ['cluster_name', 'node_type', 'additional_nodes']}}}, {'type': 'function', 'function': {'name': 'scale_down_cluster', 'description': 'Scales down the number of compute nodes in an HPC cluster.', 'parameters': {'type': 'object', 'properties': {'cluster_name': {'type': 'string', 'description': 'The name of the HPC cluster to scale down.'}, 'node_type': {'type': 'string', 'description': 'The type of compute node to remove from the cluster.'}, 'remove_nodes': {'type': 'integer', 'description': 'The number of compute nodes to remove from the cluster.'}}, 'required': ['cluster_name', 'node_type', 'remove_nodes']}}}]\\n\\nFor each function call return a json object with function name and arguments within tags with the following schema:\\n\\n{'arguments': , 'name': }\\n\\n\"},\n", " {'from': 'human',\n", " 'value': \"Our High Performance Computing (HPC) cluster, designated as 'CFD-Sim-Cluster', is engaged in complex computational fluid dynamics simulations. With an influx of computational tasks forecasted for the upcoming week, we need to proactively expand our cluster's capacity. Therefore, I request the addition of 50 new compute nodes, specifically of the 'c5.18xlarge' type, to handle the anticipated surge in processing demands. Once the simulations have been concluded and the need for augmented resources subsides, we will need to scale back by decommissioning the same number of nodes. Could you facilitate the necessary API calls to scale our HPC cluster up and subsequently down as per the described requirements?\\n\\nHere are the details for the API calls:\\n1. Scale up the cluster 'CFD-Sim-Cluster' by adding 50 compute nodes of type 'c5.18xlarge'.\\n2. After completion of the high-demand period, scale down the 'CFD-Sim-Cluster' by removing 50 nodes of type 'c5.18xlarge'.\\n\\nI would like these API calls to be initiated to adjust our cluster's resources accordingly.\"},\n", " {'from': 'gpt',\n", " 'value': \"\\n{'arguments': {'cluster_name': 'CFD-Sim-Cluster', 'node_type': 'c5.18xlarge', 'additional_nodes': 50}, 'name': 'scale_up_cluster'}\\n\\n\\n{'arguments': {'cluster_name': 'CFD-Sim-Cluster', 'node_type': 'c5.18xlarge', 'remove_nodes': 50}, 'name': 'scale_down_cluster'}\\n\\n\"}],\n", " 'category': 'Data Centers and High Performance Computing',\n", " 'subcategory': 'Cluster Scaling',\n", " 'task': 'Scale High Performance Computing (HPC) Systems Up or Down with API Calls (POST Requests)'}" ] }, "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d['train'][123]" ] }, { "cell_type": "code", "execution_count": 32, "id": "97277dc8-3b63-486c-ab68-516c065937b3", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['IoT and Home Automation',\n", " 'IoT and Home Automation',\n", " 'IoT and Home Automation',\n", " 'IoT and Home Automation',\n", " 'IoT and Home Automation',\n", " 'IoT and Home Automation',\n", " 'IoT and Home Automation',\n", " 'IoT and Home Automation',\n", " 'IoT and Home Automation',\n", " 'IoT and Home Automation',\n", " 'IoT and Home Automation',\n", " 'IoT and Home Automation',\n", " 'IoT and Home Automation',\n", " 'IoT and Home Automation',\n", " 'IoT and Home Automation',\n", " 'Quantum Computing',\n", " 'Quantum Computing',\n", " 'Quantum Computing',\n", " 'Quantum Computing',\n", " 'Quantum Computing',\n", " 'Quantum Computing',\n", " 'Quantum Computing',\n", " 'Quantum Computing',\n", " 'Services Industry Software',\n", " 'Services Industry Software',\n", " 'Services Industry Software',\n", " 'Services Industry Software',\n", " 'Services Industry Software',\n", " 'Services Industry Software',\n", " 'Services Industry Software',\n", " 'Services Industry Software',\n", " 'Services Industry Software',\n", " 'Services Industry Software',\n", " 'Services Industry Software',\n", " 'Services Industry Software',\n", " 'Services Industry Software',\n", " 'Services Industry Software',\n", " 'Services Industry Software',\n", " 'Services Industry Software',\n", " 'Services Industry Software',\n", " 'IoT Platforms',\n", " 'IoT Platforms',\n", " 'IoT Platforms',\n", " 'IoT Platforms',\n", " 'IoT Platforms',\n", " 'IoT Platforms',\n", " 'IoT Platforms',\n", " 'IoT Platforms',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Communication Services Software',\n", " 'Materials Software',\n", " 'Materials Software',\n", " 'Materials Software',\n", " 'Materials Software',\n", " 'Materials Software',\n", " 'Materials Software',\n", " 'Materials Software',\n", " 'Materials Software',\n", " 'Materials Software',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'E-commerce Platforms',\n", " 'Blockchain Integration',\n", " 'Blockchain Integration',\n", " 'Blockchain Integration',\n", " 'Blockchain Integration',\n", " 'Blockchain Integration',\n", " 'Data Centers and High Performance Computing',\n", " 'Data Centers and High Performance Computing',\n", " 'Data Centers and High Performance Computing',\n", " 'Data Centers and High Performance Computing',\n", " 'Data Centers and High Performance Computing',\n", " 'Information Extraction',\n", " 'Information Extraction',\n", " 'Information Extraction',\n", " 'Data Privacy',\n", " 'Data Privacy',\n", " 'Data Privacy',\n", " 'Data Privacy',\n", " 'Data Privacy',\n", " 'Data Privacy',\n", " 'Data Privacy',\n", " 'Data Privacy',\n", " 'Data Privacy',\n", " 'Data Privacy',\n", " 'Annotation',\n", " 'Annotation',\n", " 'Annotation',\n", " 'Annotation',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Model APIs',\n", " 'Project Management',\n", " 'Project Management',\n", " 'Project Management',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Financial Services Apps',\n", " 'Decentralized Apps (DApps)',\n", " 'Decentralized Apps (DApps)',\n", " 'Decentralized Apps (DApps)',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Use Apps',\n", " 'Office Administration',\n", " 'Office Administration',\n", " 'Office Administration',\n", " 'Office Administration',\n", " 'Document Ranking',\n", " 'CRM',\n", " 'CRM',\n", " 'CRM',\n", " 'Marketing',\n", " 'Code Interpreters',\n", " 'Code Interpreters',\n", " 'Code Interpreters',\n", " 'Code Interpreters',\n", " 'Code Interpreters',\n", " 'Code Interpreters',\n", " 'Code Interpreters',\n", " 'Code Interpreters',\n", " 'Code Interpreters',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Algorithmic Trading',\n", " 'Energy Software',\n", " 'Energy Software',\n", " 'Energy Software',\n", " 'Energy Software',\n", " 'Energy Software',\n", " 'Energy Software',\n", " 'Energy Software',\n", " 'Energy Software',\n", " 'Energy Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Utilities Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Information Technology Software',\n", " 'Data Processing',\n", " 'Data Processing',\n", " 'Data Processing',\n", " 'Data Processing',\n", " 'Data Processing',\n", " 'Data Processing',\n", " 'Data Processing',\n", " 'Data Processing',\n", " 'Data Processing',\n", " 'Data Processing',\n", " 'Data Processing',\n", " 'Data Processing',\n", " 'Data Processing',\n", " 'Data Processing',\n", " 'Data Processing',\n", " 'Data Processing',\n", " 'Data Processing',\n", " 'Data Processing',\n", " 'Data Processing',\n", " 'Database Management',\n", " 'Database Management',\n", " 'Database Management',\n", " 'Database Management',\n", " 'Database Management',\n", " 'Database Management',\n", " 'Database Management',\n", " 'Database Management',\n", " 'Database Management',\n", " 'Database Management',\n", " 'Operating System Functions',\n", " 'Operating System Functions',\n", " 'Operating System Functions',\n", " 'Operating System Functions',\n", " 'Operating System Functions',\n", " 'Operating System Functions',\n", " 'Operating System Functions',\n", " 'Operating System Functions',\n", " 'Operating System Functions',\n", " 'Operating System Functions',\n", " 'Operating System Functions',\n", " 'Operating System Functions',\n", " 'Operating System Functions',\n", " 'Operating System Functions',\n", " 'Text Classification',\n", " 'Text Classification',\n", " 'Text Classification',\n", " 'Robotics and Automation',\n", " 'Robotics and Automation',\n", " 'Robotics and Automation',\n", " 'Robotics and Automation',\n", " 'Robotics and Automation',\n", " 'Robotics and Automation',\n", " 'Robotics and Automation',\n", " 'Robotics and Automation',\n", " 'Networking and Cybersecurity',\n", " 'Networking and Cybersecurity',\n", " 'Networking and Cybersecurity',\n", " 'Networking and Cybersecurity',\n", " 'Networking and Cybersecurity',\n", " 'Networking and Cybersecurity',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Consumer Discretionary Software',\n", " 'Named Entity Recognition',\n", " 'Named Entity Recognition',\n", " 'Named Entity Recognition',\n", " 'Named Entity Recognition',\n", " 'Named Entity Recognition',\n", " 'Named Entity Recognition',\n", " 'Named Entity Recognition',\n", " 'Named Entity Recognition',\n", " 'Information Retrieval (RAG)',\n", " 'Information Retrieval (RAG)',\n", " 'Information Retrieval (RAG)',\n", " 'Information Retrieval (RAG)',\n", " 'Information Retrieval (RAG)',\n", " 'Information Retrieval (RAG)',\n", " 'Information Retrieval (RAG)',\n", " 'Information Retrieval (RAG)',\n", " 'Information Retrieval (RAG)',\n", " 'Information Retrieval (RAG)',\n", " 'Information Retrieval (RAG)',\n", " 'Information Retrieval (RAG)',\n", " 'Information Retrieval (RAG)',\n", " 'Information Retrieval (RAG)',\n", " 'Information Retrieval (RAG)',\n", " 'Information Retrieval (RAG)',\n", " 'Information Retrieval (RAG)',\n", " 'Information Retrieval (RAG)',\n", " 'Information Retrieval (RAG)',\n", " 'Information Retrieval (RAG)',\n", " 'Productivity Tools Integration',\n", " 'Productivity Tools Integration',\n", " 'Productivity Tools Integration',\n", " 'Productivity Tools Integration',\n", " 'Productivity Tools Integration',\n", " 'Productivity Tools Integration',\n", " 'Productivity Tools Integration',\n", " 'Productivity Tools Integration',\n", " 'Web APIs',\n", " 'Web APIs',\n", " 'Web APIs',\n", " 'Web APIs',\n", " 'Web APIs',\n", " 'Web APIs',\n", " 'Web APIs',\n", " 'Web APIs',\n", " 'Web APIs',\n", " 'Low-Code Enterprise Platforms',\n", " 'Low-Code Enterprise Platforms',\n", " 'Low-Code Enterprise Platforms',\n", " 'Low-Code Enterprise Platforms',\n", " 'Low-Code Enterprise Platforms',\n", " 'Low-Code Enterprise Platforms',\n", " 'Low-Code Enterprise Platforms',\n", " 'Low-Code Enterprise Platforms',\n", " 'Low-Code Enterprise Platforms',\n", " 'Low-Code Enterprise Platforms',\n", " 'Low-Code Enterprise Platforms',\n", " 'Low-Code Enterprise Platforms',\n", " 'Low-Code Enterprise Platforms',\n", " 'Low-Code Enterprise Platforms',\n", " 'Low-Code Enterprise Platforms',\n", " 'Low-Code Enterprise Platforms',\n", " 'Low-Code Enterprise Platforms',\n", " 'Low-Code Enterprise Platforms',\n", " 'Low-Code Enterprise Platforms',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'Robotic Process Automation (RPA)',\n", " 'DevOps',\n", " 'DevOps',\n", " 'DevOps',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Industrial Software',\n", " 'Voice Assistants',\n", " 'Voice Assistants',\n", " 'Voice Assistants',\n", " 'Voice Assistants',\n", " 'Voice Assistants',\n", " 'Voice Assistants',\n", " 'Voice Assistants',\n", " 'Voice Assistants',\n", " 'Voice Assistants',\n", " 'Voice Assistants',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Healthcare Software',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'Desktop Applications',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'OpenAI API Integration',\n", " 'Business Intelligence',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'Financial Software',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'API Call',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'SaaS Platforms',\n", " 'Relation Extraction',\n", " 'Relation Extraction',\n", " 'Relation Extraction',\n", " 'Topic Modelling',\n", " 'Compliance',\n", " 'Compliance',\n", " 'Compliance',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " 'Consumer Staples Software',\n", " ...]" ] }, "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d['train']['category']" ] }, { "cell_type": "markdown", "id": "fb840196-acea-4030-9102-8c68daa204ad", "metadata": { "jp-MarkdownHeadingCollapsed": true }, "source": [ "### Pandora Tool Calling\n", "\n", "- Based on glaive-ai function calling\n", "- BSD-3\n", "- 100k examples\n", "- \n", "https://huggingface.co/datasets/danilopeixoto/pandora-tool-calling" ] }, { "cell_type": "code", "execution_count": 35, "id": "7d0a7431-019a-454d-8d90-10ef5824e60d", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "61c6a11eeb5a4bdb91a9b324d54ef54b", "version_major": 2, "version_minor": 0 }, "text/plain": [ "README.md: 0%| | 0.00/607 [00:00\\n\\nUSER: Can you explain the difference between supervised and unsupervised machine learning?\\n\\nASSISTANT: Sure, supervised learning is a type of machine learning where the algorithm learns to map inputs to outputs based on labeled examples that are provided during training. Essentially, the algorithm is given “ground truth\" data to learn from. For example, given a dataset of cat and dog images, each image would be labeled with the corresponding animal.\\n\\nOn the other hand, unsupervised learning is a type of machine learning where the algorithm learns patterns in the data without being explicitly told what those patterns are. In other words, it tries to find structure in unlabeled data. This can be useful for tasks like clustering or dimensionality reduction.\\n\\nIn summary, supervised learning requires labeled data while unsupervised learning does not. <|endoftext|>'}" ] }, "execution_count": 52, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d['train'][1455]" ] }, { "cell_type": "markdown", "id": "4dc94e2a-8ca4-4d46-928f-20c849feb82c", "metadata": {}, "source": [ "### Glaive-Function-calling-v2\n", "\n", "- Apache 2.0\n", "- 113k rows\n", "- https://huggingface.co/datasets/glaiveai/glaive-function-calling-v2" ] }, { "cell_type": "markdown", "id": "55a0b012-747e-4254-94ab-89939360d282", "metadata": {}, "source": [ "### Glaive-Function-calling-v1\n", "\n", "- Apache 2.0\n", "- 52k rows\n", "- https://huggingface.co/datasets/glaiveai/glaive-function-calling" ] }, { "cell_type": "code", "execution_count": 3, "id": "d81b5004-2af4-43b7-90b3-e9622b6decfc", "metadata": {}, "outputs": [], "source": [ "d = load_dataset(\"glaiveai/glaive-function-calling\")" ] }, { "cell_type": "code", "execution_count": 4, "id": "c806f8ab-39ef-4430-951e-e4f9e4a90c91", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'sample': 'SYSTEM: You are an helpful assistant who has access to the following functions to help the user, you can use the functions if needed-\\n{\\n \"name\": \"calculate_age\",\\n \"description\": \"Calculate the age based on the birthdate\",\\n \"parameters\": {\\n \"type\": \"string\",\\n \"description\": \"The birthdate in YYYY-MM-DD format\",\\n \"required\": true\\n }\\n}\\nUSER: Can you help me calculate my age?\\nASSISTANT: Sure! I can help you with that. Please provide me with your birthdate in YYYY-MM-DD format.\\nUSER: My birthdate is 1990-05-15.\\nASSISTANT: {\"name\": \"calculate_age\", \"arguments\": \\'{\"birthdate\": \"1990-05-15\"}\\'}\\nFUNCTION RESPONSE: {\"age\": 31}\\nASSISTANT: Based on the provided birthdate, your age is 31.\\nUSER: Thank you for calculating my age!\\nASSISTANT: You\\'re welcome! If you have any more questions or need further assistance, feel free to ask.'}" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d['train'][12312]" ] }, { "cell_type": "markdown", "id": "f7d91ae8-2a5e-4164-bbb9-d3546309888a", "metadata": {}, "source": [ "### Salesforce-xlam-functioncalling-60k\n", "\n", "- CC-by-4\n", "- 60k rows\n", "- https://huggingface.co/datasets/Salesforce/xlam-function-calling-60k" ] }, { "cell_type": "code", "execution_count": 5, "id": "8151e97d-8324-4c0d-ba02-563149ccb108", "metadata": {}, "outputs": [], "source": [ "d = load_dataset(\"Salesforce/xlam-function-calling-60k\")" ] }, { "cell_type": "code", "execution_count": 6, "id": "c3315391-36db-46c5-869a-691962bd4e3d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'id': 555,\n", " 'query': 'Determine the area of a triangle with a base of 7.5 cm and a height of 3.2 cm.',\n", " 'answers': '[{\"name\": \"triangle_area\", \"arguments\": {\"base\": 7.5, \"height\": 3.2}}]',\n", " 'tools': '[{\"name\": \"triangle_area\", \"description\": \"Computes the area of a triangle given its base and height.\", \"parameters\": {\"base\": {\"description\": \"The length of the base of the triangle.\", \"type\": \"float\"}, \"height\": {\"description\": \"The height of the triangle.\", \"type\": \"float\"}}}, {\"name\": \"batting_average\", \"description\": \"Calculates the batting average of a baseball player based on the number of hits and at-bats.\", \"parameters\": {\"num_hits\": {\"description\": \"The number of hits.\", \"type\": \"int\", \"default\": 3}, \"num_at_bats\": {\"description\": \"The number of at-bats.\", \"type\": \"int\", \"default\": 3}, \"precision\": {\"description\": \"The number of decimal places to round the batting average. Defaults to 3.\", \"type\": \"int, optional\"}}}, {\"name\": \"fibonacci_numbers\", \"description\": \"Generates the first n Fibonacci numbers.\", \"parameters\": {\"n\": {\"description\": \"The number of Fibonacci numbers to generate.\", \"type\": \"int\"}}}, {\"name\": \"investment_profit\", \"description\": \"Calculates the profit from an investment based on the initial amount, annual return rate, and time.\", \"parameters\": {\"amount\": {\"description\": \"The initial investment amount.\", \"type\": \"float\"}, \"rate\": {\"description\": \"The annual return rate expressed as a decimal.\", \"type\": \"float\"}, \"years\": {\"description\": \"The number of years the investment is held.\", \"type\": \"int\"}}}, {\"name\": \"california_alimony\", \"description\": \"Calculates the total alimony one spouse would have to pay to the other in California over a given duration.\", \"parameters\": {\"payor_monthly_income\": {\"description\": \"The monthly gross income of the payor spouse.\", \"type\": \"int\"}, \"recipient_monthly_income\": {\"description\": \"The monthly gross income of the recipient spouse.\", \"type\": \"int\"}, \"duration_years\": {\"description\": \"The duration of the alimony in years.\", \"type\": \"int\"}}}, {\"name\": \"potential_energy\", \"description\": \"Calculates the electrostatic potential energy given the charge and voltage.\", \"parameters\": {\"charge\": {\"description\": \"The electric charge.\", \"type\": \"float\"}, \"voltage\": {\"description\": \"The electric potential difference (voltage).\", \"type\": \"float\"}}}]'}" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d['train'][555]" ] }, { "cell_type": "markdown", "id": "3447d93f-da35-4516-9819-22a2442d80cb", "metadata": {}, "source": [ "### Argilla-Tool-Calling\n", "\n", "- Apache 2.0\n", "- 60k examples\n", "- https://huggingface.co/datasets/argilla-warehouse/apigen-synth-trl" ] }, { "cell_type": "code", "execution_count": 33, "id": "2b020f22-2fd3-44a6-a463-4d31bc4195ad", "metadata": {}, "outputs": [], "source": [ "d = load_dataset(\"argilla-warehouse/apigen-synth-trl\")" ] }, { "cell_type": "code", "execution_count": 34, "id": "a433c577-e282-40e3-9607-11c6d5a7cd3d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'messages': [{'content': 'You are an expert in composing functions. You are given a question and a set of possible functions. \\nBased on the question, you will need to make one or more function/tool calls to achieve the purpose. \\nIf none of the functions can be used, point it out and refuse to answer. \\nIf the given question lacks the parameters required by the function, also point it out.\\n\\nThe output MUST strictly adhere to the following format, and NO other text MUST be included.\\nThe example format is as follows. Please make sure the parameter type is correct. If no function call is needed, please make the tool calls an empty list \\'[]\\'.\\n```\\n[\\n{\"name\": \"func_name1\", \"arguments\": {\"argument1\": \"value1\", \"argument2\": \"value2\"}},\\n... (more tool calls as required)\\n]\\n```',\n", " 'role': 'system'},\n", " {'content': 'You have access to the following tools:\\n[{\"type\":\"function\",\"function\":{\"name\":\"remove_dir_recursively\",\"description\":\"Recursively removes a directory and its contents, including subdirectories and files.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"path\":{\"type\":\"string\",\"description\":\"The path to the directory to be removed.\"}},\"required\":[\"path\"]}}},{\"type\":\"function\",\"function\":{\"name\":\"pair_with_next_value\",\"description\":\"Pairs each element in the list with the next element, returning a new list\\\\nof tuples. If the last element is paired with a value, a None value is used\\\\nas the second element in the tuple.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"numbers\":{\"type\":\"array\",\"items\":{\"type\":\"integer\"},\"description\":\"A list of integers.\"}},\"required\":[\"numbers\"]}}},{\"type\":\"function\",\"function\":{\"name\":\"convert_list_of_objects_to_dict\",\"description\":\"Converts a list of objects into a list of dictionaries.\\\\n\\\\nEach dictionary has keys `type`, `color`, and `brand` corresponding to each object\\'s attributes.\",\"parameters\":{\"type\":\"object\",\"properties\":{\"obj_list\":{\"type\":\"array\",\"items\":{\"type\":\"object\"},\"description\":\"A list of objects, each with `.type`, `.color`, and `.brand` attributes.\"}},\"required\":[\"obj_list\"]}}},{\"type\":\"function\",\"function\":{\"name\":\"get_cnn_dict\",\"description\":\"Creates and returns a dictionary with predefined key-value pairs for a CNN configuration.\",\"parameters\":{\"type\":\"object\",\"properties\":{}}}}]\\n\\nPlease answer the following query:\\nRemove the directory \\'/home/user/documents/old_projects\\' and all its contents, including subdirectories and files.',\n", " 'role': 'user'},\n", " {'content': '[{\"name\": \"remove_dir_recursively\", \"arguments\": {\"path\": \"/home/user/documents/old_projects\"}}]',\n", " 'role': 'assistant'}]}" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d['train'][43123]" ] }, { "cell_type": "code", "execution_count": 1, "id": "2d915991-d590-4571-9136-382e1492603e", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "63f30928122b412ba8612f4774de79aa", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Loading checkpoint shards: 0%| | 0/30 [00:00 10\u001b[0m \u001b[38;5;28mprint\u001b[39m(outputs[\u001b[38;5;241m0\u001b[39m][\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mgenerated_text\u001b[39m\u001b[38;5;124m\"\u001b[39m][\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m1\u001b[39m][\u001b[38;5;124m'\u001b[39m\u001b[38;5;124massistant\u001b[39m\u001b[38;5;124m'\u001b[39m])\n", "\u001b[0;31mKeyError\u001b[0m: 'assistant'" ] } ], "source": [ "messages = [\n", " {\"role\": \"system\", \"content\": SYSTEM_PROMPT},\n", " {\"role\": \"user\", \"content\": f\"{EXAMPLE}\"},\n", "]\n", "\n", "outputs = pipeline(\n", " messages,\n", " max_new_tokens=8126,\n", ")\n", "print(outputs[0][\"generated_text\"][-1])" ] }, { "cell_type": "code", "execution_count": 25, "id": "da30d095-b94f-4d9a-98a5-96eee0fa57b9", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{'id': 123, \n", " 'query': 'Can you fetch the latest betting tips sorted by descending ID and also provide the schedule for the Los Angeles Lakers in the 2023 season?', \n", "'reasoning': 'To address this query, we must break it down into its components and apply logical reasoning to each part. The query involves two distinct tasks:\n", "\n", "1. **Fetching the Latest Betting Tips Sorted by Descending ID**: This task requires accessing betting tips data and sorting it in descending order based on the ID. The tool designed for this purpose is `get_all_predictions`, which allows for configurable sorting. By setting the `sort` parameter to `-id`, we can obtain the betting tips sorted as required.\n", "\n", "2. **Fetching the Schedule for the Los Angeles Lakers in the 2023 Season**: The second task involves obtaining the schedule for a specific NBA team, the Los Angeles Lakers, for the 2023 season. The tool suited for this task is `get_team_schedule`, which can fetch the schedule based on the season and team. To get the desired schedule, we need to set the `season` parameter to \"2023\" and the `teamabv` parameter to \"LAL\" when using the `get_team_schedule` tool.\n", "\n", "Given the structure of the query and the tools available, the logical approach to solving this problem involves:\n", "\n", "- **Identifying the Tools Needed**: Recognize that two separate tools (`get_all_predictions` and `get_team_schedule`) are required to fulfill the different parts of the query.\n", "- **Applying Parameters**: Understand the parameters each tool requires. For `get_all_predictions`, the critical parameter for this task is `sort`. For `get_team_schedule`, the key parameters are `season` and `teamabv`.\n", "- **Executing the Tools**: With the parameters identified, execute each tool with its respective parameters. For `get_all_predictions`, execute with `sort = \"-id\"`. For `get_team_schedule`, execute with `season = \"2023\"` and `teamabv = \"LAL\"`.\n", "- **Combining the Results**: Finally, combine the results from both tools to provide a comprehensive answer to the query, ensuring that both the sorted betting tips and the Los Angeles Lakers' schedule for the 2023 season are included.\n", "\n", "This step-by-step logical reasoning process ensures that the query is addressed in its entirety, leveraging the capabilities of the provided tools to fetch and combine the required information.',\n", " 'answers': '[{\"name\": \"get_all_predictions\", \"arguments\": {\"sort\": \"-id\"}}, {\"name\": \"get_team_schedule\", \"arguments\": {\"season\": \"2023\", \"teamabv\": \"LAL\"}}]', \n", " 'tools': '[{\"name\": \"get_all_predictions\", \"description\": \"Fetches all betting tips from the API with configurable parameters for connection, content type, sorting, and API key.\", \"parameters\": {\"connection\": {\"description\": \"Specifies the connection type for the API request. Default is \\'keep-alive\\'.\", \"type\": \"str\", \"default\": \"keep-alive\"}, \"content_type\": {\"description\": \"Sets the content type for the API request. Default is \\'application/json\\'.\", \"type\": \"str\", \"default\": \"application/json\"}, \"sort\": {\"description\": \"Criterion for sorting the betting tips. Default is \\'-id\\' for descending order.\", \"type\": \"str\", \"default\": \"-id\"}}}, {\"name\": \"get_team_schedule\", \"description\": \"Fetches the schedule for an NBA team.\", \"parameters\": {\"season\": {\"description\": \"The season year in YYYY format. Defaults to \\'2023\\'. Only \\'2022\\' and \\'2023\\' are valid.\", \"type\": \"str\", \"default\": \"2023\"}, \"teamid\": {\"description\": \"The unique identifier for the team. Accepts values from 1 to 30.\", \"type\": \"str, optional\", \"default\": \"\"}, \"teamabv\": {\"description\": \"The team\\'s abbreviation, such as \\'CHI\\' for the Chicago Bulls, \\'BOS\\' for the Boston Celtics, or \\'ATL\\' for the Atlanta Hawks. Defaults to \\'GS\\'.\", \"type\": \"str\", \"default\": \"GS\"}}}]'}\n" ] } ], "source": [ "print(outputs[0][\"generated_text\"][-1]['content'])" ] }, { "cell_type": "code", "execution_count": null, "id": "a01c1aa5-e4dd-46b2-b269-77e410c73faa", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.12.8" } }, "nbformat": 4, "nbformat_minor": 5 }