OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Developer Tools & SDKs

Tree of Thoughts — princeton-nlp

Tree of Thoughts is a Python implementation of a method for deliberate problem solving with large language models. It provides code, prompts, model outputs and experiment trajectories for generating candidate thoughts, evaluating intermediate states and searching across possible reasoning paths.

Independent OpenViST project profile, based on linked sources.

Tree of Thoughts — princeton-nlp — OpenViST project profile in AI Developer Tools & SDKs.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it when building or studying a Python workflow that generates multiple candidate reasoning steps and searches among them, rather than relying only on a single model response.

Who it is for

  • Developers prototyping multi-step language-model problem solving
  • Researchers exploring or reproducing Tree of Thoughts examples
  • Python users adapting the method to task-specific prompts and data

Documented uses

  • Explore branching search strategies for an LLM task.
  • Compare thought generation and state evaluation approaches.
  • Study documented examples such as Game of 24, text tasks and crosswords.
  • Extend the code with a task class, task data and task-specific prompts.
Before you choose

Requirements & limits

The repository is public and identifies its license as MIT. Setup instructions require an OpenAI API key.

  • The documented setup targets Python 3.7 or later and uses an OpenAI API key.
  • The repository offers PyPI installation or installation from source.
  • Generation can use sampled independent thoughts or sequential proposals; evaluation can use values or votes.
  • The example warns that model outputs are nondeterministic and may be incorrect.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Install the package from PyPI

Set up the Tree of Thoughts package for Python use.

Before you start

  • Python 3.7 or later
  • An OpenAI API key stored in the OPENAI_API_KEY environment variable

Steps

  1. Configure OPENAI_API_KEY in the environment.

  2. Run the command below.

    Documented command
    pip install tree-of-thoughts-llm

Expected outcome

The `tot` package is installed for use in Python.

Guide limitations

  • The repository's example calls an OpenAI model and may be slow.
  • The documented Game of 24 output is nondeterministic and can be wrong.
Source-based practical guide

Add a task to the implementation

Prepare a new task by following the repository's documented task and prompt structure.

Before you start

  • A working copy of the repository
  • Python 3.7 or later
  • An OpenAI API key stored in the OPENAI_API_KEY environment variable

Steps

  1. Create a task class under tot/tasks/ and task files under tot/data/, using tot/tasks/game24.py as an example.

  2. Add the task to tot/tasks/__init__.py.

  3. Create task-specific prompts under tot/prompts/, using tot/prompts/game24.py as an example.

  4. Choose the generation and evaluation methods and corresponding prompts for the task.

Expected outcome

The repository has the documented task and prompt components needed to extend its task set.

Guide limitations

  • The instructions describe the files and choices to prepare but do not establish that a new task will run correctly without further implementation and testing.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
13 October 2026
Original website title
princeton-nlp/tree-of-thought-llm · Official homepage title · retained in its source language