{
"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, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "fcc06b6bd82340748921634b3e87642e",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"train.parquet: 0%| | 0.00/84.5M [00:00, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8a2f7b5965744a3d94fe37c2f0456c83",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"valid.parquet: 0%| | 0.00/4.54M [00:00, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a6f7bfafd9984673969682f36feed3f0",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"test.parquet: 0%| | 0.00/4.64M [00:00, ?B/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "254a71cd015544cf833ff566186e86c2",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Generating train split: 0%| | 0/101114 [00:00, ? examples/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "7cf5da220c554c9081f2488397a089b4",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Generating validation split: 0%| | 0/5618 [00:00, ? examples/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "351dc7a5bc2e459995618457b88aee3d",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Generating test split: 0%| | 0/5619 [00:00, ? examples/s]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"d = load_dataset(\"danilopeixoto/pandora-tool-calling\")"
]
},
{
"cell_type": "code",
"execution_count": 38,
"id": "e10dee89-26dc-406d-a595-7ee1a19fbef0",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'messages': [{'role': 'system',\n",
" 'content': 'You are a helpful assistant with access to functions and tools. Use them if required.',\n",
" 'tools': None,\n",
" 'tool_calls': None,\n",
" 'name': None},\n",
" {'role': 'system',\n",
" 'content': None,\n",
" 'tools': '[{\"name\": \"generate_random_quote\", \"description\": \"Generate a random inspirational quote\", \"parameters\": {}}, {\"name\": \"calculate_loan_payment\", \"description\": \"Calculate the monthly payment for a loan\", \"parameters\": {\"type\": \"object\", \"properties\": {\"loan_amount\": {\"type\": \"number\", \"description\": \"The total loan amount\"}, \"interest_rate\": {\"type\": \"number\", \"description\": \"The annual interest rate on the loan\"}, \"loan_term\": {\"type\": \"integer\", \"description\": \"The duration of the loan in months\"}}, \"required\": [\"loan_amount\", \"interest_rate\", \"loan_term\"]}}]',\n",
" 'tool_calls': None,\n",
" 'name': None},\n",
" {'role': 'user',\n",
" 'content': \"I'm feeling a bit down today. Can you share something inspiring?\",\n",
" 'tools': None,\n",
" 'tool_calls': None,\n",
" 'name': None},\n",
" {'role': 'assistant',\n",
" 'content': None,\n",
" 'tools': None,\n",
" 'tool_calls': '[{\"name\": \"generate_random_quote\"}]',\n",
" 'name': None},\n",
" {'role': 'tool',\n",
" 'content': '{\"quote\": \"The only way to do great work is to love what you do. - Steve Jobs\"}',\n",
" 'tools': None,\n",
" 'tool_calls': None,\n",
" 'name': 'generate_random_quote'},\n",
" {'role': 'assistant',\n",
" 'content': 'I\\'m sorry to hear that you\\'re feeling down. Here\\'s a quote for you: \"The only way to do great work is to love what you do.\" - Steve Jobs. I hope this inspires you!',\n",
" 'tools': None,\n",
" 'tool_calls': None,\n",
" 'name': None}]}"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"d['train'][21313]"
]
},
{
"cell_type": "markdown",
"id": "d382beb5-785b-44ed-978a-315e1636d9e6",
"metadata": {},
"source": [
"### Reflection-v1 Glaive ai\n",
"\n",
"- Apache 2.0\n",
"- 60k examples\n",
"- https://huggingface.co/datasets/glaiveai/reflection-v1"
]
},
{
"cell_type": "code",
"execution_count": 51,
"id": "9445c17d-88b6-4543-bc5a-977d74701024",
"metadata": {},
"outputs": [],
"source": [
"d = load_dataset(\"glaiveai/glaive-function-calling-v2\")"
]
},
{
"cell_type": "code",
"execution_count": 52,
"id": "3a946d48-b9b5-4a54-bb86-9a46d9404a13",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'system': 'SYSTEM: You are a helpful assistant, with no access to external functions.\\n\\n',\n",
" 'chat': 'USER: How can I write a C# program that calculates the difference between two given dates in years?\\nHere\\'s a starter code:\\nDateTime givenDate = new DateTime(2015, 8, 12);\\nDateTime currentDate = DateTime.Today;\\nTimeSpan difference = currentDate - givenDate;\\nint years = (int)(difference.TotalDays / 365.25);\\nConsole.WriteLine(\"The difference between the given date and today\\'s date is: \" + years + \" years.\");\\nYou can replace the given date with any date of your choice. How can this code be optimized for better performance?\\n\\nASSISTANT: The code you provided is already quite efficient, but there are a few optimizations you can make:\\n1. Instead of dividing by 365.25 to get the number of years, you can use the TotalDays property of the TimeSpan object and divide by the average number of days in a year (365.2425). This will give you a more accurate result.\\n2. You can use the TryParseExact method to parse the input dates, which will improve the performance and handle any formatting issues.\\nHere\\'s an optimized version of the code:\\nDateTime givenDate;\\nDateTime currentDate = DateTime.Today;\\nif (DateTime.TryParseExact(\"2015-08-12\", \"yyyy-MM-dd\", CultureInfo.InvariantCulture, DateTimeStyles.None, out givenDate))\\n{\\n TimeSpan difference = currentDate - givenDate;\\n int years = (int)(difference.TotalDays / 365.2425);\\n Console.WriteLine(\"The difference between the given date and today\\'s date is: \" + years + \" years.\");\\n}\\nelse\\n{\\n Console.WriteLine(\"Invalid date format.\");\\n}\\nYou can replace the input date and format with any values of your choice. <|endoftext|>\\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, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Device set to use cuda:0\n"
]
}
],
"source": [
"import transformers\n",
"import torch\n",
"\n",
"model_id = \"meta-llama/Llama-3.3-70B-Instruct\"\n",
"\n",
"pipeline = transformers.pipeline(\n",
" \"text-generation\",\n",
" model=model_id,\n",
" model_kwargs={\"torch_dtype\": torch.bfloat16},\n",
" device_map=\"cu\",\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "6472557b-53b3-4b69-893a-2aebfd3b0a93",
"metadata": {},
"outputs": [],
"source": [
"EXAMPLE = d['train'][123]"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "6251993c-cfb8-4d4d-844e-45f9ca93c957",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'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",
" '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\"}}}]'}"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"EXAMPLE"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "ea98eef3-3e9b-40a7-bd37-a4867196bd9c",
"metadata": {},
"outputs": [],
"source": [
"SYSTEM_PROMPT = \"\"\"\n",
"You are high 170IQ reasoning scientist model, your job is to take existing messages from conversations with a dumb AI and \n",
"add reasoning to it, remember we are adding chain of thought to the existing example without modifying what it does, \n",
"think out loud and max out your tokens. \n",
"\n",
"Below is an example: \n",
"\n",
"INPUT: \"{'id': 12314,\n",
" 'query': 'Can you provide the innings details for the cricket event with ID 12345 and the football predictions for the Premier League on August 15, 2023?',\n",
" 'answers': '[{\"name\": \"innings_cricket\", \"arguments\": {\"event_id\": 12345}}, {\"name\": \"daily_predictions\", \"arguments\": {\"league\": \"Premier League\", \"date\": \"2023-08-15\"}}]',\n",
" 'tools': '[{\"name\": \"innings_cricket\", \"description\": \"Fetch innings data for a cricket event given the event ID.\", \"parameters\": {\"event_id\": {\"description\": \"The unique identifier of the cricket event.\", \"type\": \"int\", \"default\": \"10188874\"}}}, {\"name\": \"daily_predictions\", \"description\": \"Fetches daily football predictions using various filters and pagination support.\", \"parameters\": {\"league\": {\"description\": \"The league identifier for filtering predictions. Example: \\'1\\'.\", \"type\": \"str, optional\", \"default\": \"\"}, \"page\": {\"description\": \"The page number for pagination. Example: \\'1\\'.\", \"type\": \"str, optional\", \"default\": \"1\"}, \"market\": {\"description\": \"The market type for filtering predictions. Example: \\'1X2\\', \\'OU25\\', \\'bts\\'.\", \"type\": \"str, optional\", \"default\": \"\"}, \"date\": {\"description\": \"The date for filtering predictions in the format \\'YYYY-MM-DD\\'. Example: \\'2022-08-13\\'.\", \"type\": \"str, optional\", \"default\": \"\"}}}]'}\"\n",
"\n",
"OUTPUT: \"{'id': 12314,\n",
" 'query': 'Can you provide the innings details for the cricket event with ID 12345 and the football predictions for the Premier League on August 15, 2023?',\n",
" 'reasoning' : 'To address the query regarding the innings details for a specific cricket event and the football predictions for the Premier League on a given date, we must break down the problem into its components and apply logical reasoning to each part. The query involves two distinct tasks:\\n\\n1. **Fetching Innings Details for a Cricket Event**: This task requires accessing data related to a cricket event specified by an ID (in this case, 12345). The tool designed for this purpose is `innings_cricket`, which takes an `event_id` as its argument. By providing the `event_id` as 12345 to the `innings_cricket` tool, we can obtain the innings details for the specified cricket event.\\n\\n2. **Fetching Football Predictions for the Premier League**: The second task involves obtaining football predictions for the Premier League on a specific date, August 15, 2023. The tool suited for this task is `daily_predictions`, which can filter predictions based on several parameters, including `league`, `date`, and others. To get the desired predictions, we need to set the `league` parameter to \"Premier League\" and the `date` parameter to \"2023-08-15\" when using the `daily_predictions` tool.\\n\\nGiven 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 (`innings_cricket` and `daily_predictions`) are required to fulfill the different parts of the query.\\n- **Applying Parameters**: Understand the parameters each tool requires. For `innings_cricket`, the critical parameter is `event_id`. For `daily_predictions`, the key parameters are `league` and `date`.\\n- **Executing the Tools**: With the parameters identified, execute each tool with its respective parameters. For `innings_cricket`, execute with `event_id = 12345`. For `daily_predictions`, execute with `league = \"Premier League\"` and `date = \"2023-08-15\"`.\\n- **Combining the Results**: Finally, combine the results from both tools to provide a comprehensive answer to the query, ensuring that both the innings details for the cricket event and the football predictions for the Premier League on the specified date are included.\\n\\nThis 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\": \"innings_cricket\", \"arguments\": {\"event_id\": 12345}}, {\"name\": \"daily_predictions\", \"arguments\": {\"league\": \"Premier League\", \"date\": \"2023-08-15\"}}]',\n",
" 'tools': '[{\"name\": \"innings_cricket\", \"description\": \"Fetch innings data for a cricket event given the event ID.\", \"parameters\": {\"event_id\": {\"description\": \"The unique identifier of the cricket event.\", \"type\": \"int\", \"default\": \"10188874\"}}}, {\"name\": \"daily_predictions\", \"description\": \"Fetches daily football predictions using various filters and pagination support.\", \"parameters\": {\"league\": {\"description\": \"The league identifier for filtering predictions. Example: \\'1\\'.\", \"type\": \"str, optional\", \"default\": \"\"}, \"page\": {\"description\": \"The page number for pagination. Example: \\'1\\'.\", \"type\": \"str, optional\", \"default\": \"1\"}, \"market\": {\"description\": \"The market type for filtering predictions. Example: \\'1X2\\', \\'OU25\\', \\'bts\\'.\", \"type\": \"str, optional\", \"default\": \"\"}, \"date\": {\"description\": \"The date for filtering predictions in the format \\'YYYY-MM-DD\\'. Example: \\'2022-08-13\\'.\", \"type\": \"str, optional\", \"default\": \"\"}}}]'}\"\n",
"\n",
"\n",
"Make sure you follow this approach and return outputs that add the 'reasoning' traces but DO NOT alter any existing calls\n",
"\"\"\""
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "0a05f4ba-d62d-4e1a-8498-119db718a1cd",
"metadata": {},
"outputs": [
{
"ename": "KeyError",
"evalue": "'assistant'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[20], line 10\u001b[0m\n\u001b[1;32m 1\u001b[0m messages \u001b[38;5;241m=\u001b[39m [\n\u001b[1;32m 2\u001b[0m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrole\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msystem\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcontent\u001b[39m\u001b[38;5;124m\"\u001b[39m: SYSTEM_PROMPT},\n\u001b[1;32m 3\u001b[0m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrole\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124muser\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcontent\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mEXAMPLE\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m},\n\u001b[1;32m 4\u001b[0m ]\n\u001b[1;32m 6\u001b[0m outputs \u001b[38;5;241m=\u001b[39m pipeline(\n\u001b[1;32m 7\u001b[0m messages,\n\u001b[1;32m 8\u001b[0m max_new_tokens\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m8126\u001b[39m,\n\u001b[1;32m 9\u001b[0m )\n\u001b[0;32m---> 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
}