Code Monkey home page Code Monkey logo

languageagenttreesearch's Introduction

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 our project website or paper

Check out our demo, CodeLATS at our demo

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 LanguageAgentTreeSearch/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 LanguageAgentTreeSearch/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

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 LanguageAgentTreeSearch/webshop
  1. Install WebShop from source and run environment instance locally. Follow the instructions here (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 local 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

Trajectories

programming/root/ contains all the trajectories from the paper's experiments on programming. Please use get_acc.py with the log path to get the actual accuracy. HotPotQA and WebShop logs were too large to upload, feel free to email if interested.

Citations

Please cite the paper and star this repo if you use LATS and find it interesting. Feel free to contact [email protected] 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}
}

languageagenttreesearch's People

Contributors

andyz245 avatar afrancoc2000 avatar tohrnii avatar eltociear avatar bilibraker avatar zby avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.