This is the companion code repository for my blog post on implementing a Tree of Thoughts in Python.
In this tutorial, I will walk through the implementation of a Tree of Thoughts in Python. The Tree of Thoughts is a conceptual framework that helps in exploring and evolving ideas systematically. I will use the Anthropic API to generate responses and build our tree.
To get started, follow these steps:
-
Clone the repository:
git clone git@github.com:stephenc222/example-tree-of-thoughts-prompting.git cd example-tree-of-thoughts-prompting
-
Set up your environment variables:
-
Create a
.env
file in the root directory of the project. -
Add your Anthropic API key to the
.env
file:ANTHROPIC_API_KEY=YOUR_ANTHROPIC_API_KEY
-
-
Install the required dependencies:
pip3 install python-dotenv anthropic
To run the Tree of Thoughts implementation, execute the following command:
python3 app.py