I want to implement ToT tree of thoughts framework by using open source langauge model

Tree of Thoughts (ToT) is a framework for using large language models (LLMs) to solve complex reasoning tasks. ToT works by framing the problem as a search over a tree of thoughts, where each node in the tree represents a partial solution. The ToT algorithm then uses a search algorithm to explore the tree of thoughts and find the best solution.

I want to implement task of creative writing, or game of 24 for it

You can find paper here
implementation using GPT 4

what should be my approach or algorithm to code it? and which dataset to use for it? what model should I use?