Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions rdagent/scenarios/data_science/dev/feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ def generate_feedback(self, exp: DSExperiment, trace: DSTrace) -> ExperimentFeed
exp=sota_exp, heading="SOTA of previous exploration of the scenario"
)

last_exp = trace.last_exp()

# Get feedback description using shared template
feedback_desc = T("scenarios.data_science.share:describe.feedback").r(
exp_and_feedback=trace.hist[-1] if trace.hist else None, heading="Previous Trial Feedback"
exp_and_feedback=trace.last_exp_fb(), heading="Previous Trial Feedback"
)

# TODO:
Expand Down
14 changes: 12 additions & 2 deletions rdagent/scenarios/data_science/proposal/exp_gen/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,20 @@ def last_exp(
"""
Access the last experiment
"""
search_list = self.retrieve_search_list(search_type)
if (last_exp_fb := self.last_exp_fb(search_type=search_type)) is not None:
return last_exp_fb[0]
return None

def last_exp_fb(
self,
search_type: Literal["all", "ancestors"] = "ancestors",
) -> tuple[DSExperiment, ExperimentFeedback] | None:
"""
Access the last experiment and feedback
"""
search_list = self.retrieve_search_list(search_type)
for exp, ef in search_list[::-1]:
return exp
return exp, ef
return None

def last_runnable_exp_fb(
Expand Down