MCPcopy Index your code
hub / github.com/algorithmicsuperintelligence/optillm / solve_async

Method solve_async

optillm/rstar.py:89–101  ·  view source on GitHub ↗
(self, question: str)

Source from the content-addressed store, hash-verified

87 self.backpropagate(node, value)
88
89 async def solve_async(self, question: str) -> str:
90 self.original_question = question
91 logger.info(f"Solving question: {question}")
92 trajectories = await self.mcts_async(question)
93 if not trajectories:
94 logger.warning("No trajectories found. Unable to solve the question.")
95 return "Unable to solve the question due to insufficient reasoning paths."
96 final_trajectory = self.select_final_trajectory(trajectories)
97 logger.debug(f"Final trajectory: {[node.state for node in final_trajectory]}")
98 answers = [self.extract_answer(node.state) for node in final_trajectory]
99 final_answer = self.select_best_answer(answers)
100 logger.info(f"Selected final answer: {final_answer}")
101 return final_answer, self.rstar_completion_tokens
102
103 def generate_response(self, prompt: str) -> str:
104 logger.debug(f"Generating response for prompt: {prompt[:100]}...")

Callers 1

solveMethod · 0.95

Calls 4

mcts_asyncMethod · 0.95
extract_answerMethod · 0.95
select_best_answerMethod · 0.95

Tested by

no test coverage detected