Skip to content

Releases: kyegomez/tree-of-thoughts

0.3.6

29 Jul 19:10
Compare
Choose a tag to compare
forget init

0.3.5 Langchain TOT

29 Jul 19:02
Compare
Choose a tag to compare

Changelog

  1. LangchainTOT Class Definition: Introduced the LangchainTOT class to encapsulate all operations related to the Tree of Thought (ToT) process. This class holds an instance of the language model, the problem description, the thought checker, and the list of thoughts.

  2. LangchainTOT Class Customization: Added optional parameters to the constructor of the LangchainTOT class for temperature, max_tokens, problem_description, model, and checker_class to make the class customizable. This allows for the customization of the language model and thought checker based on specific needs.

  3. LangchainTOT Class Error Handling: Incorporated error handling within the check_thoughts method of the LangchainTOT class. It now raises a ValueError if no thoughts have been added or if the problem description hasn't been set, improving the robustness of the code.

  4. MyChecker Class Polymorphism: Redefined the MyChecker class to make it more polymorphic and generalizable for any task. MyChecker now takes a validation function as a parameter, which defines how to check the validity of thoughts for a specific problem. This allows for the creation of checkers for any kind of problem, not just Sudoku.

  5. LangchainTOT Class Simplification: Simplified the initialization of the LangchainTOT class by removing the parameter configuration from the instantiation of the OpenAI class. The LangchainTOT class now automatically configures these parameters based on the constructor arguments.

  6. Code Cleanup: Cleaned up and debugged the code. Simplified the imports by using only the necessary ones. Reorganized the code for clarity and ease of understanding.

  7. Documentation: Provided a detailed documentation explaining how to use the LangchainTOT and MyChecker classes, and how to define a custom validation function.

e28

06 Jun 19:37
Compare
Choose a tag to compare
e28

File ~...\treeofthoughts.py:267 in reconstruct_path
path = self.reconstruct_path(came_from, current_state)

TypeError: reconstruct_path() missing 1 required positional argument: 'initial_prompt'

E27

06 Jun 15:26
Compare
Choose a tag to compare
E27
  • DELETED LOGS FOLDER WITH WEIRD NAME FILES

E26

05 Jun 20:27
Compare
Choose a tag to compare
E26
  • Fixed file logging save error

E26

04 Jun 23:08
Compare
Choose a tag to compare
E26

Tree of Thought Search Classes Documentation

Class: TreeofThoughts

This class represents the base class for the Tree of Thoughts search algorithm. It contains the following methods:

  • __init__(self, model): Initializes the TreeofThoughts object with the given model.
  • save_tree_to_json(self, file_name): Saves the tree to a JSON file with the given file name.
  • logNewState(self, state, evaluation): Logs a new state and its evaluation to the tree.
  • adjust_pruning_threshold_precentile(self, evaluated_thoughts, percentile): Adjusts the pruning threshold based on the percentile of evaluated thoughts.
  • adjust_pruning_threshold_moving_average(self, evaluated_thoughts, window_size): Adjusts the pruning threshold based on the moving average of evaluated thoughts.

Class: TreeofThoughtsBFS

This class represents the Breadth-First Search (BFS) variant of the Tree of Thoughts search algorithm. It inherits from the TreeofThoughts class and contains the following method:

  • solve(self, initial_prompt, num_thoughts, max_steps, max_states, value_threshold, pruning_threshold=0.5): Solves the problem using BFS with the given parameters.

Class: TreeofThoughtsDFS

This class represents the Depth-First Search (DFS) variant of the Tree of Thoughts search algorithm. It inherits from the TreeofThoughts class and contains the following method:

  • solve(self, initial_prompt, num_thoughts, max_steps, value_threshold, pruning_threshold=0.5): Solves the problem using DFS with the given parameters.

Class: TreeofThoughtsBEST

This class represents the Best-First Search variant of the Tree of Thoughts search algorithm. It contains the following methods:

  • __init__(self, model): Initializes the TreeofThoughtsBEST object with the given model.
  • save_tree_to_json(self, file_name): Saves the tree to a JSON file with the given file name.
  • log_new_state(self, state, evaluation): Logs a new state and its evaluation to the tree.
  • solve(self, initial_prompt, num_thoughts, max_steps, pruning_threshold): Solves the problem using Best-First Search with the given parameters.

Class: TreeofThoughtsASearch

This class represents the A* Search variant of the Tree of Thoughts search algorithm. It contains the following methods:

  • __init__(self, model): Initializes the TreeofThoughtsASearch object with the given model.
  • solve(self, initial_prompt, num_thoughts=5, max_steps=30, pruning_threshold=0.4): Solves the problem using A* Search with the given parameters.
  • is_goal(self, state, score): Determines if the given state is a goal state based on its score.
  • reconstruct_path(self, came_from, current_state, initial_prompt): Reconstructs the path from the initial state to the current state using the came_from dictionary.

Class: MonteCarloTreeofThoughts

This class represents the Monte Carlo Tree Search variant of the Tree of Thoughts search algorithm. It inherits from the TreeofThoughts class and contains the following methods:

  • __init__(self, model, objective="balance"): Initializes the MonteCarloTreeofThoughts object with the given model and objective.
  • optimize_params(self, num_thoughts, max_steps, max_states): Optimizes the search parameters based on the objective.
  • solve(self, initial_prompt, num_thoughts, max_steps, max_states, pruning_threshold): Solves the problem using

Monte Carlo Tree Search with the given parameters.

  • monte_carlo_search(self, initial_prompt, num_thoughts, max_steps, max_states, pruning_threshold): Performs the Monte Carlo Tree Search with the given parameters.

Class: OptimizedTreeofThoughts

This class represents an optimized version of the Tree of Thoughts search algorithm. It inherits from the TreeofThoughts class and contains the following method:

  • solve(self, x, k=None, T=None, b=None, vth=None, timeout=None, confidence_threshold=None, max_iterations=None, convergence_threshold=None, convergence_count=None): Solves the problem using an optimized search algorithm with the given parameters.

e25

01 Jun 02:09
Compare
Choose a tag to compare
e25
  • Better prompts for few shot or one shot general learner prompts
  • handling for rejected reasoning paths

e24

30 May 15:08
Compare
Choose a tag to compare
e24
  • Fixed none existent params in solve method of tree of thougths

e23

30 May 13:50
Compare
Choose a tag to compare
e23
  • Clean up positional args in treeofthoughts.solve()

e22

29 May 23:01
Compare
Choose a tag to compare
e22
  • removed dotenv