Skip to content

Commit

Permalink
TypeError: reconstruct_path() missing 1 required positional argument:…
Browse files Browse the repository at this point in the history
… 'initial_prompt
  • Loading branch information
Kye committed Jun 6, 2023
1 parent bbdd5cb commit 13d59b8
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions tree_of_thoughts/treeofthoughts.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def reconstruct_path(self, came_from, current_state, initial_prompt):
path.append(current_state)
path.reverse()

path = self.reconstruct_path(came_from, current_state)
path = self.reconstruct_path(came_from, current_state, initial_prompt)
solution = self.model.generate_solution(initial_prompt, path)
print(f"Path: {path} solution: {solution}")
return solution if solution else path
Expand Down Expand Up @@ -385,23 +385,23 @@ def monte_carlo_search(self,
solution = self.model.generate_solution(initial_prompt, best_state)
return solution if solution else best_state

#does not output state after each thought --- idk why -- needs work
class OptimizedTreeofThoughts(TreeofThoughts):
def 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):
start_time = time.time()
print(f'Start time {start_time}')
if self.search_algorithm == 'BFS':
while timeout is None or time.time() - start_time < timeout:
result = self.tot_bfs(x, k, T, b, pruning_threshold=0.5)
print(f'result in optimized tree of thoughts: {result}')
if result:
return result
elif self.search_algorithm == 'DFS':
while timeout is None or time.time() - start_time < timeout:
result = self.tot_dfs(x, k, T, vth, confidence_threshold=confidence_threshold, max_iterations=max_iterations, convergence_threshold=convergence_threshold, convergence_count=convergence_count)
if result:
return result
else:
raise ValueError("Invalid search algorithm. Choose 'BFS' or 'DFS'.")
# #does not output state after each thought --- idk why -- needs work
# class OptimizedTreeofThoughts(TreeofThoughts):
# def 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):
# start_time = time.time()
# print(f'Start time {start_time}')
# if self.search_algorithm == 'BFS':
# while timeout is None or time.time() - start_time < timeout:
# result = self.tot_bfs(x, k, T, b, pruning_threshold=0.5)
# print(f'result in optimized tree of thoughts: {result}')
# if result:
# return result
# elif self.search_algorithm == 'DFS':
# while timeout is None or time.time() - start_time < timeout:
# result = self.tot_dfs(x, k, T, vth, confidence_threshold=confidence_threshold, max_iterations=max_iterations, convergence_threshold=convergence_threshold, convergence_count=convergence_count)
# if result:
# return result
# else:
# raise ValueError("Invalid search algorithm. Choose 'BFS' or 'DFS'.")


0 comments on commit 13d59b8

Please sign in to comment.