Skip to content

Commit

Permalink
update: ground truth updated to 1-10, and the lats is working more ef…
Browse files Browse the repository at this point in the history
…ficiently
  • Loading branch information
Hk669 committed Dec 12, 2024
1 parent 979ed0c commit afc97b4
Show file tree
Hide file tree
Showing 3 changed files with 343 additions and 238 deletions.
10 changes: 5 additions & 5 deletions autogen/agentchat/contrib/reasoning_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"""


GRADER_message = "Rate the thinking trajectories for score 1 - 5 (1: worst, 5: best)."
GRADER_message = "Rate the response on a scale of 1 to 10 (1 being the worst and 10 being the best)."


class ThinkNode:
Expand Down Expand Up @@ -386,7 +386,7 @@ def rate_node(self, node: ThinkNode, ground_truth: str = None) -> float:
if ground_truth:
# override the system message
self.grader.update_system_message(
f"Rate the trajectory or answer for score 1 - 5 (1: worst, 5: best). The Ground Truth is:\n{ground_truth}"
f"Rate the response on a scale of 1 to 10 (1 being the worst and 10 being the best). Use the following as the evaluation criteria: Ground Truth is:\n{ground_truth}"
)
else:
self.grader.update_system_message(GRADER_message)
Expand Down Expand Up @@ -624,7 +624,7 @@ def generate_lats_response(self, messages, sender, config=None):

# Helper function to determine if we should continue searching
def should_continue(node, iteration):
if self.is_solved():
if self._root.is_solved():
return False
if iteration >= self.lats_max_iterations:
return False
Expand Down Expand Up @@ -654,8 +654,8 @@ def should_continue(node, iteration):
request_reply=True,
silent=not self.verbose,
)
# TODO: the candidate generation should be done by the assistant agent refer: https://ag2ai.github.io/ag2/docs/notebooks/lats_search/#candidate-generation,
# and im not sure how to do that, so for now we will just use the last message of the thinker
# TODO: the candidate generation should be done different, refer: https://ag2ai.github.io/ag2/docs/notebooks/lats_search/#candidate-generation,
# and im not sure how to approach, so for now we will just use the last message.
candidates = re.findall(
r"Option \d+:(.+?)(?=Option \d+:|$)", self.thinker.last_message()["content"].strip(), re.DOTALL
)
Expand Down
Loading

0 comments on commit afc97b4

Please sign in to comment.