Skip to content

hieu-blackbox/LanguageAgentTreeSearch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Official Repo of Language Agent Tree Search (LATS)

Build License

teaser

Official implementation for paper Language Agent Tree Search Unifies Reasoning Acting and Planing in Language Models with code, prompts, model outputs. More can be found at https://andyz245.github.io/LanguageAgentTreeSearch/

Reasoning + Acting (HotPotQA)

Setup

To get started:

  1. Clone this repo and move to the HotPotQA directory:
git clone https://github.com/andyz245/LanguageAgentTreeSearch && cd hotpot
  1. Install the module dependencies into your environment:
pip install -r requirements.txt
  1. Set OPENAI_API_KEY environment variable to your OpenAI API key:
export OPENAI_API_KEY=<your key>
  1. Set the scripts and run paper experiments
sh lats.sh
  • --n_generate_sample: number of times to prompt during expansion/sampling
  • --n_evaluate_sample: number of times to prompt for state evaluation
  • --iterations: maximum number of trajectories to sample

Reasoning (Programming)

Setup

To get started:

  1. Clone this repo and move to the HotPotQA directory:
git clone https://github.com/andyz245/LanguageAgentTreeSearch && cd programming
  1. Install the module dependencies into your environment:
pip install -r requirements.txt
  1. Set OPENAI_API_KEY environment variable to your OpenAI API key:
export OPENAI_API_KEY=<your key>
  1. Set the scripts and run paper experiments
sh run_lats.sh

root/ contains all the trajectories from the paper's experiments

Code adapted from https://github.com/noahshinn024/reflexion/tree/main

Decision-making (WebShop)

Setup

To get started:

  1. Clone this repo and move to the WebShop directory:
git clone https://github.com/andyz245/LanguageAgentTreeSearch && cd webshop
  1. Install WebShop from source and run environment instance locally. (https://github.com/princeton-nlp/WebShop)

  2. Install the module dependencies into your environment:

pip install -r requirements.txt
  1. Set OPENAI_API_KEY environment variable to your OpenAI API key:
export OPENAI_API_KEY=<your key>
  1. Change localhost in lats.py to your port running WebShop

  2. Set the scripts and run paper experiments

sh lats.sh
  • --n_generate_sample: number of times to prompt during expansion/sampling
  • --n_evaluate_sample: number of times to prompt for state evaluation
  • --iterations: maximum number of trajectories to sample

Citations

Please cite the paper and star this repo if you use LATS and find it interesting/useful, thanks! Feel free to contact andyz3@illinois.edu or open an issue if you have any questions.

@misc{zhou2023language,
      title={Language Agent Tree Search Unifies Reasoning Acting and Planning in Language Models}, 
      author={Andy Zhou and Kai Yan and Michal Shlapentokh-Rothman and Haohan Wang and Yu-Xiong Wang},
      year={2023},
      eprint={2310.04406},
      archivePrefix={arXiv},
      primaryClass={cs.AI}
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.6%
  • Shell 0.4%