Skip to content

Tool-Planner: Dynamic Solution Tree Planning for Large Language Model with Tool Clustering

Notifications You must be signed in to change notification settings

OceannTwT/Tool-Planner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tool-Planner: Dynamic Solution Tree Planning for Large Language Model with Tool Clustering

Python Version 3.11 GitHub Stars

This is the official repository of the paper: Tool-Planner: Dynamic Solution Tree Planning for Large Language Model with Tool Clustering

Framework of Tool-Planner.

🎯Installation Enviorment

Update your environment for the required dependency.

conda create --name tool-planner python=3.11 -y
conda activate tool-planner
pip install -r requirement.txt

Collect ToolBench Util

Use the following link to download the Toolbench dataset. It will be used to extract the tool calling methods and descriptions from RapidAPI, and to complete the subsequent setup of the Toolkit.

Google Drive or Tsinghua Cloud

  • Putting the file to the main directory.
mv your_path/datas Tool-Planner
  • Make sure you have the access of ToolBench API. refer to Toolbench to apply for the permission.

Download SimCSE

Downloading SimCSE model to your local directory.

mv your_path/sup-simcse-roberta-base Tool-Planner/model

Or Upload it from HuggingFace.

tokenizer = AutoTokenizer.from_pretrained("princeton-nlp/sup-simcse-roberta-base")
model = AutoModel.from_pretrained("princeton-nlp/sup-simcse-roberta-base")

Inference Tool-Planner

Use your ChatGPT API and Toolbench API, replace the API key in run.sh, and run the following script.

bash script/run.sh

To obtain the corresponding result information for your query, change the number of toolkits and adjust the file location of the input query.

export TOOLBENCH_KEY=""
export OPENAI_KEY=""
export PYTHONPATH=./

python main.py \
    --toolkit_dir src/toolkits \
    --tool_api_dir datas/toolenv/tools/ \
    --backbone_model gpt_3.5 \
    --toolkit_num 20 \
    --openai_key $OPENAI_KEY \
    --tool_env datas/toolenv/tools/ \
    --tool_output_file tool_lib/my_tool_library.json \
    --toolkit_output_file tool_lib/my_toolkit_library.json \
    --input_query_file data/instruction/G3_query.json \
    --output_answer_file data/instruction/tool_result.json \
    --simcse_file model_lib/sup-simcse-roberta-base \
    --toolbench_key $TOOLBENCH_KEY

In the tool_lib, we provide a example of the toolkit, corresponding to the generated toolkit contents, change your output tool and toolkit file on --toolkit_output_file and --tool_output_file.

Main Results

Main Result of Tool-Planner

Evaluations

Time and Performance Evaluation

  • Experiments have demonstrated that our method exhibits competitive performance and efficient performance configuration under different approaches.

🛠️Update logs

[24/06/09] 🔥 We have released the version 1.0.0 for Tool-Planner.

🔗Citation

If you use this codebase or Tool-Planner inspires your work, we would greatly appreciate it if you could star the repository and cite it using the following BibTeX entry:

@article{liu2024tool,
  title={Tool-Planner: Dynamic Solution Tree Planning for Large Language Model with Tool Clustering},
  author={Liu, Yanming and Peng, Xinyue and Zhang, Yuwei and Cao, Jiannan and Zhang, Xuhong and Cheng, Sheng and Wang, Xun and Yin, Jianwei and Du, Tianyu},
  journal={arXiv preprint arXiv:2406.03807},
  year={2024}
}

Acknowledgement

We thank the ZJU TRAIL Lab assistance for extending Tool-Planner!

About

Tool-Planner: Dynamic Solution Tree Planning for Large Language Model with Tool Clustering

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published