# AnyTool

This is the implementation of the paper [AnyTool: Self-Reflective, Hierarchical Agents for Large-Scale API Calls](https://arxiv.org/abs/2402.04253)

# π§ Installation
## β
Dependencies
Require Python 3.9+
## π Quick install
```bash
pip install requirements.txt
```
# π Data
**ToolBench**
Refer to [ToolBench](https://github.com/OpenBMB/ToolBench).
**AnyToolBench**
Generation script
```
python data_generation_by_gpt4.py
```
We provide sample data in anytoolbench.json file.
# π Run AnyTool
Fill your OpenAI config and toolbench key into the config.py.
Run ToolBench
```
python anytool.py --output_dir result/test_instruction/G1_instruction --query_path data/test_instruction/G1_instruction.json --max_api_number 64
```
Run AnyToolBench
```
python anytool.py --output_dir result/anytoolbench --query_path anytoolbench.json -max_api_number 64
```
# π¨βπ« Acknowledgement
This repo is built on [ToolBench](https://github.com/OpenBMB/ToolBench).
# πCitation
If you find this project is helpful for your research, consider citing our paper
```
@article{du2024anytool,
title={AnyTool: Self-Reflective, Hierarchical Agents for Large-Scale API Calls},
author={Du, Yu and Wei, Fangyun and Zhang, Hongyang},
journal={arXiv preprint arXiv:2402.04253},
year={2024}
}
```