π Dataset Website | π Paper | π Welcome Contribution | π License
We introduce MetaTool, a benchmark designed to evaluate whether LLMs have tool usage awareness and can correctly choose tools. It includes:
We introduce the ToolE dataset with 21.1k diverse user queries related to tool usage. Each entry within the dataset comprises a user request (i.e., query) along with its corresponding tool name and tool description. These queries serve as triggers that prompt LLMs to utilize specific tools.
dataset/data/all_clean_data.csv
dataset/data/multi_tool_query_golden.json
dataset/plugin_des.json
dataset/plugin_info.json
dataset/big_tool_des.json
dataset/tool_embedding.pkl
dataset/scenario
First, create an .env
file in the (put it next to src/generation/.example.env
and include the same fields).
Now, you can run the following command for a quickstart (which downloads the model and prepares the data for you): bash quickstart.sh -m <model_name> -t <task>
.
Alternatively, you can perform the below. Then, follow the results generation section.
pip install --upgrade pip
pip install -r requirements.txt
Set the HF_HOME
environment variable in the src/generation/.env
file to specify the Hugging Face model cache folder, e.g., HF_HOME=/path/to/your/huggingface/cache
.
--model-path
: Specify the Hugging Face model repository name to download.
python src/generation/model_download.py --model_path lmsys/vicuna-7b-v1.3
We use milvus
to store tool embedding and conduct similarity searching.
To install and run milvus
locally: https://milvus.io/docs/install_standalone-docker.md
Then run the following command to build a milvus
database.
python src/embedding/milvus_database.py
The pre-defined prompt templates are in src/prompt/prompt_template
If you want to generate the prompts for all tasks, run following command:
python src/prompt/prompt_construction.py
For single task prompts, run following command:
python src/prompt/prompt_construction.py [task]
Replace [task]
with one of the following task options:
similar
: Similar tool selection.scenario
: Scenario tool selection.reliable
: Reliability tool selection.multi
: Multi-tool prompt construction.all
: All tasks.You can generate results by running the run.sh script. You may need to modify the running parameters within the run.sh file to suit your specific needs.
--test_type
: Choose between tool_test_thought
or tool_test_action
depending on your testing needs.--model-path
: Specify the Hugging Face model repository name.
sh src/generation/run.sh
If you face an import error from Python, you may need to add this directory to your Python path:
# Add sys path
src_path="$(pwd)/src"
export PYTHONPATH="$PYTHONPATH:$src_path"
@article{huang2023metatool,
title = {MetaTool Benchmark: Deciding Whether to Use Tools and Which to Use},
author = {Yue Huang and Jiawen Shi and Yuan Li and Chenrui Fan and Siyuan Wu and Qihui Zhang and Yixin Liu and Pan Zhou and Yao Wan and Neil Zhenqiang Gong and Lichao Sun},
year = {2023},
journal = {arXiv preprint arXiv: 2310.03128}
}